zynq: Use arch_cpu_init() instead of lowlevel_init()
Subsystems (2)
PATCH 1/1 zynq: Use arch_cpu_init() instead of lowlevel_init()
Zynq lowlevel_init() was implemented in C but stack pointer is setup after function call in _main(). Move architecture setup to arch_cpu_init() which is call as the first function in board_init_f() which already have correct stack pointer.
---
I can't see any problem to call zynq setup a little bit later. There is already expectation that u-boot runs from DDR.
Moving lowlevel_init from C to ASM is possible but I will have to introduce new macros with hardcoded values. Using structures is much nicer.
--- arch/arm/cpu/armv7/zynq/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/cpu/armv7/zynq/cpu.c +6 -0
@@ -11,6 +11,10 @@void lowlevel_init (void ) { +} + +int arch_cpu_init (void ) +{zynq_slcr_unlock ();/* remap DDR to zero, FILTERSTART */ writel (0 , &scu_base->filter_start);
@@ -31,6 +35,8 @@ void lowlevel_init(void)writel (0xC , &slcr_base->ddr_urgent);zynq_slcr_lock (); + +return 0 ; }void reset_cpu (ulong addr)
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130822/ee64ce22/attachment.pgp>
PATCH 1/1 zynq: Use arch_cpu_init() instead of lowlevel_init()
Hi Michal,
Quoted 25 lines · Michal Simek
Zynq
lowlevel_init()was implemented in C but stack pointer is setup after function call in_main(). Move architecture setup toarch_cpu_init()which is call as the first function inboard_init_f()which already have correct stack pointer.Reported-by Sven Schwermer <[email protected]>Signed-off-by Michal Simek <[email protected]>---
I can't see any problem to call zynq setup a little bit later. There is already expectation that u-boot runs from DDR.
Movinglowlevel_initfrom C to ASM is possible but I will have to introduce new macros with hardcoded values. Using structures is much nicer.--- arch/arm/cpu/armv7/zynq/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm/cpu/armv7/zynq/cpu.c +0
-0
arch/arm/cpu/armv7/zynq/cpu.c line 14
Quoted 4 lines
arch/arm/cpu/armv7/zynq/cpu.c +1
-0@@ -11,6 +11,10 @@void lowlevel_init (void ) { +}
I'd rather you deleted lowlevel_init() as a C function with this name should not exist.
Quoted 15 lines
arch/arm/cpu/armv7/zynq/cpu.c +4
-1+int arch_cpu_init (void ) +{zynq_slcr_unlock ();/* remap DDR to zero, FILTERSTART */ writel (0 , &scu_base->filter_start);@@ -31,6 +35,8 @@ void lowlevel_init(void)writel (0xC , &slcr_base->ddr_urgent);zynq_slcr_lock (); + +return 0 ; }void reset_cpu (ulong addr) --
Quoted 1 line
1.8.2.3
Amicalement,
Signature · 1 line
Albert.
PATCH 1/1 zynq: Use arch_cpu_init() instead of lowlevel_init()
Quoted 31 lines · Albert ARIBAUD
Hi Michal,
Quoted 26 lines · Michal Simek
Zynq
lowlevel_init()was implemented in C but stack pointer is setup after function call in_main(). Move architecture setup toarch_cpu_init()which is call as the first function inboard_init_f()which already have correct stack pointer.Reported-by Sven Schwermer <[email protected]>Signed-off-by Michal Simek <[email protected]>---
I can't see any problem to call zynq setup a little bit later. There is already expectation that u-boot runs from DDR.
Movinglowlevel_initfrom C to ASM is possible but I will have to introduce new macros with hardcoded values. Using structures is much nicer.--- arch/arm/cpu/armv7/zynq/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm/cpu/armv7/zynq/cpu.c +0
-0@@ -11,6 +11,10 @@
Quoted 6 lines
arch/arm/cpu/armv7/zynq/cpu.c line 14
Quoted 3 lines
arch/arm/cpu/armv7/zynq/cpu.c +1
-0void lowlevel_init (void ) { +}I'd rather you deleted
lowlevel_init()as a C function with this name should not exist.
Ok. Do you want me to create almost empty low_level.S or just use arch/arm/cpu/arvm7/lowlevel_init.S and define empty s_init()?
Thanks,
Michal
Signature · 14 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 263 bytes Desc: OpenPGP digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130923/2f3e0ad4/attachment.pgp>
PATCH 1/1 zynq: Use arch_cpu_init() instead of lowlevel_init()
Hi Michal,
Quoted 39 lines · Michal Simek
Quoted 31 lines · Albert ARIBAUD
Hi Michal,
Quoted 26 lines · Michal Simek
Zynq
lowlevel_init()was implemented in C but stack pointer is setup after function call in_main(). Move architecture setup toarch_cpu_init()which is call as the first function inboard_init_f()which already have correct stack pointer.Reported-by Sven Schwermer <[email protected]>Signed-off-by Michal Simek <[email protected]>---
I can't see any problem to call zynq setup a little bit later. There is already expectation that u-boot runs from DDR.
Movinglowlevel_initfrom C to ASM is possible but I will have to introduce new macros with hardcoded values. Using structures is much nicer.--- arch/arm/cpu/armv7/zynq/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm/cpu/armv7/zynq/cpu.c +0
-0@@ -11,6 +11,10 @@Quoted 6 lines
arch/arm/cpu/armv7/zynq/cpu.c line 14
Quoted 3 lines
arch/arm/cpu/armv7/zynq/cpu.c +1
-0void lowlevel_init (void ) { +}I'd rather you deleted
lowlevel_init()as a C function with this name should not exist.
Quoted 2 lines
Ok. Do you want me to create almost empty
low_level.Sor just usearch/arm/cpu/arvm7/lowlevel_init.Sand define emptys_init()?
Urgh. I realize removing the C function would give you more work than simply keeping it empty until the whole s_init() mess is cleaned up. :(
I'll take your change as-is, sorry for the noise.
Quoted 2 lines
Thanks,
Michal
Amicalement,
Signature · 1 line
Albert.
PATCH 1/1 zynq: Use arch_cpu_init() instead of lowlevel_init()
Quoted 44 lines · Albert ARIBAUD
Hi Michal,
Quoted 39 lines · Michal Simek
Quoted 37 lines · Albert ARIBAUD
Hi Michal,
Quoted 25 lines · Michal Simek
Zynq
lowlevel_init()was implemented in C but stack pointer is setup after function call in_main(). Move architecture setup toarch_cpu_init()which is call as the first function inboard_init_f()which already have correct stack pointer.Reported-by Sven Schwermer <[email protected]>Signed-off-by Michal Simek <[email protected]>---
I can't see any problem to call zynq setup a little bit later. There is already expectation that u-boot runs from DDR.
Movinglowlevel_initfrom C to ASM is possible but I will have to introduce new macros with hardcoded values. Using structures is much nicer.--- arch/arm/cpu/armv7/zynq/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm/cpu/armv7/zynq/cpu.c +0
-0arch/arm/cpu/armv7/zynq/cpu.c line 14
Quoted 4 lines
arch/arm/cpu/armv7/zynq/cpu.c +1
-0@@ -11,6 +11,10 @@void lowlevel_init (void ) { +}I'd rather you deleted
lowlevel_init()as a C function with this name should not exist.
Quoted 7 lines
Quoted 2 lines
Ok. Do you want me to create almost empty
low_level.Sor just usearch/arm/cpu/arvm7/lowlevel_init.Sand define emptys_init()?Urgh. I realize removing the C function would give you more work than simply keeping it empty until the whole
s_init()mess is cleaned up. :(I'll take your change as-is, sorry for the noise.
No problem with that.
Thanks,
Michal
Signature · 14 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 263 bytes Desc: OpenPGP digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130923/464a9366/attachment.pgp>
PATCH 1/1 zynq: Use arch_cpu_init() instead of lowlevel_init()
In reply to Albert ARIBAUDHi Albert,
Quoted 44 lines · Albert ARIBAUD
Hi Michal,
Quoted 39 lines · Michal Simek
Quoted 37 lines · Albert ARIBAUD
Hi Michal,
Quoted 25 lines · Michal Simek
Zynq
lowlevel_init()was implemented in C but stack pointer is setup after function call in_main(). Move architecture setup toarch_cpu_init()which is call as the first function inboard_init_f()which already have correct stack pointer.Reported-by Sven Schwermer <[email protected]>Signed-off-by Michal Simek <[email protected]>---
I can't see any problem to call zynq setup a little bit later. There is already expectation that u-boot runs from DDR.
Movinglowlevel_initfrom C to ASM is possible but I will have to introduce new macros with hardcoded values. Using structures is much nicer.--- arch/arm/cpu/armv7/zynq/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm/cpu/armv7/zynq/cpu.c +0
-0arch/arm/cpu/armv7/zynq/cpu.c line 14
Quoted 4 lines
arch/arm/cpu/armv7/zynq/cpu.c +1
-0@@ -11,6 +11,10 @@void lowlevel_init (void ) { +}I'd rather you deleted
lowlevel_init()as a C function with this name should not exist.
Quoted 7 lines
Quoted 2 lines
Ok. Do you want me to create almost empty
low_level.Sor just usearch/arm/cpu/arvm7/lowlevel_init.Sand define emptys_init()?Urgh. I realize removing the C function would give you more work than simply keeping it empty until the whole
s_init()mess is cleaned up. :(I'll take your change as-is, sorry for the noise.
In connection to this topic we have recently found one issue regarding to neon instruction which u-boot uses.
We have this code to enable them in asm and adding this to lowlevel_init.S is straight way how to do so.
mov r0, r0
mrc p15, 0, r1, c1, c0, 2
orr r1, r1, #(0xf << 20)
mcr p15, 0, r1, c1, c0, 2 fmrx r1, FPEXC
orr r1,r1, #(1<<30)
fmxr FPEXC, r1Is it ok to create zynq asm specific lowlevel function or doing this through s_init() or you have nice a clean way how this should be solved when you are saying that s_init() is mess.
Thanks,
Michal
Signature · 14 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 263 bytes Desc: OpenPGP digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130924/415330e8/attachment.pgp>
PATCH 1/1 zynq: Use arch_cpu_init() instead of lowlevel_init()
Hi Michal,
Quoted 65 lines · Michal Simek
Hi Albert,
Quoted 44 lines · Albert ARIBAUD
Hi Michal,
Quoted 39 lines · Michal Simek
Quoted 37 lines · Albert ARIBAUD
Hi Michal,
Quoted 25 lines · Michal Simek
Zynq
lowlevel_init()was implemented in C but stack pointer is setup after function call in_main(). Move architecture setup toarch_cpu_init()which is call as the first function inboard_init_f()which already have correct stack pointer.Reported-by Sven Schwermer <[email protected]>Signed-off-by Michal Simek <[email protected]>---
I can't see any problem to call zynq setup a little bit later. There is already expectation that u-boot runs from DDR.
Movinglowlevel_initfrom C to ASM is possible but I will have to introduce new macros with hardcoded values. Using structures is much nicer.--- arch/arm/cpu/armv7/zynq/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm/cpu/armv7/zynq/cpu.c +0
-0arch/arm/cpu/armv7/zynq/cpu.c line 14
Quoted 4 lines
arch/arm/cpu/armv7/zynq/cpu.c +1
-0@@ -11,6 +11,10 @@void lowlevel_init (void ) { +}I'd rather you deleted
lowlevel_init()as a C function with this name should not exist.Quoted 7 lines
Quoted 2 lines
Ok. Do you want me to create almost empty
low_level.Sor just usearch/arm/cpu/arvm7/lowlevel_init.Sand define emptys_init()?Urgh. I realize removing the C function would give you more work than simply keeping it empty until the whole
s_init()mess is cleaned up. :(I'll take your change as-is, sorry for the noise.
In connection to this topic we have recently found one issue regarding to neon instruction which u-boot uses.
We have this code to enable them in asm and adding this to
lowlevel_init.Sis straight way how to do so.mov r0, r0 mrc p15, 0, r1, c1, c0, 2 orr r1, r1, #(0xf << 20) mcr p15, 0, r1, c1, c0, 2
Quoted 7 lines
fmrx r1, FPEXC orr r1,r1, #(1<<30) fmxr FPEXC, r1Is it ok to create zynq asm specific lowlevel function or doing this through
s_init()or you have nice a clean way how this should be solved when you are saying thats_init()is mess.
Sorry for responding slowly.
I suspect when you say neon instruction that U-Boot uses, you mean neon instructions that GCC is allowed to emit while building U-Boot, right? So we're talking about neon insns in C code only, not asm, correct?
If this is correct, then does something prevent you from enabling neon instructions as early as possible, in e.g. the lowlevel_init routine?
Quoted 2 lines
Thanks,
Michal
Amicalement,
Signature · 1 line
Albert.
PATCH 1/1 zynq: Use arch_cpu_init() instead of lowlevel_init()
Quoted 74 lines · Albert ARIBAUD
Hi Michal,
Quoted 69 lines · Michal Simek
Hi Albert,
Quoted 44 lines · Albert ARIBAUD
Hi Michal,
Quoted 39 lines · Michal Simek
Quoted 37 lines · Albert ARIBAUD
Hi Michal,
Quoted 25 lines · Michal Simek
Zynq
lowlevel_init()was implemented in C but stack pointer is setup after function call in_main(). Move architecture setup toarch_cpu_init()which is call as the first function inboard_init_f()which already have correct stack pointer.Reported-by Sven Schwermer <[email protected]>Signed-off-by Michal Simek <[email protected]>---
I can't see any problem to call zynq setup a little bit later. There is already expectation that u-boot runs from DDR.
Movinglowlevel_initfrom C to ASM is possible but I will have to introduce new macros with hardcoded values. Using structures is much nicer.--- arch/arm/cpu/armv7/zynq/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm/cpu/armv7/zynq/cpu.c +0
-0arch/arm/cpu/armv7/zynq/cpu.c line 14
Quoted 4 lines
arch/arm/cpu/armv7/zynq/cpu.c +1
-0@@ -11,6 +11,10 @@void lowlevel_init (void ) { +}I'd rather you deleted
lowlevel_init()as a C function with this name should not exist.Quoted 7 lines
Quoted 2 lines
Ok. Do you want me to create almost empty
low_level.Sor just usearch/arm/cpu/arvm7/lowlevel_init.Sand define emptys_init()?Urgh. I realize removing the C function would give you more work than simply keeping it empty until the whole
s_init()mess is cleaned up. :(I'll take your change as-is, sorry for the noise.
In connection to this topic we have recently found one issue regarding to neon instruction which u-boot uses.
We have this code to enable them in asm and adding this to
lowlevel_init.Sis straight way how to do so.mov r0, r0 mrc p15, 0, r1, c1, c0, 2 orr r1, r1, #(0xf << 20) mcr p15, 0, r1, c1, c0, 2fmrx r1, FPEXC orr r1,r1, #(1<<30) fmxr FPEXC, r1
Quoted 8 lines
Quoted 3 lines
Is it ok to create zynq asm specific lowlevel function or doing this through
s_init()or you have nice a clean way how this should be solved when you are saying thats_init()is mess.Sorry for responding slowly.
I suspect when you say neon instruction that U-Boot uses, you mean neon instructions that GCC is allowed to emit while building U-Boot, right?
yes.
Quoted 1 line
So we're talking about neon insns in C code only, not asm, correct?
yes. gcc emits neon instruction in timer code. Not in asm.
Quoted 3 lines
If this is correct, then does something prevent you from enabling neon instructions as early as possible, in e.g. the
lowlevel_initroutine?
ok let me clear this. I think location of this code is clear. It is asm code and it will be called ASAP even
we know exactly which code emits neon instructions.
My point was if we should create specific lowlevel_init asm function and add this code there.
Or use arch/arm/cpu/armv7/lowlevel_init.S and create just s_init function.
You mentioned above that s_init() is a mess and needs to be clean up but you didn't mentioned how.
It means my point is if you tell us how should be clean up we can just submit code which is compatible with this cleanup activity.
Thanks,
Michal
Signature · 14 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 263 bytes Desc: OpenPGP digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131003/31ffc4bd/attachment.pgp>
PATCH 1/1 zynq: Use arch_cpu_init() instead of lowlevel_init()
Hi Michal,
Quoted 102 lines · Michal Simek
Quoted 74 lines · Albert ARIBAUD
Hi Michal,
Quoted 69 lines · Michal Simek
Hi Albert,
Quoted 44 lines · Albert ARIBAUD
Hi Michal,
Quoted 39 lines · Michal Simek
Quoted 37 lines · Albert ARIBAUD
Hi Michal,
Quoted 25 lines · Michal Simek
Zynq
lowlevel_init()was implemented in C but stack pointer is setup after function call in_main(). Move architecture setup toarch_cpu_init()which is call as the first function inboard_init_f()which already have correct stack pointer.Reported-by Sven Schwermer <[email protected]>Signed-off-by Michal Simek <[email protected]>---
I can't see any problem to call zynq setup a little bit later. There is already expectation that u-boot runs from DDR.
Movinglowlevel_initfrom C to ASM is possible but I will have to introduce new macros with hardcoded values. Using structures is much nicer.--- arch/arm/cpu/armv7/zynq/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm/cpu/armv7/zynq/cpu.c +0
-0arch/arm/cpu/armv7/zynq/cpu.c line 14
Quoted 4 lines
arch/arm/cpu/armv7/zynq/cpu.c +1
-0@@ -11,6 +11,10 @@void lowlevel_init (void ) { +}I'd rather you deleted
lowlevel_init()as a C function with this name should not exist.Quoted 7 lines
Quoted 2 lines
Ok. Do you want me to create almost empty
low_level.Sor just usearch/arm/cpu/arvm7/lowlevel_init.Sand define emptys_init()?Urgh. I realize removing the C function would give you more work than simply keeping it empty until the whole
s_init()mess is cleaned up. :(I'll take your change as-is, sorry for the noise.
In connection to this topic we have recently found one issue regarding to neon instruction which u-boot uses.
We have this code to enable them in asm and adding this to
lowlevel_init.Sis straight way how to do so.mov r0, r0 mrc p15, 0, r1, c1, c0, 2 orr r1, r1, #(0xf << 20) mcr p15, 0, r1, c1, c0, 2fmrx r1, FPEXC orr r1,r1, #(1<<30) fmxr FPEXC, r1Quoted 8 lines
Quoted 3 lines
Is it ok to create zynq asm specific lowlevel function or doing this through
s_init()or you have nice a clean way how this should be solved when you are saying thats_init()is mess.Sorry for responding slowly.
I suspect when you say neon instruction that U-Boot uses, you mean neon instructions that GCC is allowed to emit while building U-Boot, right?
yes.
Quoted 1 line
So we're talking about neon insns in C code only, not asm, correct?
yes. gcc emits neon instruction in timer code. Not in asm.
Quoted 3 lines
If this is correct, then does something prevent you from enabling neon instructions as early as possible, in e.g. the
lowlevel_initroutine?ok let me clear this. I think location of this code is clear. It is asm code and it will be called ASAP even
we know exactly which code emits neon instructions.
My point was if we should create specificlowlevel_initasm function and add this code there.
Or usearch/arm/cpu/armv7/lowlevel_init.Sand create justs_initfunction.
Quoted 5 lines
You mentioned above that
s_init()is a mess and needs to be clean up but you didn't mentioned how.It means my point is if you tell us how should be clean up we can just submit code which is compatible with this cleanup activity.
If I knew how to clean s_init() up, I'd have sent out patches already. :)
Anyway, I'm not sure that I see how s_init() and your need for a NEON enable sequence would be related: this sequence does not *need* to be in s_init().
Indeed, enabling NEON is, IMO, similar to enabling alignment checks or setting the CPU mode, so I guess it could find its way in start.S, inside a preprocessor conditional (since e.g. not all Cortex-A9 will support NEON).
BTW, where in U-Boot does GCC get instructed to emit NEON instructions at the moment? There is no -mfpu or -mfloat-abi option in the code base right now, so I suspect you're going to introduce it along with the enable sequence, correct?
Quoted 2 lines
Thanks,
Michal
Amicalement,
Signature · 1 line
Albert.
PATCH 1/1 zynq: Use arch_cpu_init() instead of lowlevel_init()
Hi Albert,
Quoted 107 lines · Albert ARIBAUD
Hi Michal,
Quoted 102 lines · Michal Simek
Quoted 74 lines · Albert ARIBAUD
Hi Michal,
Quoted 69 lines · Michal Simek
Hi Albert,
Quoted 44 lines · Albert ARIBAUD
Hi Michal,
Quoted 39 lines · Michal Simek
Quoted 37 lines · Albert ARIBAUD
Hi Michal,
Quoted 25 lines · Michal Simek
Zynq
lowlevel_init()was implemented in C but stack pointer is setup after function call in_main(). Move architecture setup toarch_cpu_init()which is call as the first function inboard_init_f()which already have correct stack pointer.Reported-by Sven Schwermer <[email protected]>Signed-off-by Michal Simek <[email protected]>---
I can't see any problem to call zynq setup a little bit later. There is already expectation that u-boot runs from DDR.
Movinglowlevel_initfrom C to ASM is possible but I will have to introduce new macros with hardcoded values. Using structures is much nicer.--- arch/arm/cpu/armv7/zynq/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm/cpu/armv7/zynq/cpu.c +0
-0arch/arm/cpu/armv7/zynq/cpu.c line 14
Quoted 4 lines
arch/arm/cpu/armv7/zynq/cpu.c +1
-0@@ -11,6 +11,10 @@void lowlevel_init (void ) { +}I'd rather you deleted
lowlevel_init()as a C function with this name should not exist.Quoted 7 lines
Quoted 2 lines
Ok. Do you want me to create almost empty
low_level.Sor just usearch/arm/cpu/arvm7/lowlevel_init.Sand define emptys_init()?Urgh. I realize removing the C function would give you more work than simply keeping it empty until the whole
s_init()mess is cleaned up. :(I'll take your change as-is, sorry for the noise.
In connection to this topic we have recently found one issue regarding to neon instruction which u-boot uses.
We have this code to enable them in asm and adding this to
lowlevel_init.Sis straight way how to do so.mov r0, r0 mrc p15, 0, r1, c1, c0, 2 orr r1, r1, #(0xf << 20) mcr p15, 0, r1, c1, c0, 2fmrx r1, FPEXC orr r1,r1, #(1<<30) fmxr FPEXC, r1Quoted 8 lines
Quoted 3 lines
Is it ok to create zynq asm specific lowlevel function or doing this through
s_init()or you have nice a clean way how this should be solved when you are saying thats_init()is mess.Sorry for responding slowly.
I suspect when you say neon instruction that U-Boot uses, you mean neon instructions that GCC is allowed to emit while building U-Boot, right?
yes.
Quoted 1 line
So we're talking about neon insns in C code only, not asm, correct?
yes. gcc emits neon instruction in timer code. Not in asm.
Quoted 3 lines
If this is correct, then does something prevent you from enabling neon instructions as early as possible, in e.g. the
lowlevel_initroutine?ok let me clear this. I think location of this code is clear. It is asm code and it will be called ASAP even
we know exactly which code emits neon instructions.
My point was if we should create specificlowlevel_initasm function and add this code there.
Or usearch/arm/cpu/armv7/lowlevel_init.Sand create justs_initfunction.
Quoted 8 lines
Quoted 5 lines
You mentioned above that
s_init()is a mess and needs to be clean up but you didn't mentioned how.It means my point is if you tell us how should be clean up we can just submit code which is compatible with this cleanup activity.
If I knew how to clean
s_init()up, I'd have sent out patches already. :)
Fair enough. :-)
Quoted 3 lines
Anyway, I'm not sure that I see how
s_init()and your need for a NEON enable sequence would be related: this sequence does not *need* to be ins_init().
ok. s_init is not asm function - but C function.
Quoted 4 lines
Indeed, enabling NEON is, IMO, similar to enabling alignment checks or setting the CPU mode, so I guess it could find its way in
start.S, inside a preprocessor conditional (since e.g. not all Cortex-A9 will support NEON).
ok. That sound good to me.
Quoted 4 lines
BTW, where in U-Boot does GCC get instructed to emit NEON instructions at the moment? There is no -mfpu or -mfloat-abi option in the code base right now, so I suspect you're going to introduce it along with the enable sequence, correct?
file: arch/arm/cpu/armv7/zynq/timer.c
fce: void __udelay(unsigned long usec)
line: countticks = (u32) (((unsigned long long) TIMER_TICK_HZ * usec) /
1000000);
This is what I have got from Edgar.
"A significant difference between the u-boot builds is that the failing one is using NEON instructions for some of the div/mod helpers. AFAIK, NEON instructions are disabled after reset and will cause undef exceptions if issued while disabled. "
That difference in builds which is mentioned above is when this patch is applied.
arch/arm/cpu/armv7/zynq/timer.c +3 -2
@@ -119,12 +119,13 @@ void __udelay(unsigned long usec)u32 timeend;u32 timediff;u32 timenow; +u64 temp;if (usec ==0 )return ; - countticks = (u32) (((unsigned long long )TIMER_TICK_HZ * usec) / -1000000 ); + temp = (TIMER_TICK_HZ * usec)/1000000 ; + countticks = (u32 )temp;/* decrementing timer */ timeend =readl (&timer_base->counter) - countticks;
We haven't seen any problem in normal flow because NEON instructions are enabled in the fsbl(first stage bootloader) that's why we didn't see any problem with original code.
Thanks,
Michal
PATCH 1/1 zynq: Use arch_cpu_init() instead of lowlevel_init()
Hi Michal,
Quoted 177 lines · Michal Simek
Hi Albert,
Quoted 107 lines · Albert ARIBAUD
Hi Michal,
Quoted 102 lines · Michal Simek
Quoted 74 lines · Albert ARIBAUD
Hi Michal,
Quoted 69 lines · Michal Simek
Hi Albert,
Quoted 44 lines · Albert ARIBAUD
Hi Michal,
Quoted 39 lines · Michal Simek
Quoted 37 lines · Albert ARIBAUD
Hi Michal,
Quoted 25 lines · Michal Simek
Zynq
lowlevel_init()was implemented in C but stack pointer is setup after function call in_main(). Move architecture setup toarch_cpu_init()which is call as the first function inboard_init_f()which already have correct stack pointer.Reported-by Sven Schwermer <[email protected]>Signed-off-by Michal Simek <[email protected]>---
I can't see any problem to call zynq setup a little bit later. There is already expectation that u-boot runs from DDR.
Movinglowlevel_initfrom C to ASM is possible but I will have to introduce new macros with hardcoded values. Using structures is much nicer.--- arch/arm/cpu/armv7/zynq/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm/cpu/armv7/zynq/cpu.c +0
-0arch/arm/cpu/armv7/zynq/cpu.c line 14
Quoted 4 lines
arch/arm/cpu/armv7/zynq/cpu.c +1
-0@@ -11,6 +11,10 @@void lowlevel_init (void ) { +}I'd rather you deleted
lowlevel_init()as a C function with this name should not exist.Quoted 7 lines
Quoted 2 lines
Ok. Do you want me to create almost empty
low_level.Sor just usearch/arm/cpu/arvm7/lowlevel_init.Sand define emptys_init()?Urgh. I realize removing the C function would give you more work than simply keeping it empty until the whole
s_init()mess is cleaned up. :(I'll take your change as-is, sorry for the noise.
In connection to this topic we have recently found one issue regarding to neon instruction which u-boot uses.
We have this code to enable them in asm and adding this to
lowlevel_init.Sis straight way how to do so.mov r0, r0 mrc p15, 0, r1, c1, c0, 2 orr r1, r1, #(0xf << 20) mcr p15, 0, r1, c1, c0, 2fmrx r1, FPEXC orr r1,r1, #(1<<30) fmxr FPEXC, r1Quoted 8 lines
Quoted 3 lines
Is it ok to create zynq asm specific lowlevel function or doing this through
s_init()or you have nice a clean way how this should be solved when you are saying thats_init()is mess.Sorry for responding slowly.
I suspect when you say neon instruction that U-Boot uses, you mean neon instructions that GCC is allowed to emit while building U-Boot, right?
yes.
Quoted 1 line
So we're talking about neon insns in C code only, not asm, correct?
yes. gcc emits neon instruction in timer code. Not in asm.
Quoted 3 lines
If this is correct, then does something prevent you from enabling neon instructions as early as possible, in e.g. the
lowlevel_initroutine?ok let me clear this. I think location of this code is clear. It is asm code and it will be called ASAP even
we know exactly which code emits neon instructions.
My point was if we should create specificlowlevel_initasm function and add this code there.
Or usearch/arm/cpu/armv7/lowlevel_init.Sand create justs_initfunction.Quoted 8 lines
Quoted 5 lines
You mentioned above that
s_init()is a mess and needs to be clean up but you didn't mentioned how.It means my point is if you tell us how should be clean up we can just submit code which is compatible with this cleanup activity.
If I knew how to clean
s_init()up, I'd have sent out patches already. :)Fair enough. :-)
Quoted 3 lines
Anyway, I'm not sure that I see how
s_init()and your need for a NEON enable sequence would be related: this sequence does not *need* to be ins_init().ok.
s_initis not asm function - but C function.Quoted 4 lines
Indeed, enabling NEON is, IMO, similar to enabling alignment checks or setting the CPU mode, so I guess it could find its way in
start.S, inside a preprocessor conditional (since e.g. not all Cortex-A9 will support NEON).ok. That sound good to me.
Quoted 4 lines
BTW, where in U-Boot does GCC get instructed to emit NEON instructions at the moment? There is no -mfpu or -mfloat-abi option in the code base right now, so I suspect you're going to introduce it along with the enable sequence, correct?
file:
arch/arm/cpu/armv7/zynq/timer.c
fce: void__udelay(unsigned long usec)
line: countticks = (u32) (((unsigned long long)TIMER_TICK_HZ* usec) /1000000);This is what I have got from Edgar.
"A significant difference between the u-boot builds is that the failing one is using NEON instructions for some of the div/mod helpers. AFAIK, NEON instructions are disabled after reset and will cause undef exceptions if issued while disabled. "
That difference in builds which is mentioned above is when this patch is applied.
arch/arm/cpu/armv7/zynq/timer.c +3
-2@@ -119,12 +119,13 @@ void __udelay(unsigned long usec)u32 timeend;u32 timediff;u32 timenow; +u64 temp;if (usec ==0 )return ; - countticks = (u32) (((unsigned long long )TIMER_TICK_HZ * usec) / -1000000 ); + temp = (TIMER_TICK_HZ * usec)/1000000 ; + countticks = (u32 )temp;/* decrementing timer */ timeend =readl (&timer_base->counter) - countticks;
Quoted 3 lines
We haven't seen any problem in normal flow because NEON instructions are enabled in the fsbl(first stage bootloader) that's why we didn't see any problem with original code.
My question is not "which part of the U-Boot C source code causes issues because it is emitted with NEON instructions in it", but "which part of the U-Boot makefile system tells GCC that it can emit NEON instruction at all".
IOW, the current makefiles contain no -mfpu=neon* or -mfloat-abi=*. I see GCC has an option called -mneon-for-64bits, but the doc says it is disabled by default, and we don't enable it.
So where does GCC find in U-Boot that it is allowed to emit NEON insns in the first place?
Quoted 2 lines
Thanks,
Michal
Amicalement,
Signature · 1 line
Albert.
PATCH 1/1 zynq: Use arch_cpu_init() instead of lowlevel_init()
Hi Albert,
Quoted 191 lines · Albert ARIBAUD
Hi Michal,
Quoted 177 lines · Michal Simek
Hi Albert,
Quoted 107 lines · Albert ARIBAUD
Hi Michal,
Quoted 102 lines · Michal Simek
Quoted 74 lines · Albert ARIBAUD
Hi Michal,
Quoted 69 lines · Michal Simek
Hi Albert,
Quoted 44 lines · Albert ARIBAUD
Hi Michal,
Quoted 39 lines · Michal Simek
Quoted 37 lines · Albert ARIBAUD
Hi Michal,
Quoted 25 lines · Michal Simek
Zynq
lowlevel_init()was implemented in C but stack pointer is setup after function call in_main(). Move architecture setup toarch_cpu_init()which is call as the first function inboard_init_f()which already have correct stack pointer.Reported-by Sven Schwermer <[email protected]>Signed-off-by Michal Simek <[email protected]>---
I can't see any problem to call zynq setup a little bit later. There is already expectation that u-boot runs from DDR.
Movinglowlevel_initfrom C to ASM is possible but I will have to introduce new macros with hardcoded values. Using structures is much nicer.--- arch/arm/cpu/armv7/zynq/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm/cpu/armv7/zynq/cpu.c +0
-0arch/arm/cpu/armv7/zynq/cpu.c line 14
Quoted 4 lines
arch/arm/cpu/armv7/zynq/cpu.c +1
-0@@ -11,6 +11,10 @@void lowlevel_init (void ) { +}I'd rather you deleted
lowlevel_init()as a C function with this name should not exist.Quoted 7 lines
Quoted 2 lines
Ok. Do you want me to create almost empty
low_level.Sor just usearch/arm/cpu/arvm7/lowlevel_init.Sand define emptys_init()?Urgh. I realize removing the C function would give you more work than simply keeping it empty until the whole
s_init()mess is cleaned up. :(I'll take your change as-is, sorry for the noise.
In connection to this topic we have recently found one issue regarding to neon instruction which u-boot uses.
We have this code to enable them in asm and adding this to
lowlevel_init.Sis straight way how to do so.mov r0, r0 mrc p15, 0, r1, c1, c0, 2 orr r1, r1, #(0xf << 20) mcr p15, 0, r1, c1, c0, 2fmrx r1, FPEXC orr r1,r1, #(1<<30) fmxr FPEXC, r1Quoted 8 lines
Quoted 3 lines
Is it ok to create zynq asm specific lowlevel function or doing this through
s_init()or you have nice a clean way how this should be solved when you are saying thats_init()is mess.Sorry for responding slowly.
I suspect when you say neon instruction that U-Boot uses, you mean neon instructions that GCC is allowed to emit while building U-Boot, right?
yes.
Quoted 1 line
So we're talking about neon insns in C code only, not asm, correct?
yes. gcc emits neon instruction in timer code. Not in asm.
Quoted 3 lines
If this is correct, then does something prevent you from enabling neon instructions as early as possible, in e.g. the
lowlevel_initroutine?ok let me clear this. I think location of this code is clear. It is asm code and it will be called ASAP even
we know exactly which code emits neon instructions.
My point was if we should create specificlowlevel_initasm function and add this code there.
Or usearch/arm/cpu/armv7/lowlevel_init.Sand create justs_initfunction.Quoted 8 lines
Quoted 5 lines
You mentioned above that
s_init()is a mess and needs to be clean up but you didn't mentioned how.It means my point is if you tell us how should be clean up we can just submit code which is compatible with this cleanup activity.
If I knew how to clean
s_init()up, I'd have sent out patches already. :)Fair enough. :-)
Quoted 3 lines
Anyway, I'm not sure that I see how
s_init()and your need for a NEON enable sequence would be related: this sequence does not *need* to be ins_init().ok.
s_initis not asm function - but C function.Quoted 4 lines
Indeed, enabling NEON is, IMO, similar to enabling alignment checks or setting the CPU mode, so I guess it could find its way in
start.S, inside a preprocessor conditional (since e.g. not all Cortex-A9 will support NEON).ok. That sound good to me.
Quoted 4 lines
BTW, where in U-Boot does GCC get instructed to emit NEON instructions at the moment? There is no -mfpu or -mfloat-abi option in the code base right now, so I suspect you're going to introduce it along with the enable sequence, correct?
file:
arch/arm/cpu/armv7/zynq/timer.c
fce: void__udelay(unsigned long usec)
line: countticks = (u32) (((unsigned long long)TIMER_TICK_HZ* usec) /1000000);This is what I have got from Edgar.
"A significant difference between the u-boot builds is that the failing one is using NEON instructions for some of the div/mod helpers. AFAIK, NEON instructions are disabled after reset and will cause undef exceptions if issued while disabled. "
That difference in builds which is mentioned above is when this patch is applied.
arch/arm/cpu/armv7/zynq/timer.c +3
-2@@ -119,12 +119,13 @@ void __udelay(unsigned long usec)u32 timeend;u32 timediff;u32 timenow; +u64 temp;if (usec ==0 )return ; - countticks = (u32) (((unsigned long long )TIMER_TICK_HZ * usec) / -1000000 ); + temp = (TIMER_TICK_HZ * usec)/1000000 ; + countticks = (u32 )temp;/* decrementing timer */ timeend =readl (&timer_base->counter) - countticks;Quoted 3 lines
We haven't seen any problem in normal flow because NEON instructions are enabled in the fsbl(first stage bootloader) that's why we didn't see any problem with original code.
My question is not "which part of the U-Boot C source code causes issues because it is emitted with NEON instructions in it", but "which part of the U-Boot makefile system tells GCC that it can emit NEON instruction at all".
Quoted 6 lines
IOW, the current makefiles contain no -mfpu=neon* or -mfloat-abi=*. I see GCC has an option called -mneon-for-64bits, but the doc says it is disabled by default, and we don't enable it.
So where does GCC find in U-Boot that it is allowed to emit NEON insns in the first place?
Ping
Quoted 4 lines
Quoted 2 lines
Thanks,
MichalAmicalement,
Amicalement,
Signature · 1 line
Albert.
PATCH 1/1 zynq: Use arch_cpu_init() instead of lowlevel_init()
Quoted 196 lines · Albert ARIBAUD
Hi Albert,
Quoted 191 lines · Albert ARIBAUD
Hi Michal,
Quoted 177 lines · Michal Simek
Hi Albert,
Quoted 107 lines · Albert ARIBAUD
Hi Michal,
Quoted 102 lines · Michal Simek
Quoted 74 lines · Albert ARIBAUD
Hi Michal,
Quoted 69 lines · Michal Simek
Hi Albert,
Quoted 44 lines · Albert ARIBAUD
Hi Michal,
Quoted 39 lines · Michal Simek
Quoted 37 lines · Albert ARIBAUD
Hi Michal,
Quoted 25 lines · Michal Simek
Zynq
lowlevel_init()was implemented in C but stack pointer is setup after function call in_main(). Move architecture setup toarch_cpu_init()which is call as the first function inboard_init_f()which already have correct stack pointer.Reported-by Sven Schwermer <[email protected]>Signed-off-by Michal Simek <[email protected]>---
I can't see any problem to call zynq setup a little bit later. There is already expectation that u-boot runs from DDR.
Movinglowlevel_initfrom C to ASM is possible but I will have to introduce new macros with hardcoded values. Using structures is much nicer.--- arch/arm/cpu/armv7/zynq/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm/cpu/armv7/zynq/cpu.c +0
-0arch/arm/cpu/armv7/zynq/cpu.c line 14
Quoted 4 lines
arch/arm/cpu/armv7/zynq/cpu.c +1
-0@@ -11,6 +11,10 @@void lowlevel_init (void ) { +}I'd rather you deleted
lowlevel_init()as a C function with this name should not exist.Quoted 7 lines
Quoted 2 lines
Ok. Do you want me to create almost empty
low_level.Sor just usearch/arm/cpu/arvm7/lowlevel_init.Sand define emptys_init()?Urgh. I realize removing the C function would give you more work than simply keeping it empty until the whole
s_init()mess is cleaned up. :(I'll take your change as-is, sorry for the noise.
In connection to this topic we have recently found one issue regarding to neon instruction which u-boot uses.
We have this code to enable them in asm and adding this to
lowlevel_init.Sis straight way how to do so.mov r0, r0 mrc p15, 0, r1, c1, c0, 2 orr r1, r1, #(0xf << 20) mcr p15, 0, r1, c1, c0, 2fmrx r1, FPEXC orr r1,r1, #(1<<30) fmxr FPEXC, r1Quoted 8 lines
Quoted 3 lines
Is it ok to create zynq asm specific lowlevel function or doing this through
s_init()or you have nice a clean way how this should be solved when you are saying thats_init()is mess.Sorry for responding slowly.
I suspect when you say neon instruction that U-Boot uses, you mean neon instructions that GCC is allowed to emit while building U-Boot, right?
yes.
Quoted 1 line
So we're talking about neon insns in C code only, not asm, correct?
yes. gcc emits neon instruction in timer code. Not in asm.
Quoted 3 lines
If this is correct, then does something prevent you from enabling neon instructions as early as possible, in e.g. the
lowlevel_initroutine?ok let me clear this. I think location of this code is clear. It is asm code and it will be called ASAP even
we know exactly which code emits neon instructions.
My point was if we should create specificlowlevel_initasm function and add this code there.
Or usearch/arm/cpu/armv7/lowlevel_init.Sand create justs_initfunction.Quoted 8 lines
Quoted 5 lines
You mentioned above that
s_init()is a mess and needs to be clean up but you didn't mentioned how.It means my point is if you tell us how should be clean up we can just submit code which is compatible with this cleanup activity.
If I knew how to clean
s_init()up, I'd have sent out patches already. :)Fair enough. :-)
Quoted 3 lines
Anyway, I'm not sure that I see how
s_init()and your need for a NEON enable sequence would be related: this sequence does not *need* to be ins_init().ok.
s_initis not asm function - but C function.Quoted 4 lines
Indeed, enabling NEON is, IMO, similar to enabling alignment checks or setting the CPU mode, so I guess it could find its way in
start.S, inside a preprocessor conditional (since e.g. not all Cortex-A9 will support NEON).ok. That sound good to me.
Quoted 4 lines
BTW, where in U-Boot does GCC get instructed to emit NEON instructions at the moment? There is no -mfpu or -mfloat-abi option in the code base right now, so I suspect you're going to introduce it along with the enable sequence, correct?
file:
arch/arm/cpu/armv7/zynq/timer.c
fce: void__udelay(unsigned long usec)
line: countticks = (u32) (((unsigned long long)TIMER_TICK_HZ* usec) /1000000);This is what I have got from Edgar.
"A significant difference between the u-boot builds is that the failing one is using NEON instructions for some of the div/mod helpers. AFAIK, NEON instructions are disabled after reset and will cause undef exceptions if issued while disabled. "
That difference in builds which is mentioned above is when this patch is applied.
arch/arm/cpu/armv7/zynq/timer.c +3
-2@@ -119,12 +119,13 @@ void __udelay(unsigned long usec)u32 timeend;u32 timediff;u32 timenow; +u64 temp;if (usec ==0 )return ; - countticks = (u32) (((unsigned long long )TIMER_TICK_HZ * usec) / -1000000 ); + temp = (TIMER_TICK_HZ * usec)/1000000 ; + countticks = (u32 )temp;/* decrementing timer */ timeend =readl (&timer_base->counter) - countticks;Quoted 3 lines
We haven't seen any problem in normal flow because NEON instructions are enabled in the fsbl(first stage bootloader) that's why we didn't see any problem with original code.
My question is not "which part of the U-Boot C source code causes issues because it is emitted with NEON instructions in it", but "which part of the U-Boot makefile system tells GCC that it can emit NEON instruction at all".
Quoted 8 lines
Quoted 6 lines
IOW, the current makefiles contain no -mfpu=neon* or -mfloat-abi=*. I see GCC has an option called -mneon-for-64bits, but the doc says it is disabled by default, and we don't enable it.
So where does GCC find in U-Boot that it is allowed to emit NEON insns in the first place?
Ping
Hi Albert,
I think the need to pass -mfpu and -mfloat flags to gcc depend on how the toolchain was configured. In the Zynq case, the toolchain is targeted at the setup of the cortex-a9 within the Zynq and pre-configured with these options enabled by default.
I dont see the -mneon-for-64bits option in our version, but I assume something equivalent is used.
Cheers,
Edgar
PATCH 1/1 zynq: Use arch_cpu_init() instead of lowlevel_init()
Hi Edgar,
Quoted 208 lines · Edgar E. Iglesias
Quoted 196 lines · Albert ARIBAUD
Hi Albert,
Quoted 191 lines · Albert ARIBAUD
Hi Michal,
Quoted 177 lines · Michal Simek
Hi Albert,
Quoted 107 lines · Albert ARIBAUD
Hi Michal,
Quoted 102 lines · Michal Simek
Quoted 74 lines · Albert ARIBAUD
Hi Michal,
Quoted 69 lines · Michal Simek
Hi Albert,
Quoted 44 lines · Albert ARIBAUD
Hi Michal,
Quoted 39 lines · Michal Simek
Quoted 37 lines · Albert ARIBAUD
Hi Michal,
Quoted 25 lines · Michal Simek
Zynq
lowlevel_init()was implemented in C but stack pointer is setup after function call in_main(). Move architecture setup toarch_cpu_init()which is call as the first function inboard_init_f()which already have correct stack pointer.Reported-by Sven Schwermer <[email protected]>Signed-off-by Michal Simek <[email protected]>---
I can't see any problem to call zynq setup a little bit later. There is already expectation that u-boot runs from DDR.
Movinglowlevel_initfrom C to ASM is possible but I will have to introduce new macros with hardcoded values. Using structures is much nicer.--- arch/arm/cpu/armv7/zynq/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm/cpu/armv7/zynq/cpu.c +0
-0arch/arm/cpu/armv7/zynq/cpu.c line 14
Quoted 4 lines
arch/arm/cpu/armv7/zynq/cpu.c +1
-0@@ -11,6 +11,10 @@void lowlevel_init (void ) { +}I'd rather you deleted
lowlevel_init()as a C function with this name should not exist.Quoted 7 lines
Quoted 2 lines
Ok. Do you want me to create almost empty
low_level.Sor just usearch/arm/cpu/arvm7/lowlevel_init.Sand define emptys_init()?Urgh. I realize removing the C function would give you more work than simply keeping it empty until the whole
s_init()mess is cleaned up. :(I'll take your change as-is, sorry for the noise.
In connection to this topic we have recently found one issue regarding to neon instruction which u-boot uses.
We have this code to enable them in asm and adding this to
lowlevel_init.Sis straight way how to do so.mov r0, r0 mrc p15, 0, r1, c1, c0, 2 orr r1, r1, #(0xf << 20) mcr p15, 0, r1, c1, c0, 2fmrx r1, FPEXC orr r1,r1, #(1<<30) fmxr FPEXC, r1Quoted 8 lines
Quoted 3 lines
Is it ok to create zynq asm specific lowlevel function or doing this through
s_init()or you have nice a clean way how this should be solved when you are saying thats_init()is mess.Sorry for responding slowly.
I suspect when you say neon instruction that U-Boot uses, you mean neon instructions that GCC is allowed to emit while building U-Boot, right?
yes.
Quoted 1 line
So we're talking about neon insns in C code only, not asm, correct?
yes. gcc emits neon instruction in timer code. Not in asm.
Quoted 3 lines
If this is correct, then does something prevent you from enabling neon instructions as early as possible, in e.g. the
lowlevel_initroutine?ok let me clear this. I think location of this code is clear. It is asm code and it will be called ASAP even
we know exactly which code emits neon instructions.
My point was if we should create specificlowlevel_initasm function and add this code there.
Or usearch/arm/cpu/armv7/lowlevel_init.Sand create justs_initfunction.Quoted 8 lines
Quoted 5 lines
You mentioned above that
s_init()is a mess and needs to be clean up but you didn't mentioned how.It means my point is if you tell us how should be clean up we can just submit code which is compatible with this cleanup activity.
If I knew how to clean
s_init()up, I'd have sent out patches already. :)Fair enough. :-)
Quoted 3 lines
Anyway, I'm not sure that I see how
s_init()and your need for a NEON enable sequence would be related: this sequence does not *need* to be ins_init().ok.
s_initis not asm function - but C function.Quoted 4 lines
Indeed, enabling NEON is, IMO, similar to enabling alignment checks or setting the CPU mode, so I guess it could find its way in
start.S, inside a preprocessor conditional (since e.g. not all Cortex-A9 will support NEON).ok. That sound good to me.
Quoted 4 lines
BTW, where in U-Boot does GCC get instructed to emit NEON instructions at the moment? There is no -mfpu or -mfloat-abi option in the code base right now, so I suspect you're going to introduce it along with the enable sequence, correct?
file:
arch/arm/cpu/armv7/zynq/timer.c
fce: void__udelay(unsigned long usec)
line: countticks = (u32) (((unsigned long long)TIMER_TICK_HZ* usec) /1000000);This is what I have got from Edgar.
"A significant difference between the u-boot builds is that the failing one is using NEON instructions for some of the div/mod helpers. AFAIK, NEON instructions are disabled after reset and will cause undef exceptions if issued while disabled. "
That difference in builds which is mentioned above is when this patch is applied.
arch/arm/cpu/armv7/zynq/timer.c +3
-2@@ -119,12 +119,13 @@ void __udelay(unsigned long usec)u32 timeend;u32 timediff;u32 timenow; +u64 temp;if (usec ==0 )return ; - countticks = (u32) (((unsigned long long )TIMER_TICK_HZ * usec) / -1000000 ); + temp = (TIMER_TICK_HZ * usec)/1000000 ; + countticks = (u32 )temp;/* decrementing timer */ timeend =readl (&timer_base->counter) - countticks;Quoted 3 lines
We haven't seen any problem in normal flow because NEON instructions are enabled in the fsbl(first stage bootloader) that's why we didn't see any problem with original code.
My question is not "which part of the U-Boot C source code causes issues because it is emitted with NEON instructions in it", but "which part of the U-Boot makefile system tells GCC that it can emit NEON instruction at all".
Quoted 8 lines
Quoted 6 lines
IOW, the current makefiles contain no -mfpu=neon* or -mfloat-abi=*. I see GCC has an option called -mneon-for-64bits, but the doc says it is disabled by default, and we don't enable it.
So where does GCC find in U-Boot that it is allowed to emit NEON insns in the first place?
Ping
Hi Albert,
Quoted 7 lines
I think the need to pass -mfpu and -mfloat flags to gcc depend on how the toolchain was configured. In the Zynq case, the toolchain is targeted at the setup of the cortex-a9 within the Zynq and pre-configured with these options enabled by default.
I dont see the -mneon-for-64bits option in our version, but I assume something equivalent is used.
Thanks for the clarification. This confirms my initial opinion that NEON can be enabled in start.S on a per-board basis, as it would workin all situations -- This is assuming that enabling NEON would have no adverse effect on builds which do not use it, of course.
Quoted 2 lines
Cheers,
Edgar
Amicalement,
Signature · 1 line
Albert.
PATCH 1/1 zynq: Use arch_cpu_init() instead of lowlevel_init()
Quoted 218 lines · Albert ARIBAUD
Hi Edgar,
Quoted 213 lines · Edgar E. Iglesias
Quoted 196 lines · Albert ARIBAUD
Hi Albert,
Quoted 191 lines · Albert ARIBAUD
Hi Michal,
Quoted 177 lines · Michal Simek
Hi Albert,
Quoted 107 lines · Albert ARIBAUD
Hi Michal,
Quoted 102 lines · Michal Simek
Quoted 74 lines · Albert ARIBAUD
Hi Michal,
Quoted 69 lines · Michal Simek
Hi Albert,
Quoted 44 lines · Albert ARIBAUD
Hi Michal,
Quoted 39 lines · Michal Simek
Quoted 37 lines · Albert ARIBAUD
Hi Michal,
Quoted 29 lines · Michal Simek
Zynq lowlevel_init() was implemented in C but stack
pointer is setup after function call in _main().
Move architecture setup to arch_cpu_init() which is call
as the first function in board_init_f() which
already have correct stack pointer.Reported-by: Sven Schwermer <[email protected]>
Signed-off-by: Michal Simek <[email protected]>
---
I can't see any problem to call zynq setup a little
bit later. There is already expectation that u-boot
runs from DDR.
Moving lowlevel_init from C to ASM is possible but
I will have to introduce new macros with hardcoded
values. Using structures is much nicer.---
arch/arm/cpu/armv7/zynq/cpu.c | 6 ++++++
1 file changed, 6 insertions(+)diff --git a/arch/arm/cpu/armv7/zynq/cpu.c b/arch/arm/cpu/armv7/zynq/cpu.c
index 4367d1a..8846f30 100644
--- a/arch/arm/cpu/armv7/zynq/cpu.c
+++ b/arch/arm/cpu/armv7/zynq/cpu.c
@@ -11,6 +11,10 @@void lowlevel_init(void)
{
+}I'd rather you deleted
lowlevel_init()as a C function with this name should not exist.Quoted 7 lines
Quoted 2 lines
Ok. Do you want me to create almost empty
low_level.Sor just usearch/arm/cpu/arvm7/lowlevel_init.Sand define emptys_init()?Urgh. I realize removing the C function would give you more work than simply keeping it empty until the whole
s_init()mess is cleaned up. :(I'll take your change as-is, sorry for the noise.
In connection to this topic we have recently found one issue regarding to neon instruction which u-boot uses.
We have this code to enable them in asm and adding this to
lowlevel_init.Sis straight way how to do so.mov r0, r0 mrc p15, 0, r1, c1, c0, 2 orr r1, r1, #(0xf << 20) mcr p15, 0, r1, c1, c0, 2fmrx r1, FPEXC orr r1,r1, #(1<<30) fmxr FPEXC, r1Quoted 8 lines
Quoted 3 lines
Is it ok to create zynq asm specific lowlevel function or doing this through
s_init()or you have nice a clean way how this should be solved when you are saying thats_init()is mess.Sorry for responding slowly.
I suspect when you say neon instruction that U-Boot uses, you mean neon instructions that GCC is allowed to emit while building U-Boot, right?
yes.
Quoted 1 line
So we're talking about neon insns in C code only, not asm, correct?
yes. gcc emits neon instruction in timer code. Not in asm.
Quoted 3 lines
If this is correct, then does something prevent you from enabling neon instructions as early as possible, in e.g. the
lowlevel_initroutine?ok let me clear this. I think location of this code is clear. It is asm code and it will be called ASAP even
we know exactly which code emits neon instructions.
My point was if we should create specificlowlevel_initasm function and add this code there.
Or usearch/arm/cpu/armv7/lowlevel_init.Sand create justs_initfunction.Quoted 8 lines
Quoted 5 lines
You mentioned above that
s_init()is a mess and needs to be clean up but you didn't mentioned how.It means my point is if you tell us how should be clean up we can just submit code which is compatible with this cleanup activity.
If I knew how to clean
s_init()up, I'd have sent out patches already. :)Fair enough. :-)
Quoted 3 lines
Anyway, I'm not sure that I see how
s_init()and your need for a NEON enable sequence would be related: this sequence does not *need* to be ins_init().ok.
s_initis not asm function - but C function.Quoted 4 lines
Indeed, enabling NEON is, IMO, similar to enabling alignment checks or setting the CPU mode, so I guess it could find its way in
start.S, inside a preprocessor conditional (since e.g. not all Cortex-A9 will support NEON).ok. That sound good to me.
Quoted 4 lines
BTW, where in U-Boot does GCC get instructed to emit NEON instructions at the moment? There is no -mfpu or -mfloat-abi option in the code base right now, so I suspect you're going to introduce it along with the enable sequence, correct?
file:
arch/arm/cpu/armv7/zynq/timer.c
fce: void__udelay(unsigned long usec)
line: countticks = (u32) (((unsigned long long)TIMER_TICK_HZ* usec) /1000000);This is what I have got from Edgar.
"A significant difference between the u-boot builds is that the failing one is using NEON instructions for some of the div/mod helpers. AFAIK, NEON instructions are disabled after reset and will cause undef exceptions if issued while disabled. "
That difference in builds which is mentioned above is when this patch is applied.
arch/arm/cpu/armv7/zynq/timer.c +3
-2@@ -119,12 +119,13 @@ void __udelay(unsigned long usec)u32 timeend;u32 timediff;u32 timenow; +u64 temp;if (usec ==0 )return ; - countticks = (u32) (((unsigned long long )TIMER_TICK_HZ * usec) / -1000000 ); + temp = (TIMER_TICK_HZ * usec)/1000000 ; + countticks = (u32 )temp;/* decrementing timer */ timeend =readl (&timer_base->counter) - countticks;Quoted 3 lines
We haven't seen any problem in normal flow because NEON instructions are enabled in the fsbl(first stage bootloader) that's why we didn't see any problem with original code.
My question is not "which part of the U-Boot C source code causes issues because it is emitted with NEON instructions in it", but "which part of the U-Boot makefile system tells GCC that it can emit NEON instruction at all".
Quoted 8 lines
Quoted 6 lines
IOW, the current makefiles contain no -mfpu=neon* or -mfloat-abi=*. I see GCC has an option called -mneon-for-64bits, but the doc says it is disabled by default, and we don't enable it.
So where does GCC find in U-Boot that it is allowed to emit NEON insns in the first place?
Ping
Hi Albert,
I think the need to pass -mfpu and -mfloat flags to gcc depend on how the toolchain was configured. In the Zynq case, the toolchain is targeted at the setup of the cortex-a9 within the Zynq and pre-configured with these options enabled by default.
Quoted 7 lines
Quoted 2 lines
I dont see the -mneon-for-64bits option in our version, but I assume something equivalent is used.
Thanks for the clarification. This confirms my initial opinion that NEON can be enabled in
start.Son a per-board basis, as it would workin all situations -- This is assuming that enabling NEON would have no adverse effect on builds which do not use it, of course.
Isn't it better just to enabled it when __ARM_NEON__ is exported by gcc? It should mean that gcc allows to emit these instructions.
Thanks,
Michal
Signature · 14 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 263 bytes Desc: OpenPGP digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131017/7de25804/attachment.pgp>
PATCH 1/1 zynq: Use arch_cpu_init() instead of lowlevel_init()
Hi Michal,
Quoted 7 lines
Quoted 4 lines
Thanks for the clarification. This confirms my initial opinion that NEON can be enabled in
start.Son a per-board basis, as it would workin all situations -- This is assuming that enabling NEON would have no adverse effect on builds which do not use it, of course.Isn't it better just to enabled it when
__ARM_NEON__is exported by gcc? It should mean that gcc allows to emit these instructions.
Even better. :)
Quoted 2 lines
Thanks,
Michal
Amicalement,
Signature · 1 line
Albert.
PATCH 1/1 zynq: Use arch_cpu_init() instead of lowlevel_init()
In reply to Michal SimekHi Michal,
Quoted 45 lines · Michal Simek
Zynq
lowlevel_init()was implemented in C but stack pointer is setup after function call in_main(). Move architecture setup toarch_cpu_init()which is call as the first function inboard_init_f()which already have correct stack pointer.Reported-by Sven Schwermer <[email protected]>Signed-off-by Michal Simek <[email protected]>---
I can't see any problem to call zynq setup a little bit later. There is already expectation that u-boot runs from DDR.
Movinglowlevel_initfrom C to ASM is possible but I will have to introduce new macros with hardcoded values. Using structures is much nicer.--- arch/arm/cpu/armv7/zynq/cpu.c | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm/cpu/armv7/zynq/cpu.c +6
-1@@ -11,6 +11,10 @@void lowlevel_init (void ) { +} + +int arch_cpu_init (void ) +{zynq_slcr_unlock ();/* remap DDR to zero, FILTERSTART */ writel (0 , &scu_base->filter_start);@@ -31,6 +35,8 @@ void lowlevel_init(void)writel (0xC , &slcr_base->ddr_urgent);zynq_slcr_lock (); + +return 0 ; }void reset_cpu (ulong addr) --
Quoted 3 lines
1.8.2.3
Applied to u-boot-arm/master, thanks!
Amicalement,
Signature · 1 line
Albert.