arm: socfpga: fix comment about SPL memory layout
PATCH 1/3 arm: socfpga: fix comment about SPL memory layout
The comment about SPL memory layout for socfpga gen5 is outdated: the initial malloc memory is now at the end of the SRAM, gd is below it (see board_init_f_alloc_reserve).
---
include/configs/socfpga_common.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/configs/socfpga_common.h +3 -3
@@ -237,9 +237,9 @@ unsigned int cm_get_qspi_controller_clk_hz(void);* * 0xFFFF_0000 ...... Start of SRAM * 0xFFFF_xxxx ...... Top of stack (grows down) -* 0xFFFF_yyyy ...... Malloc area -* 0xFFFF_zzzz ...... Global Data -* 0xFFFF_FF00 ...... End of SRAM +* 0xFFFF_yyyy ...... Global Data +* 0xFFFF_zzzz ...... Malloc area +* 0xFFFF_FFFF ...... End of SRAM * * SRAM Memory layout for Arria 10: * 0xFFE0_0000 ...... Start of SRAM (bottom)
Signature · 1 line
2.17.1
PATCH 2/3 arm: socfpga: a10: move SPL stack size to Kconfig
Instead of fixing the SPL stack to 64 KiB in the board config header via CONFIG_SYS_SPL_MALLOC_SIZE, let's just use CONFIG_SPL_SYS_MALLOC_F_LEN in the defconfig.
This also has the advandage that it removes sub-mach specific ifdefs in socfpga_common.h.
---
configs/socfpga_arria10_defconfig | 1 + include/configs/socfpga_common.h | 14 -------------- 2 files changed, 1 insertion(+), 14 deletions(-)
configs/socfpga_arria10_defconfig +1 -0
@@ -2,6 +2,7 @@ CONFIG_ARM=y CONFIG_ARCH_SOCFPGA=y CONFIG_SYS_TEXT_BASE=0x01000040 CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_SPL_SYS_MALLOC_F_LEN=0x10000 CONFIG_TARGET_SOCFPGA_ARRIA10_SOCDK=y CONFIG_SPL=y CONFIG_IDENT_STRING="socfpga_arria10"
include/configs/socfpga_common.h +0 -14
@@ -251,16 +251,6 @@ unsigned int cm_get_qspi_controller_clk_hz(void);#define CONFIG_SPL_TEXT_BASE CONFIG_SYS_INIT_RAM_ADDR#define CONFIG_SPL_MAX_SIZE CONFIG_SYS_INIT_RAM_SIZE -#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10 ) -/* SPL memory allocation configuration, this is for FAT implementation */ -#ifndef CONFIG_SYS_SPL_MALLOC_START -#define CONFIG_SYS_SPL_MALLOC_SIZE 0x00010000 -#define CONFIG_SYS_SPL_MALLOC_START (CONFIG_SYS_INIT_RAM_SIZE - \ - CONFIG_SYS_SPL_MALLOC_SIZE + \ - CONFIG_SYS_INIT_RAM_ADDR) -#endif -#endif -/* SPL SDMMC boot support */ #ifdef CONFIG_SPL_MMC_SUPPORT #if defined(CONFIG_SPL_FS_FAT ) || defined(CONFIG_SPL_FS_EXT4 )
@@ -287,11 +277,7 @@ unsigned int cm_get_qspi_controller_clk_hz(void);/* * Stack setup */ -#if defined(CONFIG_TARGET_SOCFPGA_GEN5 )#define CONFIG_SPL_STACK CONFIG_SYS_INIT_SP_ADDR -#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10 ) -#define CONFIG_SPL_STACK CONFIG_SYS_SPL_MALLOC_START -#endif /* Extra Environment */ #ifndef CONFIG_SPL_BUILD
Signature · 1 line
2.17.1
PATCH 2/3 arm: socfpga: a10: move SPL stack size to Kconfig
Quoted 8 lines · Simon Goldschmidt
Instead of fixing the SPL stack to 64 KiB in the board config header via
CONFIG_SYS_SPL_MALLOC_SIZE, let's just useCONFIG_SPL_SYS_MALLOC_F_LENin the defconfig.This also has the advandage that it removes sub-mach specific ifdefs in
socfpga_common.h.Signed-off-by Simon Goldschmidt <[email protected]>
Can't we default these stack sizes with imply in Kconfig files instead ? Then they won't have to be in the defconfigs either.
Quoted 52 lines
---
configs/socfpga_arria10_defconfig | 1 + include/configs/socfpga_common.h | 14 -------------- 2 files changed, 1 insertion(+), 14 deletions(-)configs/socfpga_arria10_defconfig +1
-0@@ -2,6 +2,7 @@ CONFIG_ARM=y CONFIG_ARCH_SOCFPGA=y CONFIG_SYS_TEXT_BASE=0x01000040 CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_SPL_SYS_MALLOC_F_LEN=0x10000 CONFIG_TARGET_SOCFPGA_ARRIA10_SOCDK=y CONFIG_SPL=y CONFIG_IDENT_STRING="socfpga_arria10"include/configs/socfpga_common.h +0
-14@@ -251,16 +251,6 @@ unsigned int cm_get_qspi_controller_clk_hz(void);#define CONFIG_SPL_TEXT_BASE CONFIG_SYS_INIT_RAM_ADDR#define CONFIG_SPL_MAX_SIZE CONFIG_SYS_INIT_RAM_SIZE -#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10 ) -/* SPL memory allocation configuration, this is for FAT implementation */ -#ifndef CONFIG_SYS_SPL_MALLOC_START -#define CONFIG_SYS_SPL_MALLOC_SIZE 0x00010000 -#define CONFIG_SYS_SPL_MALLOC_START (CONFIG_SYS_INIT_RAM_SIZE - \ - CONFIG_SYS_SPL_MALLOC_SIZE + \ - CONFIG_SYS_INIT_RAM_ADDR) -#endif -#endif -/* SPL SDMMC boot support */ #ifdef CONFIG_SPL_MMC_SUPPORT #if defined(CONFIG_SPL_FS_FAT ) || defined(CONFIG_SPL_FS_EXT4 )@@ -287,11 +277,7 @@ unsigned int cm_get_qspi_controller_clk_hz(void);/* * Stack setup */ -#if defined(CONFIG_TARGET_SOCFPGA_GEN5 )#define CONFIG_SPL_STACK CONFIG_SYS_INIT_SP_ADDR -#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10 ) -#define CONFIG_SPL_STACK CONFIG_SYS_SPL_MALLOC_START -#endif /* Extra Environment */ #ifndef CONFIG_SPL_BUILD
Signature · 2 lines
Best regards, Marek Vasut
PATCH 2/3 arm: socfpga: a10: move SPL stack size to Kconfig
Quoted 6 lines · Marek Vasut
Quoted 4 lines · Simon Goldschmidt
Instead of fixing the SPL stack to 64 KiB in the board config header via
CONFIG_SYS_SPL_MALLOC_SIZE, let's just useCONFIG_SPL_SYS_MALLOC_F_LENin the defconfig.
Quoted 7 lines
Quoted 4 lines
This also has the advandage that it removes sub-mach specific ifdefs in
socfpga_common.h.Signed-off-by Simon Goldschmidt <[email protected]>Can't we default these stack sizes with imply in
Kconfigfiles instead ? Then they won't have to be in the defconfigs either.
I guess you mean default the *malloc* sizes, not *stack* sizes? Yes, that should work.
I started this whole series because all gen5 defconfigs set the initial malloc size to 8 KiB, while I monitored socrates to only need a bit more than 1 KiB. With my reset patches, something around 1.5 KiB is still enough. So I'd move that to imply 2 KiB for gen5 and 64 KiB for a10 in a patch 4/4 for v2.
Regards,
Simon
Quoted 58 lines
Quoted 43 lines
---
configs/socfpga_arria10_defconfig | 1 + include/configs/socfpga_common.h | 14 -------------- 2 files changed, 1 insertion(+), 14 deletions(-)configs/socfpga_arria10_defconfig +1
-0@@ -2,6 +2,7 @@ CONFIG_ARM=y CONFIG_ARCH_SOCFPGA=y CONFIG_SYS_TEXT_BASE=0x01000040 CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_SPL_SYS_MALLOC_F_LEN=0x10000 CONFIG_TARGET_SOCFPGA_ARRIA10_SOCDK=y CONFIG_SPL=y CONFIG_IDENT_STRING="socfpga_arria10"include/configs/socfpga_common.h +0
-10@@ -251,16 +251,6 @@ unsigned int cm_get_qspi_controller_clk_hz(void);#define CONFIG_SPL_TEXT_BASE CONFIG_SYS_INIT_RAM_ADDR#define CONFIG_SPL_MAX_SIZE CONFIG_SYS_INIT_RAM_SIZE -#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10 ) -/* SPL memory allocation configuration, this is for FAT implementation */ -#ifndef CONFIG_SYS_SPL_MALLOC_START -#define CONFIG_SYS_SPL_MALLOC_SIZE 0x00010000 -#define CONFIG_SYS_SPL_MALLOC_START (CONFIG_SYS_INIT_RAM_SIZE - \ - CONFIG_SYS_SPL_MALLOC_SIZE + \ - CONFIG_SYS_INIT_RAM_ADDR) -#endif -#endif -/* SPL SDMMC boot support */ #ifdef CONFIG_SPL_MMC_SUPPORT #if defined(CONFIG_SPL_FS_FAT ) || defined(CONFIG_SPL_FS_EXT4 )@@ -287,11 +277,7 @@ unsigned int cm_get_qspi_controller_clk_hz(void);/* include/configs/socfpga_common.h unsigned int cm_get_qspi_controller_clk_hz(void); · line 283
Quoted 10 lines
include/configs/socfpga_common.h +0
-4* Stack setup */ -#if defined(CONFIG_TARGET_SOCFPGA_GEN5 )#define CONFIG_SPL_STACK CONFIG_SYS_INIT_SP_ADDR -#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10 ) -#define CONFIG_SPL_STACK CONFIG_SYS_SPL_MALLOC_START -#endif /* Extra Environment */ #ifndef CONFIG_SPL_BUILD --
Best regards,
Marek Vasut
PATCH 2/3 arm: socfpga: a10: move SPL stack size to Kconfig
Quoted 10 lines · Simon Goldschmidt
Quoted 9 lines · Marek Vasut
Quoted 7 lines · Simon Goldschmidt
Instead of fixing the SPL stack to 64 KiB in the board config header via
CONFIG_SYS_SPL_MALLOC_SIZE, let's just useCONFIG_SPL_SYS_MALLOC_F_LENin the defconfig.This also has the advandage that it removes sub-mach specific ifdefs in
socfpga_common.h.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Simon Goldschmidt <[email protected]>Can't we default these stack sizes with imply in
Kconfigfiles instead ? Then they won't have to be in the defconfigs either.I guess you mean default the *malloc* sizes, not *stack* sizes? Yes, that should work.
Yes, that's what I meant.
Quoted 4 lines
I started this whole series because all gen5 defconfigs set the initial malloc size to 8 KiB, while I monitored socrates to only need a bit more than 1 KiB. With my reset patches, something around 1.5 KiB is still enough. So I'd move that to imply 2 KiB for gen5 and 64 KiB for a10 in a patch 4/4 for v2.
Sounds good!
Quoted 61 lines
Regards,
SimonQuoted 58 lines
Quoted 43 lines
---
configs/socfpga_arria10_defconfig | 1 + include/configs/socfpga_common.h | 14 -------------- 2 files changed, 1 insertion(+), 14 deletions(-)configs/socfpga_arria10_defconfig +1
-0@@ -2,6 +2,7 @@ CONFIG_ARM=y CONFIG_ARCH_SOCFPGA=y CONFIG_SYS_TEXT_BASE=0x01000040 CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_SPL_SYS_MALLOC_F_LEN=0x10000 CONFIG_TARGET_SOCFPGA_ARRIA10_SOCDK=y CONFIG_SPL=y CONFIG_IDENT_STRING="socfpga_arria10"include/configs/socfpga_common.h +0
-10@@ -251,16 +251,6 @@ unsigned int cm_get_qspi_controller_clk_hz(void);#define CONFIG_SPL_TEXT_BASE CONFIG_SYS_INIT_RAM_ADDR#define CONFIG_SPL_MAX_SIZE CONFIG_SYS_INIT_RAM_SIZE -#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10 ) -/* SPL memory allocation configuration, this is for FAT implementation */ -#ifndef CONFIG_SYS_SPL_MALLOC_START -#define CONFIG_SYS_SPL_MALLOC_SIZE 0x00010000 -#define CONFIG_SYS_SPL_MALLOC_START (CONFIG_SYS_INIT_RAM_SIZE - \ - CONFIG_SYS_SPL_MALLOC_SIZE + \ - CONFIG_SYS_INIT_RAM_ADDR) -#endif -#endif -/* SPL SDMMC boot support */ #ifdef CONFIG_SPL_MMC_SUPPORT #if defined(CONFIG_SPL_FS_FAT ) || defined(CONFIG_SPL_FS_EXT4 )@@ -287,11 +277,7 @@ unsigned int cm_get_qspi_controller_clk_hz(void);/* include/configs/socfpga_common.h unsigned int cm_get_qspi_controller_clk_hz(void); · line 283
Quoted 10 lines
include/configs/socfpga_common.h +0
-4* Stack setup */ -#if defined(CONFIG_TARGET_SOCFPGA_GEN5 )#define CONFIG_SPL_STACK CONFIG_SYS_INIT_SP_ADDR -#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10 ) -#define CONFIG_SPL_STACK CONFIG_SYS_SPL_MALLOC_START -#endif /* Extra Environment */ #ifndef CONFIG_SPL_BUILD --
Best regards,
Marek Vasut
Signature · 2 lines
Best regards, Marek Vasut
PATCH 3/3 arm: socfpga: put initial U-Boot stack into DDR
In reply to Simon GoldschmidtIf SPL pre-reloc stage puts the stack into DDR, U-Boot should be able to do that, too.
The reason to do so is that this way, U-Boot initial stack can be larger than SPL initial stack. In situations where we want to save the SPL in SRAM for next boot without reloading, this prevents overwriting the SPL DTB in SRAM if U-Boot stack usage gets too high.
---
include/configs/socfpga_common.h | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
include/configs/socfpga_common.h +13 -7
@@ -38,12 +38,23 @@#if ((CONFIG_SYS_BOOTCOUNT_ADDR >CONFIG_SYS_INIT_RAM_ADDR ) && \ (CONFIG_SYS_BOOTCOUNT_ADDR < (CONFIG_SYS_INIT_RAM_ADDR + \CONFIG_SYS_INIT_RAM_SIZE ))) -#define CONFIG_SYS_INIT_SP_ADDR CONFIG_SYS_BOOTCOUNT_ADDR +#define CONFIG_SPL_STACK CONFIG_SYS_BOOTCOUNT_ADDR#else -#define CONFIG_SYS_INIT_SP_ADDR \ +#define CONFIG_SPL_STACK \ (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE)#endif +/* +* U-Boot stack setup: if SPL post-reloc uses DDR stack, use it in pre-reloc +* phase of U-Boot, too. This prevents overwriting SPL data if stack/heap usage +* in U-Boot pre-reloc is higher than in SPL. +*/ +#if defined(CONFIG_SPL_STACK_R_ADDR ) &&CONFIG_SPL_STACK_R_ADDR +#define CONFIG_SYS_INIT_SP_ADDR CONFIG_SPL_STACK_R_ADDR +#else +#define CONFIG_SYS_INIT_SP_ADDR CONFIG_SPL_STACK +#endif +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1/*
@@ -274,11 +285,6 @@ unsigned int cm_get_qspi_controller_clk_hz(void);#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x40000#endif -/* -* Stack setup -*/ -#define CONFIG_SPL_STACK CONFIG_SYS_INIT_SP_ADDR -/* Extra Environment */ #ifndef CONFIG_SPL_BUILD
Signature · 1 line
2.17.1
PATCH 3/3 arm: socfpga: put initial U-Boot stack into DDR
Quoted 2 lines · Simon Goldschmidt
If SPL pre-reloc stage puts the stack into DDR, U-Boot should be able to do that, too.
Here you mention SPL pre-reloc stage, while about mid-way through the patch you have a comment talking about SPL post-reloc stage, which one is it ? I think the commit message needs rewording, it's not clear what the patch does based on it.
On a separate note, this is likely a fix for current release, right ?
Finally , keep in mind the A10 needs to load the FPGA before DRAM becomes available, so the stack shenanigans there become even more nasty.
Quoted 54 lines
The reason to do so is that this way, U-Boot initial stack can be larger than SPL initial stack. In situations where we want to save the SPL in SRAM for next boot without reloading, this prevents overwriting the SPL DTB in SRAM if U-Boot stack usage gets too high.
Signed-off-by Simon Goldschmidt <[email protected]>---
include/configs/socfpga_common.h | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)include/configs/socfpga_common.h +13
-7@@ -38,12 +38,23 @@#if ((CONFIG_SYS_BOOTCOUNT_ADDR >CONFIG_SYS_INIT_RAM_ADDR ) && \ (CONFIG_SYS_BOOTCOUNT_ADDR < (CONFIG_SYS_INIT_RAM_ADDR + \CONFIG_SYS_INIT_RAM_SIZE ))) -#define CONFIG_SYS_INIT_SP_ADDR CONFIG_SYS_BOOTCOUNT_ADDR +#define CONFIG_SPL_STACK CONFIG_SYS_BOOTCOUNT_ADDR#else -#define CONFIG_SYS_INIT_SP_ADDR \ +#define CONFIG_SPL_STACK \ (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE)#endif +/* +* U-Boot stack setup: if SPL post-reloc uses DDR stack, use it in pre-reloc +* phase of U-Boot, too. This prevents overwriting SPL data if stack/heap usage +* in U-Boot pre-reloc is higher than in SPL. +*/ +#if defined(CONFIG_SPL_STACK_R_ADDR ) &&CONFIG_SPL_STACK_R_ADDR +#define CONFIG_SYS_INIT_SP_ADDR CONFIG_SPL_STACK_R_ADDR +#else +#define CONFIG_SYS_INIT_SP_ADDR CONFIG_SPL_STACK +#endif +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1/* @@ -274,11 +285,6 @@ unsigned int cm_get_qspi_controller_clk_hz(void);#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x40000#endif -/* -* Stack setup -*/ -#define CONFIG_SPL_STACK CONFIG_SYS_INIT_SP_ADDR -/* Extra Environment */ #ifndef CONFIG_SPL_BUILD
Signature · 2 lines
Best regards, Marek Vasut
PATCH 3/3 arm: socfpga: put initial U-Boot stack into DDR
Quoted 9 lines · Marek Vasut
Quoted 2 lines · Simon Goldschmidt
If SPL pre-reloc stage puts the stack into DDR, U-Boot should be able to do that, too.
Here you mention SPL pre-reloc stage, while about mid-way through the patch you have a comment talking about SPL post-reloc stage, which one is it ? I think the commit message needs rewording, it's not clear what the patch does based on it.
Ehrm right. The commit message is wrong. Post-reloc is correct.
Quoted 1 line
On a separate note, this is likely a fix for current release, right ?
Not really. For A10, this should not change anything, just ensure the common header file does not use 2 different ways to achieve the same thing. Note that A10 does *not* enable a different stack/malloc area for SPL post-reloc!
For gen5, yes there is a change, but only in U-Boot, not in SPL. But this is not a fix, it's an improvement to be able to make the SPL malloc pool smaller without U-Boot overwriting it. It's currently not overwritten as both malloc sizes
are the same. I'd change that in a follow-up patch which reduces SPL malloc size for gen5.
Quoted 2 lines
Finally , keep in mind the A10 needs to load the FPGA before DRAM becomes available, so the stack shenanigans there become even more nasty.
Right, that's why even the initial malloc size for SPL is 64 KiB, right? As written
above, this patch should not change anything for A10, so this should still work.
From reading the A10 SPL code, I didn't quite get how this works though, as it seems the simple-malloc members in gd are only initialized after spl_early_init(), so after initializing DT/DM? Or is A10 not yet converted to DT?
Regards,
Simon
Quoted 59 lines
Quoted 44 lines
The reason to do so is that this way, U-Boot initial stack can be larger than SPL initial stack. In situations where we want to save the SPL in SRAM for next boot without reloading, this prevents overwriting the SPL DTB in SRAM if U-Boot stack usage gets too high.
Signed-off-by Simon Goldschmidt <[email protected]>---
include/configs/socfpga_common.h | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)include/configs/socfpga_common.h +13
-2@@ -38,12 +38,23 @@#if ((CONFIG_SYS_BOOTCOUNT_ADDR >CONFIG_SYS_INIT_RAM_ADDR ) && \ (CONFIG_SYS_BOOTCOUNT_ADDR < (CONFIG_SYS_INIT_RAM_ADDR + \CONFIG_SYS_INIT_RAM_SIZE ))) -#define CONFIG_SYS_INIT_SP_ADDR CONFIG_SYS_BOOTCOUNT_ADDR +#define CONFIG_SPL_STACK CONFIG_SYS_BOOTCOUNT_ADDR#else -#define CONFIG_SYS_INIT_SP_ADDR \ +#define CONFIG_SPL_STACK \ (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE)#endif +/* +* U-Boot stack setup: if SPL post-reloc uses DDR stack, use it in pre-reloc +* phase of U-Boot, too. This prevents overwriting SPL data if stack/heap usage +* in U-Boot pre-reloc is higher than in SPL. +*/ +#if defined(CONFIG_SPL_STACK_R_ADDR ) &&CONFIG_SPL_STACK_R_ADDR +#define CONFIG_SYS_INIT_SP_ADDR CONFIG_SPL_STACK_R_ADDR +#else +#define CONFIG_SYS_INIT_SP_ADDR CONFIG_SPL_STACK +#endif +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1/* @@ -274,11 +285,6 @@ unsigned int cm_get_qspi_controller_clk_hz(void);#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x40000include/configs/socfpga_common.h unsigned int cm_get_qspi_controller_clk_hz(void); · line 290
Quoted 10 lines
include/configs/socfpga_common.h +0
-5#endif -/* -* Stack setup -*/ -#define CONFIG_SPL_STACK CONFIG_SYS_INIT_SP_ADDR -/* Extra Environment */ #ifndef CONFIG_SPL_BUILD --
Best regards,
Marek Vasut
PATCH 3/3 arm: socfpga: put initial U-Boot stack into DDR
Quoted 11 lines · Simon Goldschmidt
Quoted 9 lines · Marek Vasut
Quoted 2 lines · Simon Goldschmidt
If SPL pre-reloc stage puts the stack into DDR, U-Boot should be able to do that, too.
Here you mention SPL pre-reloc stage, while about mid-way through the patch you have a comment talking about SPL post-reloc stage, which one is it ? I think the commit message needs rewording, it's not clear what the patch does based on it.
Quoted 8 lines
Ehrm right. The commit message is wrong. Post-reloc is correct.
Quoted 1 line
On a separate note, this is likely a fix for current release, right ?
Not really. For A10, this should not change anything, just ensure the common header file does not use 2 different ways to achieve the same thing. Note that A10 does *not* enable a different stack/malloc area for SPL post-reloc!
OK
Quoted 6 lines
For gen5, yes there is a change, but only in U-Boot, not in SPL. But this is not a fix, it's an improvement to be able to make the SPL malloc pool smaller without U-Boot overwriting it. It's currently not overwritten as both malloc sizes
are the same. I'd change that in a follow-up patch which reduces SPL malloc size for gen5.
Sounds good
Quoted 6 lines
Quoted 2 lines
Finally , keep in mind the A10 needs to load the FPGA before DRAM becomes available, so the stack shenanigans there become even more nasty.
Right, that's why even the initial malloc size for SPL is 64 KiB, right? As written
above, this patch should not change anything for A10, so this should still work.
No, that's because the A10 does a lot of allocations in SPL iirc.
Quoted 4 lines
From reading the A10 SPL code, I didn't quite get how this works though, as it seems the simple-malloc members in gd are only initialized after
spl_early_init(), so after initializing DT/DM? Or is A10 not yet converted to DT?
It's semi-converted. The early part still needs some work.
Quoted 62 lines
Regards,
SimonQuoted 59 lines
Quoted 44 lines
The reason to do so is that this way, U-Boot initial stack can be larger than SPL initial stack. In situations where we want to save the SPL in SRAM for next boot without reloading, this prevents overwriting the SPL DTB in SRAM if U-Boot stack usage gets too high.
Signed-off-by Simon Goldschmidt <[email protected]>---
include/configs/socfpga_common.h | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)include/configs/socfpga_common.h +13
-2@@ -38,12 +38,23 @@#if ((CONFIG_SYS_BOOTCOUNT_ADDR >CONFIG_SYS_INIT_RAM_ADDR ) && \ (CONFIG_SYS_BOOTCOUNT_ADDR < (CONFIG_SYS_INIT_RAM_ADDR + \CONFIG_SYS_INIT_RAM_SIZE ))) -#define CONFIG_SYS_INIT_SP_ADDR CONFIG_SYS_BOOTCOUNT_ADDR +#define CONFIG_SPL_STACK CONFIG_SYS_BOOTCOUNT_ADDR#else -#define CONFIG_SYS_INIT_SP_ADDR \ +#define CONFIG_SPL_STACK \ (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE)#endif +/* +* U-Boot stack setup: if SPL post-reloc uses DDR stack, use it in pre-reloc +* phase of U-Boot, too. This prevents overwriting SPL data if stack/heap usage +* in U-Boot pre-reloc is higher than in SPL. +*/ +#if defined(CONFIG_SPL_STACK_R_ADDR ) &&CONFIG_SPL_STACK_R_ADDR +#define CONFIG_SYS_INIT_SP_ADDR CONFIG_SPL_STACK_R_ADDR +#else +#define CONFIG_SYS_INIT_SP_ADDR CONFIG_SPL_STACK +#endif +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1/* @@ -274,11 +285,6 @@ unsigned int cm_get_qspi_controller_clk_hz(void);#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x40000include/configs/socfpga_common.h unsigned int cm_get_qspi_controller_clk_hz(void); · line 290
Quoted 10 lines
include/configs/socfpga_common.h +0
-5#endif -/* -* Stack setup -*/ -#define CONFIG_SPL_STACK CONFIG_SYS_INIT_SP_ADDR -/* Extra Environment */ #ifndef CONFIG_SPL_BUILD --
Best regards,
Marek Vasut
Signature · 2 lines
Best regards, Marek Vasut