Re: [U-Boot] merge arm64 to arm

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 08/18/2013 11:46 PM, Sharma Bhupesh-B45370 wrote:
[Re-posting as original msg was rejected due to HTML content..]
FengHua fenghua@phytium.com.cn writes:
FengHua fenghua@phytium.com.cn writes:
hi tom, hi albert, yes, it's right. the u-boot could be more uniformly and maintainable if merging armv8 to arm architecture. I will try to migrate arm64 to armv8 subarchitecture of arm. do you have any other advice?
Why? The architectures are vastly different, arm64 (aarch64) being only loosely inspired by the 32-bit arm. It is not like with x86/amd64 where a lot of code can be shared.
Of course, with a seperated architecture the arm64 code will be clear and simple. when it merged with arm a few file should be duplicated with the name "_v8" appended and many macro switch should be added. but most of the code will be in armv8 directory which paralleled with armv7. it seems that this implementation are more nice.
ARMv8 defines both a 32-bit (aarch32) and a 64-bit (aarch64) instruction set. The naming you are suggesting would be misleading.
aarch32 state is compatible with armv7. armv8 directory only provide aarch64 state support. as you said, it would be a little misleading.
ARMv8 ARM (Architecture Reference Manual) mentions that the ARMv8 architecture has support for both AArch32 and AArch64 and the ARM can switch b/w the two instruction sets via exceptions.
So, whether choosing a naming convention similar to linux (arch/arm64) would be more suitable is something to consider (even though some of the files might be a copy of what is available in arch/arm/cpu/armv7)?
I think we'll see what happens with a single directory first. We aren't talking about a binary that has to work on all cases (right now...) and we want to avoid massive duplication of all of the C code that really won't change.
- -- Tom

Tom Rini trini@ti.com writes:
On 08/18/2013 11:46 PM, Sharma Bhupesh-B45370 wrote:
[Re-posting as original msg was rejected due to HTML content..]
FengHua fenghua@phytium.com.cn writes:
FengHua fenghua@phytium.com.cn writes:
> hi tom, hi albert, yes, it's right. the u-boot could be > more uniformly and maintainable if merging armv8 to arm > architecture. I will try to migrate arm64 to armv8 > subarchitecture of arm. do you have any other advice?
Why? The architectures are vastly different, arm64 (aarch64) being only loosely inspired by the 32-bit arm. It is not like with x86/amd64 where a lot of code can be shared.
Of course, with a seperated architecture the arm64 code will be clear and simple. when it merged with arm a few file should be duplicated with the name "_v8" appended and many macro switch should be added. but most of the code will be in armv8 directory which paralleled with armv7. it seems that this implementation are more nice.
ARMv8 defines both a 32-bit (aarch32) and a 64-bit (aarch64) instruction set. The naming you are suggesting would be misleading.
aarch32 state is compatible with armv7. armv8 directory only provide aarch64 state support. as you said, it would be a little misleading.
ARMv8 ARM (Architecture Reference Manual) mentions that the ARMv8 architecture has support for both AArch32 and AArch64 and the ARM can switch b/w the two instruction sets via exceptions.
So, whether choosing a naming convention similar to linux (arch/arm64) would be more suitable is something to consider (even though some of the files might be a copy of what is available in arch/arm/cpu/armv7)?
I think we'll see what happens with a single directory first. We aren't talking about a binary that has to work on all cases (right now...)
A single binary can obviously never work.
and we want to avoid massive duplication of all of the C code that really won't change.
If there's a lot of code shared between these architectures, why is it in an architecture-specific directory in the first place? Maybe the proper solution is to move it out of arch/arm rather than moving code for an entirely different architecture in there.

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 08/19/2013 08:32 AM, Måns Rullgård wrote:
Tom Rini trini@ti.com writes:
On 08/18/2013 11:46 PM, Sharma Bhupesh-B45370 wrote:
[Re-posting as original msg was rejected due to HTML content..]
FengHua fenghua@phytium.com.cn writes:
> FengHua fenghua@phytium.com.cn writes: > >> hi tom, hi albert, yes, it's right. the u-boot could >> be more uniformly and maintainable if merging armv8 >> to arm architecture. I will try to migrate arm64 to >> armv8 subarchitecture of arm. do you have any other >> advice? > > Why? The architectures are vastly different, arm64 > (aarch64) being only loosely inspired by the 32-bit > arm. It is not like with x86/amd64 where a lot of code > can be shared.
Of course, with a seperated architecture the arm64 code will be clear and simple. when it merged with arm a few file should be duplicated with the name "_v8" appended and many macro switch should be added. but most of the code will be in armv8 directory which paralleled with armv7. it seems that this implementation are more nice.
ARMv8 defines both a 32-bit (aarch32) and a 64-bit (aarch64) instruction set. The naming you are suggesting would be misleading.
aarch32 state is compatible with armv7. armv8 directory only provide aarch64 state support. as you said, it would be a little misleading.
ARMv8 ARM (Architecture Reference Manual) mentions that the ARMv8 architecture has support for both AArch32 and AArch64 and the ARM can switch b/w the two instruction sets via exceptions.
So, whether choosing a naming convention similar to linux (arch/arm64) would be more suitable is something to consider (even though some of the files might be a copy of what is available in arch/arm/cpu/armv7)?
I think we'll see what happens with a single directory first. We aren't talking about a binary that has to work on all cases (right now...)
A single binary can obviously never work.
and we want to avoid massive duplication of all of the C code that really won't change.
If there's a lot of code shared between these architectures, why is it in an architecture-specific directory in the first place? Maybe the proper solution is to move it out of arch/arm rather than moving code for an entirely different architecture in there.
We are working in that direction (and one of the requests was to hook into that code, rather than duplicate things). Think of it as "all ARM Ltd licensed cores" not "all 32bit-only ARM cores".
And maybe it's a little bit of OSS thickheadedness, but looking over the parts of the code that aren't in the armv8 directory already we have a lot of "re-use asm-generic file" and "maybe slightly tweak the existing arm file slightly".
- -- Tom

Tom Rini trini@ti.com writes:
On 08/19/2013 08:32 AM, Måns Rullgård wrote:
Tom Rini trini@ti.com writes:
On 08/18/2013 11:46 PM, Sharma Bhupesh-B45370 wrote:
[Re-posting as original msg was rejected due to HTML content..]
FengHua fenghua@phytium.com.cn writes:
>> FengHua fenghua@phytium.com.cn writes: >> >>> hi tom, hi albert, yes, it's right. the u-boot could >>> be more uniformly and maintainable if merging armv8 >>> to arm architecture. I will try to migrate arm64 to >>> armv8 subarchitecture of arm. do you have any other >>> advice? >> >> Why? The architectures are vastly different, arm64 >> (aarch64) being only loosely inspired by the 32-bit >> arm. It is not like with x86/amd64 where a lot of code >> can be shared. > > Of course, with a seperated architecture the arm64 code > will be clear and simple. when it merged with arm a few > file should be duplicated with the name "_v8" appended > and many macro switch should be added. but most of the > code will be in armv8 directory which paralleled with > armv7. it seems that this implementation are more nice.
ARMv8 defines both a 32-bit (aarch32) and a 64-bit (aarch64) instruction set. The naming you are suggesting would be misleading.
aarch32 state is compatible with armv7. armv8 directory only provide aarch64 state support. as you said, it would be a little misleading.
ARMv8 ARM (Architecture Reference Manual) mentions that the ARMv8 architecture has support for both AArch32 and AArch64 and the ARM can switch b/w the two instruction sets via exceptions.
So, whether choosing a naming convention similar to linux (arch/arm64) would be more suitable is something to consider (even though some of the files might be a copy of what is available in arch/arm/cpu/armv7)?
I think we'll see what happens with a single directory first. We aren't talking about a binary that has to work on all cases (right now...)
A single binary can obviously never work.
and we want to avoid massive duplication of all of the C code that really won't change.
If there's a lot of code shared between these architectures, why is it in an architecture-specific directory in the first place? Maybe the proper solution is to move it out of arch/arm rather than moving code for an entirely different architecture in there.
We are working in that direction (and one of the requests was to hook into that code, rather than duplicate things). Think of it as "all ARM Ltd licensed cores" not "all 32bit-only ARM cores".
Why does it matter which company designed it? By that reasoning, you'd put i960 (were it supported) under arch/x86 because it's from Intel.

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 08/19/2013 09:01 AM, Måns Rullgård wrote:
Tom Rini trini@ti.com writes:
On 08/19/2013 08:32 AM, Måns Rullgård wrote:
Tom Rini trini@ti.com writes:
On 08/18/2013 11:46 PM, Sharma Bhupesh-B45370 wrote:
[Re-posting as original msg was rejected due to HTML content..]
> FengHua fenghua@phytium.com.cn writes: > >>> FengHua fenghua@phytium.com.cn writes: >>> >>>> hi tom, hi albert, yes, it's right. the u-boot >>>> could be more uniformly and maintainable if >>>> merging armv8 to arm architecture. I will try to >>>> migrate arm64 to armv8 subarchitecture of arm. do >>>> you have any other advice? >>> >>> Why? The architectures are vastly different, >>> arm64 (aarch64) being only loosely inspired by the >>> 32-bit arm. It is not like with x86/amd64 where a >>> lot of code can be shared. >> >> Of course, with a seperated architecture the arm64 >> code will be clear and simple. when it merged with >> arm a few file should be duplicated with the name >> "_v8" appended and many macro switch should be added. >> but most of the code will be in armv8 directory which >> paralleled with armv7. it seems that this >> implementation are more nice. > > ARMv8 defines both a 32-bit (aarch32) and a 64-bit > (aarch64) instruction set. The naming you are > suggesting would be misleading. >
aarch32 state is compatible with armv7. armv8 directory only provide aarch64 state support. as you said, it would be a little misleading.
ARMv8 ARM (Architecture Reference Manual) mentions that the ARMv8 architecture has support for both AArch32 and AArch64 and the ARM can switch b/w the two instruction sets via exceptions.
So, whether choosing a naming convention similar to linux (arch/arm64) would be more suitable is something to consider (even though some of the files might be a copy of what is available in arch/arm/cpu/armv7)?
I think we'll see what happens with a single directory first. We aren't talking about a binary that has to work on all cases (right now...)
A single binary can obviously never work.
and we want to avoid massive duplication of all of the C code that really won't change.
If there's a lot of code shared between these architectures, why is it in an architecture-specific directory in the first place? Maybe the proper solution is to move it out of arch/arm rather than moving code for an entirely different architecture in there.
We are working in that direction (and one of the requests was to hook into that code, rather than duplicate things). Think of it as "all ARM Ltd licensed cores" not "all 32bit-only ARM cores".
Why does it matter which company designed it? By that reasoning, you'd put i960 (were it supported) under arch/x86 because it's from Intel.
Probably because I didn't get the "it's a whole new unrelated to everything before world over there!" memo. Seriously tho, our directory structure is different from the kernel and it seems like things might look cleaner this way. If it doesn't, well, I'll admit to being wrong and we'll go back to a split arch directory.
- -- Tom

On Mon, 2013-08-19 at 09:10 -0400, Tom Rini wrote:
On 08/19/2013 09:01 AM, Måns Rullgård wrote:
Tom Rini trini@ti.com writes:
On 08/19/2013 08:32 AM, Måns Rullgård wrote:
If there's a lot of code shared between these architectures, why is it in an architecture-specific directory in the first place? Maybe the proper solution is to move it out of arch/arm rather than moving code for an entirely different architecture in there.
We are working in that direction (and one of the requests was to hook into that code, rather than duplicate things). Think of it as "all ARM Ltd licensed cores" not "all 32bit-only ARM cores".
Why does it matter which company designed it? By that reasoning, you'd put i960 (were it supported) under arch/x86 because it's from Intel.
Probably because I didn't get the "it's a whole new unrelated to everything before world over there!" memo.
Probably because there is still quite a bit of similarity to older ARM. There's more to it than just the ISA, and even that isn't *that* much more different than x86 versus x86_64. i960 is a bad analogy. It's often possible to turn arm32 asm into arm64 asm with some search and replace and minor manual fixups.
Seriously tho, our directory structure is different from the kernel and it seems like things might look cleaner this way. If it doesn't, well, I'll admit to being wrong and we'll go back to a split arch directory.
As I noted before, in Linux a bunch of other architectures started with a separate arch for 64-bit (x86, sparc, ppc...), and all of them eventually merged.
-Scott

Scott Wood scottwood@freescale.com writes:
On Mon, 2013-08-19 at 09:10 -0400, Tom Rini wrote:
On 08/19/2013 09:01 AM, Måns Rullgård wrote:
Tom Rini trini@ti.com writes:
On 08/19/2013 08:32 AM, Måns Rullgård wrote:
If there's a lot of code shared between these architectures, why is it in an architecture-specific directory in the first place? Maybe the proper solution is to move it out of arch/arm rather than moving code for an entirely different architecture in there.
We are working in that direction (and one of the requests was to hook into that code, rather than duplicate things). Think of it as "all ARM Ltd licensed cores" not "all 32bit-only ARM cores".
Why does it matter which company designed it? By that reasoning, you'd put i960 (were it supported) under arch/x86 because it's from Intel.
Probably because I didn't get the "it's a whole new unrelated to everything before world over there!" memo.
Probably because there is still quite a bit of similarity to older ARM. There's more to it than just the ISA, and even that isn't *that* much more different than x86 versus x86_64.
It is quite a bit more different. 32-bit x86 is a subset of x86_64 where as arm64 is entirely new, if somewhat inspired by 32-bit arm.
i960 is a bad analogy. It's often possible to turn arm32 asm into arm64 asm with some search and replace and minor manual fixups.
Only if the original uses none of the distinguishing features of ARM like predicated instructions or variably shifted operands. Once you limit yourself to the remaining basic operations, every (RISC) architecture looks the same.
Seriously tho, our directory structure is different from the kernel and it seems like things might look cleaner this way. If it doesn't, well, I'll admit to being wrong and we'll go back to a split arch directory.
As I noted before, in Linux a bunch of other architectures started with a separate arch for 64-bit (x86, sparc, ppc...), and all of them eventually merged.
In those cases, the 64-bitness is merely an extension to the 32-bit instruction set. Most of them don't even have a notion of 32-bit vs 64-bit mode of execution.
AArch64 of course shares certain non-ISA aspects with AArch32. Page table formats and other architecturally defined system control features are the same, and code for managing these things should of course be shared. Some other features, e.g. exception handling, are different enough that sharing code is probably difficult.
There is a tendency to see arm64/aarch64 as yet another 64-bit extension of a 32-bit architecture, which it is not. Assuming that software support will or can follow the model used by the others mentioned is thus a mistake.

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 08/19/2013 01:33 PM, Måns Rullgård wrote:
Scott Wood scottwood@freescale.com writes:
[snip]
i960 is a bad analogy. It's often possible to turn arm32 asm into arm64 asm with some search and replace and minor manual fixups.
Only if the original uses none of the distinguishing features of ARM like predicated instructions or variably shifted operands. Once you limit yourself to the remaining basic operations, every (RISC) architecture looks the same.
[snip]
AArch64 of course shares certain non-ISA aspects with AArch32. Page table formats and other architecturally defined system control features are the same, and code for managing these things should of course be shared. Some other features, e.g. exception handling, are different enough that sharing code is probably difficult.
There is a tendency to see arm64/aarch64 as yet another 64-bit extension of a 32-bit architecture, which it is not. Assuming that software support will or can follow the model used by the others mentioned is thus a mistake.
We don't have lots of hand-crafted assembly, and what we do, we largely have split out already into the cpu directories. I really think we just need to try this and see how it goes.
- -- Tom

Tom Rini trini@ti.com writes:
On 08/19/2013 01:33 PM, Måns Rullgård wrote:
Scott Wood scottwood@freescale.com writes:
[snip]
i960 is a bad analogy. It's often possible to turn arm32 asm into arm64 asm with some search and replace and minor manual fixups.
Only if the original uses none of the distinguishing features of ARM like predicated instructions or variably shifted operands. Once you limit yourself to the remaining basic operations, every (RISC) architecture looks the same.
[snip]
AArch64 of course shares certain non-ISA aspects with AArch32. Page table formats and other architecturally defined system control features are the same, and code for managing these things should of course be shared. Some other features, e.g. exception handling, are different enough that sharing code is probably difficult.
There is a tendency to see arm64/aarch64 as yet another 64-bit extension of a 32-bit architecture, which it is not. Assuming that software support will or can follow the model used by the others mentioned is thus a mistake.
We don't have lots of hand-crafted assembly, and what we do, we largely have split out already into the cpu directories. I really think we just need to try this and see how it goes.
Fine, let's see what it ends up looking like.
That said, please consider naming things in a way that armv8 does not imply 64-bit.

On Mon, Aug 19, 2013 at 08:50:24PM +0100, M?ns Rullg?rd wrote:
Tom Rini trini@ti.com writes:
On 08/19/2013 01:33 PM, M?ns Rullg?rd wrote:
Scott Wood scottwood@freescale.com writes:
[snip]
i960 is a bad analogy. It's often possible to turn arm32 asm into arm64 asm with some search and replace and minor manual fixups.
Only if the original uses none of the distinguishing features of ARM like predicated instructions or variably shifted operands. Once you limit yourself to the remaining basic operations, every (RISC) architecture looks the same.
[snip]
AArch64 of course shares certain non-ISA aspects with AArch32. Page table formats and other architecturally defined system control features are the same, and code for managing these things should of course be shared. Some other features, e.g. exception handling, are different enough that sharing code is probably difficult.
There is a tendency to see arm64/aarch64 as yet another 64-bit extension of a 32-bit architecture, which it is not. Assuming that software support will or can follow the model used by the others mentioned is thus a mistake.
We don't have lots of hand-crafted assembly, and what we do, we largely have split out already into the cpu directories. I really think we just need to try this and see how it goes.
Fine, let's see what it ends up looking like.
That said, please consider naming things in a way that armv8 does not imply 64-bit.
Agreed, thanks!

On Mon, 2013-08-19 at 18:33 +0100, Måns Rullgård wrote:
Scott Wood scottwood@freescale.com writes:
On Mon, 2013-08-19 at 09:10 -0400, Tom Rini wrote:
On 08/19/2013 09:01 AM, Måns Rullgård wrote:
Tom Rini trini@ti.com writes:
On 08/19/2013 08:32 AM, Måns Rullgård wrote:
If there's a lot of code shared between these architectures, why is it in an architecture-specific directory in the first place? Maybe the proper solution is to move it out of arch/arm rather than moving code for an entirely different architecture in there.
We are working in that direction (and one of the requests was to hook into that code, rather than duplicate things). Think of it as "all ARM Ltd licensed cores" not "all 32bit-only ARM cores".
Why does it matter which company designed it? By that reasoning, you'd put i960 (were it supported) under arch/x86 because it's from Intel.
Probably because I didn't get the "it's a whole new unrelated to everything before world over there!" memo.
Probably because there is still quite a bit of similarity to older ARM. There's more to it than just the ISA, and even that isn't *that* much more different than x86 versus x86_64.
It is quite a bit more different. 32-bit x86 is a subset of x86_64
It is not completely a subset. Various segmentation features, some obscure instructions, vm86 mode, etc. were dropped.
where as arm64 is entirely new, if somewhat inspired by 32-bit arm.
It appears heavily inspired to me.
i960 is a bad analogy. It's often possible to turn arm32 asm into arm64 asm with some search and replace and minor manual fixups.
Only if the original uses none of the distinguishing features of ARM like predicated instructions or variably shifted operands.
I'm referring specifically to the experience we had in doing this for arm64 asm code in U-Boot, which uses these infrequently enough that it falls under "minor manual fixups".
Once you limit yourself to the remaining basic operations, every (RISC) architecture looks the same.
Some are more "the same" than others. :-P
Converting to sparc, ppc, or mips code would have been much more of a manual process.
In any case, just how similar the asm is isn't really relevant - they're different enough that we'd keep the 64-bit asm in separate files (this is true of x86/x86-64 as well).
Seriously tho, our directory structure is different from the kernel and it seems like things might look cleaner this way. If it doesn't, well, I'll admit to being wrong and we'll go back to a split arch directory.
As I noted before, in Linux a bunch of other architectures started with a separate arch for 64-bit (x86, sparc, ppc...), and all of them eventually merged.
In those cases, the 64-bitness is merely an extension to the 32-bit instruction set. Most of them don't even have a notion of 32-bit vs 64-bit mode of execution.
AArch64 of course shares certain non-ISA aspects with AArch32. Page table formats and other architecturally defined system control features are the same, and code for managing these things should of course be shared. Some other features, e.g. exception handling, are different enough that sharing code is probably difficult.
In the patches posted so far nothing is shared. Using the same arch directory will lead to these things being shared by default, and we only need to fix up the places where things differ. If some day we manage to move enough stuff out of arch that it's really mostly just asm code, with things like page table handling moved out to a place that is easily shared between arches, then it might make sense to split. We're a long way from that, though.
-Scott
participants (3)
-
Måns Rullgård
-
Scott Wood
-
Tom Rini