diff mbox series

[2/2] rockchip: rk3399: Update stack and bss addresses

Message ID 20240212005914.3512640-3-jonas@kwiboo.se
State Superseded
Delegated to: Kever Yang
Headers show
Series rockchip: Update stack and bss addresses on RK3328 and RK3399 | expand

Commit Message

Jonas Karlman Feb. 12, 2024, 12:59 a.m. UTC
With the stack and text base used by U-Boot SPL and proper on RK3399
there is a high likelihood of overlapping when U-Boot proper + FDT nears
1 MiB in size.

Currently the following memory layout is used:
- 0x00000000 (@0 MiB): U-Boot SPL text base
- 0x00040000 (@256 KiB): TF-A
- 0x00200000 (@2 MiB): U-Boot proper text base
- 0x00300000 (@3 MiB): U-Boot proper init stack
- 0x00400000 (@4 MiB): U-Boot SPL init stack
- 0x00400000 (@4 MiB): U-Boot SPL bss
- 0x02000000 (@64 MiB): U-Boot SPL reloc stack
- 0x08400000 (@132 MiB): optional OPTEE

SPL load TF-A, U-Boot proper and optional OPTEE after SPL stack has
relocated, meaning that there is room for close to 2 MiB (@2-4 MiB).
However, the initial stack used by U-Boot proper is limiting the size
of U-Boot proper + FDT to below 1 MiB (@2-3 MiB).

Instead change to use the following memory layout:
- 0x00000000 (@0 MiB): U-Boot SPL text base
- 0x00040000 (@256 KiB): TF-A
- 0x00200000 (@2 MiB): U-Boot proper text base
- 0x00400000 (@4 MiB): U-Boot SPL init stack
- 0x00800000 (@8 MiB): U-Boot proper init stack (changed)
- 0x02000000 (@32 MiB): U-Boot SPL bss (changed)
- 0x04000000 (@64 MiB): U-Boot SPL reloc stack
- 0x08400000 (@132 MiB): optional OPTEE

This should leave room for loading and running a U-Boot proper close
to 6 MiB (@2-8 MiB) in size. When U-Boot proper has relocated is should
be possible to use @2-132 MiB and @164 MiB+ for scripts, kernel etc.

With the moved SPL reloc stack it is also possible to use a much larger
malloc area in SPL, e.g. using default SPL_STACK_R_MALLOC_SIMPLE_LEN.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
 configs/chromebook_bob_defconfig             | 2 +-
 configs/chromebook_kevin_defconfig           | 2 +-
 configs/eaidk-610-rk3399_defconfig           | 4 ++--
 configs/evb-rk3399_defconfig                 | 4 ++--
 configs/ficus-rk3399_defconfig               | 2 +-
 configs/firefly-rk3399_defconfig             | 4 ++--
 configs/khadas-edge-captain-rk3399_defconfig | 4 ++--
 configs/khadas-edge-rk3399_defconfig         | 4 ++--
 configs/khadas-edge-v-rk3399_defconfig       | 4 ++--
 configs/leez-rk3399_defconfig                | 4 ++--
 configs/nanopc-t4-rk3399_defconfig           | 4 ++--
 configs/nanopi-m4-2gb-rk3399_defconfig       | 4 ++--
 configs/nanopi-m4-rk3399_defconfig           | 4 ++--
 configs/nanopi-m4b-rk3399_defconfig          | 4 ++--
 configs/nanopi-neo4-rk3399_defconfig         | 4 ++--
 configs/nanopi-r4s-rk3399_defconfig          | 4 ++--
 configs/orangepi-rk3399_defconfig            | 4 ++--
 configs/pinebook-pro-rk3399_defconfig        | 4 ++--
 configs/pinephone-pro-rk3399_defconfig       | 4 ++--
 configs/puma-rk3399_defconfig                | 2 +-
 configs/roc-pc-mezzanine-rk3399_defconfig    | 4 ++--
 configs/roc-pc-rk3399_defconfig              | 4 ++--
 configs/rock-4c-plus-rk3399_defconfig        | 4 ++--
 configs/rock-4se-rk3399_defconfig            | 4 ++--
 configs/rock-pi-4-rk3399_defconfig           | 4 ++--
 configs/rock-pi-4c-rk3399_defconfig          | 4 ++--
 configs/rock-pi-n10-rk3399pro_defconfig      | 4 ++--
 configs/rock960-rk3399_defconfig             | 4 ++--
 configs/rockpro64-rk3399_defconfig           | 4 ++--
 29 files changed, 54 insertions(+), 54 deletions(-)

Comments

Quentin Schulz Feb. 12, 2024, 10:37 a.m. UTC | #1
Hi Jonas,

On 2/12/24 01:59, Jonas Karlman wrote:
> With the stack and text base used by U-Boot SPL and proper on RK3399
> there is a high likelihood of overlapping when U-Boot proper + FDT nears
> 1 MiB in size.
> 
> Currently the following memory layout is used:
> - 0x00000000 (@0 MiB): U-Boot SPL text base
> - 0x00040000 (@256 KiB): TF-A
> - 0x00200000 (@2 MiB): U-Boot proper text base
> - 0x00300000 (@3 MiB): U-Boot proper init stack
> - 0x00400000 (@4 MiB): U-Boot SPL init stack
> - 0x00400000 (@4 MiB): U-Boot SPL bss
> - 0x02000000 (@64 MiB): U-Boot SPL reloc stack
> - 0x08400000 (@132 MiB): optional OPTEE
> 
> SPL load TF-A, U-Boot proper and optional OPTEE after SPL stack has
> relocated, meaning that there is room for close to 2 MiB (@2-4 MiB).
> However, the initial stack used by U-Boot proper is limiting the size
> of U-Boot proper + FDT to below 1 MiB (@2-3 MiB).
> 
> Instead change to use the following memory layout:
> - 0x00000000 (@0 MiB): U-Boot SPL text base
> - 0x00040000 (@256 KiB): TF-A
> - 0x00200000 (@2 MiB): U-Boot proper text base
> - 0x00400000 (@4 MiB): U-Boot SPL init stack
> - 0x00800000 (@8 MiB): U-Boot proper init stack (changed)
> - 0x02000000 (@32 MiB): U-Boot SPL bss (changed)
> - 0x04000000 (@64 MiB): U-Boot SPL reloc stack
> - 0x08400000 (@132 MiB): optional OPTEE
> 
> This should leave room for loading and running a U-Boot proper close
> to 6 MiB (@2-8 MiB) in size. When U-Boot proper has relocated is should
> be possible to use @2-132 MiB and @164 MiB+ for scripts, kernel etc.
> 
> With the moved SPL reloc stack it is also possible to use a much larger
> malloc area in SPL, e.g. using default SPL_STACK_R_MALLOC_SIMPLE_LEN.
> 
> Signed-off-by: Jonas Karlman <jonas@kwiboo.se>

Do we not need to update memory addresses in the environment as well?

scriptaddr=0x00500000

This is at 5MiB if I'm not mistaken?

Basically everything in include/configs/rk3399_common.h in 
ENV_MEM_LAYOUT_SETTINGS needs to be updated to be located after 164MiB?

Did I misunderstand something? I find it weird the current values seems 
to be located after U-Boot SPL bss and that e.g.

kernel_addr_r=0x02080000

is at 32.5MiB, and with U-Boot SPL reloc stack currently at 64MiB... a 
31.5+MiB kernel Image would mess up the data there? (what do we need it 
for BTW once in U-boot proper after relocation?).

Side question, what about making those values the default for RK3399 
instead of having it in each defconfig? This could grow quickly out of 
hands to move this to the Kconfig symbol itself, so not sure it's that 
interesting to the project, but raising this anyway.

Cheers,
Quentin
Jonas Karlman Feb. 12, 2024, 11:08 a.m. UTC | #2
Hi Quentin,

On 2024-02-12 11:37, Quentin Schulz wrote:
> Hi Jonas,
> 
> On 2/12/24 01:59, Jonas Karlman wrote:
>> With the stack and text base used by U-Boot SPL and proper on RK3399
>> there is a high likelihood of overlapping when U-Boot proper + FDT nears
>> 1 MiB in size.
>>
>> Currently the following memory layout is used:
>> - 0x00000000 (@0 MiB): U-Boot SPL text base
>> - 0x00040000 (@256 KiB): TF-A
>> - 0x00200000 (@2 MiB): U-Boot proper text base
>> - 0x00300000 (@3 MiB): U-Boot proper init stack
>> - 0x00400000 (@4 MiB): U-Boot SPL init stack
>> - 0x00400000 (@4 MiB): U-Boot SPL bss
>> - 0x02000000 (@64 MiB): U-Boot SPL reloc stack
>> - 0x08400000 (@132 MiB): optional OPTEE
>>
>> SPL load TF-A, U-Boot proper and optional OPTEE after SPL stack has
>> relocated, meaning that there is room for close to 2 MiB (@2-4 MiB).
>> However, the initial stack used by U-Boot proper is limiting the size
>> of U-Boot proper + FDT to below 1 MiB (@2-3 MiB).
>>
>> Instead change to use the following memory layout:
>> - 0x00000000 (@0 MiB): U-Boot SPL text base
>> - 0x00040000 (@256 KiB): TF-A
>> - 0x00200000 (@2 MiB): U-Boot proper text base
>> - 0x00400000 (@4 MiB): U-Boot SPL init stack
>> - 0x00800000 (@8 MiB): U-Boot proper init stack (changed)
>> - 0x02000000 (@32 MiB): U-Boot SPL bss (changed)
>> - 0x04000000 (@64 MiB): U-Boot SPL reloc stack
>> - 0x08400000 (@132 MiB): optional OPTEE
>>
>> This should leave room for loading and running a U-Boot proper close
>> to 6 MiB (@2-8 MiB) in size. When U-Boot proper has relocated is should
>> be possible to use @2-132 MiB and @164 MiB+ for scripts, kernel etc.
>>
>> With the moved SPL reloc stack it is also possible to use a much larger
>> malloc area in SPL, e.g. using default SPL_STACK_R_MALLOC_SIMPLE_LEN.
>>
>> Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
> 
> Do we not need to update memory addresses in the environment as well?

The addresses in environment is to my knowledge only used in U-Boot
proper after relocation. And at that time we should be free to use @2+
MiB up to somewhere close to gd ram_top/relocaddr. The optional Rockchip
OPTEE blobb may occupy @132-164 MiB, but I do not think loading OPTEE
blobs works as-is, so that may not be a big issue.

So to my knowledge we do not need to update any of the memory addresses
in the environment as well.

> 
> scriptaddr=0x00500000
> 
> This is at 5MiB if I'm not mistaken?
> 
> Basically everything in include/configs/rk3399_common.h in 
> ENV_MEM_LAYOUT_SETTINGS needs to be updated to be located after 164MiB?
> 
> Did I misunderstand something? I find it weird the current values seems 
> to be located after U-Boot SPL bss and that e.g.
> 
> kernel_addr_r=0x02080000
> 
> is at 32.5MiB, and with U-Boot SPL reloc stack currently at 64MiB... a 
> 31.5+MiB kernel Image would mess up the data there? (what do we need it 
> for BTW once in U-boot proper after relocation?).

After SPL has jumped to TF-A and U-boot proper any memory used by SPL
can be overwritten/used for something else.

My understanding is as follow:
- SPL always need access to bss
- SPL need access to init stack until it has relocated to reloc stack
- SPL will load FIT images using the reloc stack, at this time only
  SPL code, bss and reloc stack matters
- U-boot proper will use its init stack until it has relocated to end
  of memory. Until U-Boot proper has relocated it will use init stack
- We could use same memory position for init stack for SPL and proper,
  e.g. SPL_SHARES_INIT_SP_ADDR=y without any issue
- After U-Boot proper has relocated we should be free to use @2+ MiB
  up to where U-Boot proper was relocated.

> 
> Side question, what about making those values the default for RK3399 
> instead of having it in each defconfig? This could grow quickly out of 
> hands to move this to the Kconfig symbol itself, so not sure it's that 
> interesting to the project, but raising this anyway.

Agree, was trying to define these as defaults in soc Kconfig, but that
rearranged some values in other defconfigs so I avoided doing that in
this series. Also touching each defconfig helped me ping board
maintainers of the change.

Hopefully a follow-up series can move these, and other options, into
soc Kconfig.

Regards,
Jonas

> 
> Cheers,
> Quentin
Quentin Schulz Feb. 12, 2024, 11:51 a.m. UTC | #3
Hi Jonas,

On 2/12/24 12:08, Jonas Karlman wrote:
> Hi Quentin,
> 
> On 2024-02-12 11:37, Quentin Schulz wrote:
>> Hi Jonas,
>>
>> On 2/12/24 01:59, Jonas Karlman wrote:
>>> With the stack and text base used by U-Boot SPL and proper on RK3399
>>> there is a high likelihood of overlapping when U-Boot proper + FDT nears
>>> 1 MiB in size.
>>>
>>> Currently the following memory layout is used:
>>> - 0x00000000 (@0 MiB): U-Boot SPL text base
>>> - 0x00040000 (@256 KiB): TF-A
>>> - 0x00200000 (@2 MiB): U-Boot proper text base
>>> - 0x00300000 (@3 MiB): U-Boot proper init stack
>>> - 0x00400000 (@4 MiB): U-Boot SPL init stack
>>> - 0x00400000 (@4 MiB): U-Boot SPL bss
>>> - 0x02000000 (@64 MiB): U-Boot SPL reloc stack
>>> - 0x08400000 (@132 MiB): optional OPTEE
>>>
>>> SPL load TF-A, U-Boot proper and optional OPTEE after SPL stack has
>>> relocated, meaning that there is room for close to 2 MiB (@2-4 MiB).
>>> However, the initial stack used by U-Boot proper is limiting the size
>>> of U-Boot proper + FDT to below 1 MiB (@2-3 MiB).
>>>
>>> Instead change to use the following memory layout:
>>> - 0x00000000 (@0 MiB): U-Boot SPL text base
>>> - 0x00040000 (@256 KiB): TF-A
>>> - 0x00200000 (@2 MiB): U-Boot proper text base
>>> - 0x00400000 (@4 MiB): U-Boot SPL init stack
>>> - 0x00800000 (@8 MiB): U-Boot proper init stack (changed)
>>> - 0x02000000 (@32 MiB): U-Boot SPL bss (changed)
>>> - 0x04000000 (@64 MiB): U-Boot SPL reloc stack
>>> - 0x08400000 (@132 MiB): optional OPTEE
>>>
>>> This should leave room for loading and running a U-Boot proper close
>>> to 6 MiB (@2-8 MiB) in size. When U-Boot proper has relocated is should
>>> be possible to use @2-132 MiB and @164 MiB+ for scripts, kernel etc.
>>>
>>> With the moved SPL reloc stack it is also possible to use a much larger
>>> malloc area in SPL, e.g. using default SPL_STACK_R_MALLOC_SIMPLE_LEN.
>>>
>>> Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
>>
>> Do we not need to update memory addresses in the environment as well?
> 
> The addresses in environment is to my knowledge only used in U-Boot
> proper after relocation. And at that time we should be free to use @2+
> MiB up to somewhere close to gd ram_top/relocaddr. The optional Rockchip
> OPTEE blobb may occupy @132-164 MiB, but I do not think loading OPTEE
> blobs works as-is, so that may not be a big issue.
> 

Upstream OP-TEE OS seems to support RK3399, c.f. 
https://github.com/OP-TEE/optee_os/blob/master/core/arch/arm/plat-rockchip/platform_rk3399.c

I cannot say whether it works, I have no knowledge of any of our 
customers using it (but that predates my joining Theobroma, so maybe 
long time customers do use it?). However, we do use an upstream-based 
OP-TEE OS for one of our PX30-based boards, so I would say Rockchip's 
OP-TEE OS is not the only option so we shouldn't just disregard this 
location in RAM... especially since ramdisk_addr_r starts at 96MiB. But 
since we're not changing that location.... people who would have this 
issue, would have encountered the issue by now already (provided they 
load a ramdisk bigger than 36MiB). So let's ignore that one actually :)

> So to my knowledge we do not need to update any of the memory addresses
> in the environment as well.
> 
>>
>> scriptaddr=0x00500000
>>
>> This is at 5MiB if I'm not mistaken?
>>
>> Basically everything in include/configs/rk3399_common.h in
>> ENV_MEM_LAYOUT_SETTINGS needs to be updated to be located after 164MiB?
>>
>> Did I misunderstand something? I find it weird the current values seems
>> to be located after U-Boot SPL bss and that e.g.
>>
>> kernel_addr_r=0x02080000
>>
>> is at 32.5MiB, and with U-Boot SPL reloc stack currently at 64MiB... a
>> 31.5+MiB kernel Image would mess up the data there? (what do we need it
>> for BTW once in U-boot proper after relocation?).
> 
> After SPL has jumped to TF-A and U-boot proper any memory used by SPL
> can be overwritten/used for something else.
> 
> My understanding is as follow:
> - SPL always need access to bss
> - SPL need access to init stack until it has relocated to reloc stack
> - SPL will load FIT images using the reloc stack, at this time only
>    SPL code, bss and reloc stack matters
> - U-boot proper will use its init stack until it has relocated to end
>    of memory. Until U-Boot proper has relocated it will use init stack
> - We could use same memory position for init stack for SPL and proper,
>    e.g. SPL_SHARES_INIT_SP_ADDR=y without any issue
> - After U-Boot proper has relocated we should be free to use @2+ MiB
>    up to where U-Boot proper was relocated.
> 

Not sure how Falcon boot fit in all of this and whether it makes use of 
the environment variable (likely in the SPL binary itself).

Was this from experience and/or is there some literature in U-Boot git 
repo already? Couldn't find much in the 5min I looked for it :)

Thanks for the taking the time to explain this, much appreciated.

>>
>> Side question, what about making those values the default for RK3399
>> instead of having it in each defconfig? This could grow quickly out of
>> hands to move this to the Kconfig symbol itself, so not sure it's that
>> interesting to the project, but raising this anyway.
> 
> Agree, was trying to define these as defaults in soc Kconfig, but that
> rearranged some values in other defconfigs so I avoided doing that in
> this series. Also touching each defconfig helped me ping board
> maintainers of the change.
> 
> Hopefully a follow-up series can move these, and other options, into
> soc Kconfig.
> 

I was more suggesting adding:
"""
diff --git a/Kconfig b/Kconfig
index 00ed1ecc173..b816e536674 100644
--- a/Kconfig
+++ b/Kconfig
@@ -249,6 +249,7 @@ config HAS_CUSTOM_SYS_INIT_SP_ADDR
  config CUSTOM_SYS_INIT_SP_ADDR
  	hex "Static location for the initial stack pointer"
  	depends on HAS_CUSTOM_SYS_INIT_SP_ADDR
+	default 0x800000 if ROCKCHIP_RK3399
  	default TEXT_BASE if TFABOOT

  config SYS_MALLOC_F
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 6405374bcc1..08b71713b79 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -121,6 +121,7 @@ config SPL_BSS_START_ADDR
  	default 0x81f80000 if ARCH_SUNXI && MACH_SUNIV
  	default 0x4ff80000 if ARCH_SUNXI && !(MACH_SUN9I || MACH_SUNIV)
  	default 0x2ff80000 if ARCH_SUNXI && MACH_SUN9I
+	default 0x02000000 if ROCKCHIP_RK3399
  	default 0x1000 if ARCH_ZYNQMP

  choice
"""

So that boards could still override it in defconfigs if they really want 
to. I don't have knowledge of any other way to provide an overridable 
default?

Anyway, a topic for another series, nothing requiring to block this 
series, so:

Reviewed-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>

Thanks,
Quentin
Jerome Forissier Feb. 12, 2024, 1:15 p.m. UTC | #4
On 2/12/24 12:51, Quentin Schulz wrote:
> Hi Jonas,
> 
> On 2/12/24 12:08, Jonas Karlman wrote:
>> Hi Quentin,
>>
>> On 2024-02-12 11:37, Quentin Schulz wrote:
>>> Hi Jonas,
>>>
>>> On 2/12/24 01:59, Jonas Karlman wrote:
>>>> With the stack and text base used by U-Boot SPL and proper on RK3399
>>>> there is a high likelihood of overlapping when U-Boot proper + FDT nears
>>>> 1 MiB in size.
>>>>
>>>> Currently the following memory layout is used:
>>>> - 0x00000000 (@0 MiB): U-Boot SPL text base
>>>> - 0x00040000 (@256 KiB): TF-A
>>>> - 0x00200000 (@2 MiB): U-Boot proper text base
>>>> - 0x00300000 (@3 MiB): U-Boot proper init stack
>>>> - 0x00400000 (@4 MiB): U-Boot SPL init stack
>>>> - 0x00400000 (@4 MiB): U-Boot SPL bss
>>>> - 0x02000000 (@64 MiB): U-Boot SPL reloc stack
>>>> - 0x08400000 (@132 MiB): optional OPTEE
>>>>
>>>> SPL load TF-A, U-Boot proper and optional OPTEE after SPL stack has
>>>> relocated, meaning that there is room for close to 2 MiB (@2-4 MiB).
>>>> However, the initial stack used by U-Boot proper is limiting the size
>>>> of U-Boot proper + FDT to below 1 MiB (@2-3 MiB).
>>>>
>>>> Instead change to use the following memory layout:
>>>> - 0x00000000 (@0 MiB): U-Boot SPL text base
>>>> - 0x00040000 (@256 KiB): TF-A
>>>> - 0x00200000 (@2 MiB): U-Boot proper text base
>>>> - 0x00400000 (@4 MiB): U-Boot SPL init stack
>>>> - 0x00800000 (@8 MiB): U-Boot proper init stack (changed)
>>>> - 0x02000000 (@32 MiB): U-Boot SPL bss (changed)
>>>> - 0x04000000 (@64 MiB): U-Boot SPL reloc stack
>>>> - 0x08400000 (@132 MiB): optional OPTEE
>>>>
>>>> This should leave room for loading and running a U-Boot proper close
>>>> to 6 MiB (@2-8 MiB) in size. When U-Boot proper has relocated is should
>>>> be possible to use @2-132 MiB and @164 MiB+ for scripts, kernel etc.
>>>>
>>>> With the moved SPL reloc stack it is also possible to use a much larger
>>>> malloc area in SPL, e.g. using default SPL_STACK_R_MALLOC_SIMPLE_LEN.
>>>>
>>>> Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
>>>
>>> Do we not need to update memory addresses in the environment as well?
>>
>> The addresses in environment is to my knowledge only used in U-Boot
>> proper after relocation. And at that time we should be free to use @2+
>> MiB up to somewhere close to gd ram_top/relocaddr. The optional Rockchip
>> OPTEE blobb may occupy @132-164 MiB, but I do not think loading OPTEE
>> blobs works as-is, so that may not be a big issue.
>>
> 
> Upstream OP-TEE OS seems to support RK3399, c.f. https://github.com/OP-TEE/optee_os/blob/master/core/arch/arm/plat-rockchip/platform_rk3399.c

It does indeed. I run the quarterly release tests on a RockPi4B. We record which
platforms have been tested in the commit description for each release tag. For
example, see [1].

In the configuration I test, OP-TEE is loaded at 0x30000000 and uses 32MB (for
some reason the Linux DT reserves 36MB but I don't think it matters much).

[1] https://github.com/OP-TEE/optee_os/commit/18b424c23aa5a798dfe2e4d20b4bde3919dc4e99
Jonas Karlman Feb. 12, 2024, 8:49 p.m. UTC | #5
On 2024-02-12 14:15, Jerome Forissier wrote:
> On 2/12/24 12:51, Quentin Schulz wrote:
>> Hi Jonas,
>>
>> On 2/12/24 12:08, Jonas Karlman wrote:
>>> Hi Quentin,
>>>
>>> On 2024-02-12 11:37, Quentin Schulz wrote:
>>>> Hi Jonas,
>>>>
>>>> On 2/12/24 01:59, Jonas Karlman wrote:
>>>>> With the stack and text base used by U-Boot SPL and proper on RK3399
>>>>> there is a high likelihood of overlapping when U-Boot proper + FDT nears
>>>>> 1 MiB in size.
>>>>>
>>>>> Currently the following memory layout is used:
>>>>> - 0x00000000 (@0 MiB): U-Boot SPL text base
>>>>> - 0x00040000 (@256 KiB): TF-A
>>>>> - 0x00200000 (@2 MiB): U-Boot proper text base
>>>>> - 0x00300000 (@3 MiB): U-Boot proper init stack
>>>>> - 0x00400000 (@4 MiB): U-Boot SPL init stack
>>>>> - 0x00400000 (@4 MiB): U-Boot SPL bss
>>>>> - 0x02000000 (@64 MiB): U-Boot SPL reloc stack
>>>>> - 0x08400000 (@132 MiB): optional OPTEE
>>>>>
>>>>> SPL load TF-A, U-Boot proper and optional OPTEE after SPL stack has
>>>>> relocated, meaning that there is room for close to 2 MiB (@2-4 MiB).
>>>>> However, the initial stack used by U-Boot proper is limiting the size
>>>>> of U-Boot proper + FDT to below 1 MiB (@2-3 MiB).
>>>>>
>>>>> Instead change to use the following memory layout:
>>>>> - 0x00000000 (@0 MiB): U-Boot SPL text base
>>>>> - 0x00040000 (@256 KiB): TF-A
>>>>> - 0x00200000 (@2 MiB): U-Boot proper text base
>>>>> - 0x00400000 (@4 MiB): U-Boot SPL init stack
>>>>> - 0x00800000 (@8 MiB): U-Boot proper init stack (changed)
>>>>> - 0x02000000 (@32 MiB): U-Boot SPL bss (changed)
>>>>> - 0x04000000 (@64 MiB): U-Boot SPL reloc stack
>>>>> - 0x08400000 (@132 MiB): optional OPTEE
>>>>>
>>>>> This should leave room for loading and running a U-Boot proper close
>>>>> to 6 MiB (@2-8 MiB) in size. When U-Boot proper has relocated is should
>>>>> be possible to use @2-132 MiB and @164 MiB+ for scripts, kernel etc.
>>>>>
>>>>> With the moved SPL reloc stack it is also possible to use a much larger
>>>>> malloc area in SPL, e.g. using default SPL_STACK_R_MALLOC_SIMPLE_LEN.
>>>>>
>>>>> Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
>>>>
>>>> Do we not need to update memory addresses in the environment as well?
>>>
>>> The addresses in environment is to my knowledge only used in U-Boot
>>> proper after relocation. And at that time we should be free to use @2+
>>> MiB up to somewhere close to gd ram_top/relocaddr. The optional Rockchip
>>> OPTEE blobb may occupy @132-164 MiB, but I do not think loading OPTEE
>>> blobs works as-is, so that may not be a big issue.
>>>
>>
>> Upstream OP-TEE OS seems to support RK3399, c.f. https://github.com/OP-TEE/optee_os/blob/master/core/arch/arm/plat-rockchip/platform_rk3399.c
> 
> It does indeed. I run the quarterly release tests on a RockPi4B. We record which
> platforms have been tested in the commit description for each release tag. For
> example, see [1].
> 
> In the configuration I test, OP-TEE is loaded at 0x30000000 and uses 32MB (for
> some reason the Linux DT reserves 36MB but I don't think it matters much).
> 
> [1] https://github.com/OP-TEE/optee_os/commit/18b424c23aa5a798dfe2e4d20b4bde3919dc4e99
> 

Great, I did a quick test run with OP-TEE on my ROCK 4SE and seem to
work, see short boot log below.

Also good to know that it runs at @768 MiB, we should be able to use
@2-768 MiB for loading kernel, initrd etc in U-Boot proper with open
source OP-TEE.

---
U-Boot SPL 2024.04-rc1 (Feb 12 2024 - 20:39:20 +0000)
Trying to boot from MMC2
## Checking hash(es) for config config-1 ... OK
## Checking hash(es) for Image atf-1 ... sha256+ OK
## Checking hash(es) for Image u-boot ... sha256+ OK
## Checking hash(es) for Image fdt-1 ... sha256+ OK
## Checking hash(es) for Image atf-2 ... sha256+ OK
## Checking hash(es) for Image atf-3 ... sha256+ OK
## Checking hash(es) for Image atf-4 ... sha256+ OK
load_simple_fit: Skip load 'atf-5': image size is 0!
## Checking hash(es) for Image tee-1 ... sha256+ OK
NOTICE:  BL31: v2.10.2(release):
NOTICE:  BL31: Built : 20:23:10, Feb 12 2024
INFO:    GICv3 with legacy support detected.
INFO:    ARM GICv3 driver initialized in EL3
INFO:    Maximum SPI INTID supported: 287
INFO:    plat_rockchip_pmu_init(1624): pd status 3e
INFO:    BL31: Initializing runtime services
INFO:    BL31: Initializing BL32
I/TC:
I/TC: No non-secure external DT
I/TC: OP-TEE version: Unknown_4.1 (gcc version 10.5.0 (Ubuntu 10.5.0-1ubuntu1~22.04)) #2 Mon Feb 12 20:37:33 UTC 2024 aarch64
I/TC: WARNING: This OP-TEE configuration might be insecure!
I/TC: WARNING: Please check https://optee.readthedocs.io/en/latest/architecture/porting_guidelines.html
I/TC: Primary CPU initializing
I/TC: GIC redistributor base address not provided
I/TC: Assuming default GIC group status and modifier
I/TC: Primary CPU switching to normal world boot
INFO:    BL31: Preparing for EL3 exit to normal world
INFO:    Entry point address = 0x200000
INFO:    SPSR = 0x3c9


U-Boot 2024.04-rc1 (Feb 12 2024 - 20:39:20 +0000)

SoC: Rockchip rk3399
Reset cause: POR
Model: Radxa ROCK 4SE
DRAM:  4 GiB (effective 3.9 GiB)
---

Regards,
Jonas
Jonas Karlman Feb. 12, 2024, 9:49 p.m. UTC | #6
Hi Quentin,

On 2024-02-12 12:51, Quentin Schulz wrote:
> Hi Jonas,
> 
> On 2/12/24 12:08, Jonas Karlman wrote:
>> Hi Quentin,
>>
>> On 2024-02-12 11:37, Quentin Schulz wrote:
>>> Hi Jonas,
>>>
>>> On 2/12/24 01:59, Jonas Karlman wrote:
>>>> With the stack and text base used by U-Boot SPL and proper on RK3399
>>>> there is a high likelihood of overlapping when U-Boot proper + FDT nears
>>>> 1 MiB in size.
>>>>
>>>> Currently the following memory layout is used:
>>>> - 0x00000000 (@0 MiB): U-Boot SPL text base
>>>> - 0x00040000 (@256 KiB): TF-A
>>>> - 0x00200000 (@2 MiB): U-Boot proper text base
>>>> - 0x00300000 (@3 MiB): U-Boot proper init stack
>>>> - 0x00400000 (@4 MiB): U-Boot SPL init stack
>>>> - 0x00400000 (@4 MiB): U-Boot SPL bss
>>>> - 0x02000000 (@64 MiB): U-Boot SPL reloc stack
>>>> - 0x08400000 (@132 MiB): optional OPTEE
>>>>
>>>> SPL load TF-A, U-Boot proper and optional OPTEE after SPL stack has
>>>> relocated, meaning that there is room for close to 2 MiB (@2-4 MiB).
>>>> However, the initial stack used by U-Boot proper is limiting the size
>>>> of U-Boot proper + FDT to below 1 MiB (@2-3 MiB).
>>>>
>>>> Instead change to use the following memory layout:
>>>> - 0x00000000 (@0 MiB): U-Boot SPL text base
>>>> - 0x00040000 (@256 KiB): TF-A
>>>> - 0x00200000 (@2 MiB): U-Boot proper text base
>>>> - 0x00400000 (@4 MiB): U-Boot SPL init stack
>>>> - 0x00800000 (@8 MiB): U-Boot proper init stack (changed)
>>>> - 0x02000000 (@32 MiB): U-Boot SPL bss (changed)
>>>> - 0x04000000 (@64 MiB): U-Boot SPL reloc stack
>>>> - 0x08400000 (@132 MiB): optional OPTEE
>>>>
>>>> This should leave room for loading and running a U-Boot proper close
>>>> to 6 MiB (@2-8 MiB) in size. When U-Boot proper has relocated is should
>>>> be possible to use @2-132 MiB and @164 MiB+ for scripts, kernel etc.
>>>>
>>>> With the moved SPL reloc stack it is also possible to use a much larger
>>>> malloc area in SPL, e.g. using default SPL_STACK_R_MALLOC_SIMPLE_LEN.
>>>>
>>>> Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
>>>
>>> Do we not need to update memory addresses in the environment as well?
>>
>> The addresses in environment is to my knowledge only used in U-Boot
>> proper after relocation. And at that time we should be free to use @2+
>> MiB up to somewhere close to gd ram_top/relocaddr. The optional Rockchip
>> OPTEE blobb may occupy @132-164 MiB, but I do not think loading OPTEE
>> blobs works as-is, so that may not be a big issue.
>>
> 
> Upstream OP-TEE OS seems to support RK3399, c.f. 
> https://github.com/OP-TEE/optee_os/blob/master/core/arch/arm/plat-rockchip/platform_rk3399.c
> 
> I cannot say whether it works, I have no knowledge of any of our 
> customers using it (but that predates my joining Theobroma, so maybe 
> long time customers do use it?). However, we do use an upstream-based 
> OP-TEE OS for one of our PX30-based boards, so I would say Rockchip's 
> OP-TEE OS is not the only option so we shouldn't just disregard this 
> location in RAM... especially since ramdisk_addr_r starts at 96MiB. But 
> since we're not changing that location.... people who would have this 
> issue, would have encountered the issue by now already (provided they 
> load a ramdisk bigger than 36MiB). So let's ignore that one actually :)

See my other mail, upstream OP-TEE OS seem to use @768 MiB and should
not cause issues.

Anyone trying to use Rockchip's OP-TEE OS blobs will get an error from
binman, so trying to get that working will already involve customization.

> 
>> So to my knowledge we do not need to update any of the memory addresses
>> in the environment as well.
>>
>>>
>>> scriptaddr=0x00500000
>>>
>>> This is at 5MiB if I'm not mistaken?
>>>
>>> Basically everything in include/configs/rk3399_common.h in
>>> ENV_MEM_LAYOUT_SETTINGS needs to be updated to be located after 164MiB?
>>>
>>> Did I misunderstand something? I find it weird the current values seems
>>> to be located after U-Boot SPL bss and that e.g.
>>>
>>> kernel_addr_r=0x02080000
>>>
>>> is at 32.5MiB, and with U-Boot SPL reloc stack currently at 64MiB... a
>>> 31.5+MiB kernel Image would mess up the data there? (what do we need it
>>> for BTW once in U-boot proper after relocation?).
>>
>> After SPL has jumped to TF-A and U-boot proper any memory used by SPL
>> can be overwritten/used for something else.
>>
>> My understanding is as follow:
>> - SPL always need access to bss
>> - SPL need access to init stack until it has relocated to reloc stack
>> - SPL will load FIT images using the reloc stack, at this time only
>>    SPL code, bss and reloc stack matters
>> - U-boot proper will use its init stack until it has relocated to end
>>    of memory. Until U-Boot proper has relocated it will use init stack
>> - We could use same memory position for init stack for SPL and proper,
>>    e.g. SPL_SHARES_INIT_SP_ADDR=y without any issue
>> - After U-Boot proper has relocated we should be free to use @2+ MiB
>>    up to where U-Boot proper was relocated.
>>
> 
> Not sure how Falcon boot fit in all of this and whether it makes use of 
> the environment variable (likely in the SPL binary itself).

I have never used Falcon boot myself, not sure how to even make Falcon
boot work. Guessing it should work as long as kernel is not loaded to
any offset that is in use by SPL code, bss and reloc stack. Loading to
@64+ MiB should probably be safe.

> 
> Was this from experience and/or is there some literature in U-Boot git 
> repo already? Couldn't find much in the 5min I looked for it :)

This information and insight was all learnt and gathered trying to
understand why trying to boot my ROCK 4SE did not work, yet my ROCK Pi 4
could boot.

Turned out the embedded FDT after u-boot proper overlapped with gd
and/or stack. Activating LOG_DEBUG in malloc_simple.c helped me figure
out what offsets where used at different phases:

TPL uses SRAM as stack and simple malloc area:

  U-Boot TPL 2024.04-rc1 (Feb 12 2024 - 19:41:25)
  size=30, ptr=30, limit=4000: ff8ebff0
  [...]
  size=8, ptr=22c0, limit=4000: ff8ee2a8

SPL initially uses SPL_STACK as stack and simple malloc area:

  Returning to boot ROM...
  size=30, ptr=30, limit=4000: 3fc000
  [...]
  size=8, ptr=15b0, limit=4000: 3fd5a8

Once SPL is loaded it uses SPL_STACK_R_ADDR as stack and malloc area:

  U-Boot SPL 2024.04-rc1 (Feb 12 2024 - 19:41:25 +0000)
  size=a0, ptr=a0, limit=10000: 3ff0000
  [...]
  size=a00, ptr=11c0, limit=10000: aligned to 3ff07c0
  [loading FIT]
  Jumping to U-Boot via ARM Trusted Firmware

U-Boot initially uses CUSTOM_SYS_INIT_SP_ADDR as stack and malloc area:

  INFO:    Entry point address = 0x200000
  INFO:    SPSR = 0x3c9
  size=3c8, ptr=3c8, limit=4000: 7fc000
  [...]
  size=30, ptr=1d80, limit=4000: 7fdd50
  [...]
  U-Boot 2024.04-rc1 (Feb 12 2024 - 19:41:25 +0000)

At this stage U-Boot proper should have fully been relocated.

So a lot of trial and error + guessing + digging into code helped me try
to make sense of above and what different values we can safely use :-)

> 
> Thanks for the taking the time to explain this, much appreciated.
> 
>>>
>>> Side question, what about making those values the default for RK3399
>>> instead of having it in each defconfig? This could grow quickly out of
>>> hands to move this to the Kconfig symbol itself, so not sure it's that
>>> interesting to the project, but raising this anyway.
>>
>> Agree, was trying to define these as defaults in soc Kconfig, but that
>> rearranged some values in other defconfigs so I avoided doing that in
>> this series. Also touching each defconfig helped me ping board
>> maintainers of the change.
>>
>> Hopefully a follow-up series can move these, and other options, into
>> soc Kconfig.
>>
> 
> I was more suggesting adding:
> """
> diff --git a/Kconfig b/Kconfig
> index 00ed1ecc173..b816e536674 100644
> --- a/Kconfig
> +++ b/Kconfig
> @@ -249,6 +249,7 @@ config HAS_CUSTOM_SYS_INIT_SP_ADDR
>   config CUSTOM_SYS_INIT_SP_ADDR
>   	hex "Static location for the initial stack pointer"
>   	depends on HAS_CUSTOM_SYS_INIT_SP_ADDR
> +	default 0x800000 if ROCKCHIP_RK3399
>   	default TEXT_BASE if TFABOOT
> 
>   config SYS_MALLOC_F
> diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> index 6405374bcc1..08b71713b79 100644
> --- a/common/spl/Kconfig
> +++ b/common/spl/Kconfig
> @@ -121,6 +121,7 @@ config SPL_BSS_START_ADDR
>   	default 0x81f80000 if ARCH_SUNXI && MACH_SUNIV
>   	default 0x4ff80000 if ARCH_SUNXI && !(MACH_SUN9I || MACH_SUNIV)
>   	default 0x2ff80000 if ARCH_SUNXI && MACH_SUN9I
> +	default 0x02000000 if ROCKCHIP_RK3399
>   	default 0x1000 if ARCH_ZYNQMP
> 
>   choice
> """
> 
> So that boards could still override it in defconfigs if they really want 
> to. I don't have knowledge of any other way to provide an overridable 
> default?

I was trying to define the defaults similar to how rv1126/Kconfig
currently does it. However, defining a config option with a default that
way may affect the order Kconfig options gets listed in all defconfigs.

Config fragments could possible also be used to define defaults, so I
agree, a topic for another series :-)

Regards,
Jonas

> 
> Anyway, a topic for another series, nothing requiring to block this 
> series, so:
> 
> Reviewed-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> 
> Thanks,
> Quentin
diff mbox series

Patch

diff --git a/configs/chromebook_bob_defconfig b/configs/chromebook_bob_defconfig
index bffa0d33b75c..1fffc8b9e273 100644
--- a/configs/chromebook_bob_defconfig
+++ b/configs/chromebook_bob_defconfig
@@ -6,7 +6,7 @@  CONFIG_TEXT_BASE=0x00200000
 CONFIG_SPL_GPIO=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_SF_DEFAULT_SPEED=20000000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-gru-bob"
diff --git a/configs/chromebook_kevin_defconfig b/configs/chromebook_kevin_defconfig
index e14fc358c504..c9ffd3d60dd3 100644
--- a/configs/chromebook_kevin_defconfig
+++ b/configs/chromebook_kevin_defconfig
@@ -6,7 +6,7 @@  CONFIG_TEXT_BASE=0x00200000
 CONFIG_SPL_GPIO=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_SF_DEFAULT_SPEED=20000000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-gru-kevin"
diff --git a/configs/eaidk-610-rk3399_defconfig b/configs/eaidk-610-rk3399_defconfig
index 22ad98b95ad3..d6ba6f74b5b5 100644
--- a/configs/eaidk-610-rk3399_defconfig
+++ b/configs/eaidk-610-rk3399_defconfig
@@ -5,7 +5,7 @@  CONFIG_ARCH_ROCKCHIP=y
 CONFIG_TEXT_BASE=0x00200000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-eaidk-610"
 CONFIG_ROCKCHIP_RK3399=y
@@ -20,7 +20,7 @@  CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x2e000
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x400000
+CONFIG_SPL_BSS_START_ADDR=0x2000000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
diff --git a/configs/evb-rk3399_defconfig b/configs/evb-rk3399_defconfig
index 698991e51bde..29ee9d229f7d 100644
--- a/configs/evb-rk3399_defconfig
+++ b/configs/evb-rk3399_defconfig
@@ -5,7 +5,7 @@  CONFIG_ARCH_ROCKCHIP=y
 CONFIG_TEXT_BASE=0x00200000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_SF_DEFAULT_SPEED=20000000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-evb"
@@ -22,7 +22,7 @@  CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x2e000
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x400000
+CONFIG_SPL_BSS_START_ADDR=0x2000000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
diff --git a/configs/ficus-rk3399_defconfig b/configs/ficus-rk3399_defconfig
index d214f635dc65..edd111e08675 100644
--- a/configs/ficus-rk3399_defconfig
+++ b/configs/ficus-rk3399_defconfig
@@ -4,7 +4,7 @@  CONFIG_COUNTER_FREQUENCY=24000000
 CONFIG_ARCH_ROCKCHIP=y
 CONFIG_TEXT_BASE=0x00200000
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_SF_DEFAULT_SPEED=20000000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-ficus"
diff --git a/configs/firefly-rk3399_defconfig b/configs/firefly-rk3399_defconfig
index b01b1a327896..100bf88d3a99 100644
--- a/configs/firefly-rk3399_defconfig
+++ b/configs/firefly-rk3399_defconfig
@@ -5,7 +5,7 @@  CONFIG_ARCH_ROCKCHIP=y
 CONFIG_TEXT_BASE=0x00200000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_SF_DEFAULT_SPEED=20000000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-firefly"
@@ -23,7 +23,7 @@  CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x2e000
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x400000
+CONFIG_SPL_BSS_START_ADDR=0x2000000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
diff --git a/configs/khadas-edge-captain-rk3399_defconfig b/configs/khadas-edge-captain-rk3399_defconfig
index 9d59d28164d6..99856789aa36 100644
--- a/configs/khadas-edge-captain-rk3399_defconfig
+++ b/configs/khadas-edge-captain-rk3399_defconfig
@@ -5,7 +5,7 @@  CONFIG_ARCH_ROCKCHIP=y
 CONFIG_TEXT_BASE=0x00200000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-khadas-edge-captain"
 CONFIG_ROCKCHIP_RK3399=y
@@ -21,7 +21,7 @@  CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x2e000
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x400000
+CONFIG_SPL_BSS_START_ADDR=0x2000000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
diff --git a/configs/khadas-edge-rk3399_defconfig b/configs/khadas-edge-rk3399_defconfig
index 9de8a53c1aea..68cd642ced25 100644
--- a/configs/khadas-edge-rk3399_defconfig
+++ b/configs/khadas-edge-rk3399_defconfig
@@ -5,7 +5,7 @@  CONFIG_ARCH_ROCKCHIP=y
 CONFIG_TEXT_BASE=0x00200000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-khadas-edge"
 CONFIG_ROCKCHIP_RK3399=y
@@ -21,7 +21,7 @@  CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x2e000
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x400000
+CONFIG_SPL_BSS_START_ADDR=0x2000000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
diff --git a/configs/khadas-edge-v-rk3399_defconfig b/configs/khadas-edge-v-rk3399_defconfig
index 72e1653ed151..1f9eef1d379e 100644
--- a/configs/khadas-edge-v-rk3399_defconfig
+++ b/configs/khadas-edge-v-rk3399_defconfig
@@ -5,7 +5,7 @@  CONFIG_ARCH_ROCKCHIP=y
 CONFIG_TEXT_BASE=0x00200000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-khadas-edge-v"
 CONFIG_ROCKCHIP_RK3399=y
@@ -21,7 +21,7 @@  CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x2e000
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x400000
+CONFIG_SPL_BSS_START_ADDR=0x2000000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
diff --git a/configs/leez-rk3399_defconfig b/configs/leez-rk3399_defconfig
index 76dd91911c7c..f6958c96f8be 100644
--- a/configs/leez-rk3399_defconfig
+++ b/configs/leez-rk3399_defconfig
@@ -5,7 +5,7 @@  CONFIG_ARCH_ROCKCHIP=y
 CONFIG_TEXT_BASE=0x00200000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-leez-p710"
 CONFIG_ROCKCHIP_RK3399=y
@@ -20,7 +20,7 @@  CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x2e000
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x400000
+CONFIG_SPL_BSS_START_ADDR=0x2000000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_SPL_STACK_R=y
diff --git a/configs/nanopc-t4-rk3399_defconfig b/configs/nanopc-t4-rk3399_defconfig
index c18e7b1bd169..04ff74202d6a 100644
--- a/configs/nanopc-t4-rk3399_defconfig
+++ b/configs/nanopc-t4-rk3399_defconfig
@@ -5,7 +5,7 @@  CONFIG_ARCH_ROCKCHIP=y
 CONFIG_TEXT_BASE=0x00200000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-nanopc-t4"
 CONFIG_DM_RESET=y
@@ -22,7 +22,7 @@  CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x2e000
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x400000
+CONFIG_SPL_BSS_START_ADDR=0x2000000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
diff --git a/configs/nanopi-m4-2gb-rk3399_defconfig b/configs/nanopi-m4-2gb-rk3399_defconfig
index e3bdbccccbec..f06e8c9b77c3 100644
--- a/configs/nanopi-m4-2gb-rk3399_defconfig
+++ b/configs/nanopi-m4-2gb-rk3399_defconfig
@@ -5,7 +5,7 @@  CONFIG_ARCH_ROCKCHIP=y
 CONFIG_TEXT_BASE=0x00200000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-nanopi-m4-2gb"
 CONFIG_ROCKCHIP_RK3399=y
@@ -20,7 +20,7 @@  CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x2e000
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x400000
+CONFIG_SPL_BSS_START_ADDR=0x2000000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
diff --git a/configs/nanopi-m4-rk3399_defconfig b/configs/nanopi-m4-rk3399_defconfig
index e51e51c8cf5c..355054a17e93 100644
--- a/configs/nanopi-m4-rk3399_defconfig
+++ b/configs/nanopi-m4-rk3399_defconfig
@@ -5,7 +5,7 @@  CONFIG_ARCH_ROCKCHIP=y
 CONFIG_TEXT_BASE=0x00200000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-nanopi-m4"
 CONFIG_ROCKCHIP_RK3399=y
@@ -20,7 +20,7 @@  CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x2e000
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x400000
+CONFIG_SPL_BSS_START_ADDR=0x2000000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
diff --git a/configs/nanopi-m4b-rk3399_defconfig b/configs/nanopi-m4b-rk3399_defconfig
index ca57c7f81a51..7e6278c2854f 100644
--- a/configs/nanopi-m4b-rk3399_defconfig
+++ b/configs/nanopi-m4b-rk3399_defconfig
@@ -5,7 +5,7 @@  CONFIG_ARCH_ROCKCHIP=y
 CONFIG_TEXT_BASE=0x00200000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-nanopi-m4b"
 CONFIG_ROCKCHIP_RK3399=y
@@ -20,7 +20,7 @@  CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x2e000
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x400000
+CONFIG_SPL_BSS_START_ADDR=0x2000000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
diff --git a/configs/nanopi-neo4-rk3399_defconfig b/configs/nanopi-neo4-rk3399_defconfig
index 02e7f4e2ecb7..11cdc8381ce4 100644
--- a/configs/nanopi-neo4-rk3399_defconfig
+++ b/configs/nanopi-neo4-rk3399_defconfig
@@ -5,7 +5,7 @@  CONFIG_ARCH_ROCKCHIP=y
 CONFIG_TEXT_BASE=0x00200000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-nanopi-neo4"
 CONFIG_ROCKCHIP_RK3399=y
@@ -20,7 +20,7 @@  CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x2e000
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x400000
+CONFIG_SPL_BSS_START_ADDR=0x2000000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
diff --git a/configs/nanopi-r4s-rk3399_defconfig b/configs/nanopi-r4s-rk3399_defconfig
index 80c05d04005b..9d0075a9da1c 100644
--- a/configs/nanopi-r4s-rk3399_defconfig
+++ b/configs/nanopi-r4s-rk3399_defconfig
@@ -5,7 +5,7 @@  CONFIG_ARCH_ROCKCHIP=y
 CONFIG_TEXT_BASE=0x00200000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-nanopi-r4s"
 CONFIG_ROCKCHIP_RK3399=y
@@ -20,7 +20,7 @@  CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x2e000
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x400000
+CONFIG_SPL_BSS_START_ADDR=0x2000000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
diff --git a/configs/orangepi-rk3399_defconfig b/configs/orangepi-rk3399_defconfig
index 27add8a29b92..64da9312a4a4 100644
--- a/configs/orangepi-rk3399_defconfig
+++ b/configs/orangepi-rk3399_defconfig
@@ -5,7 +5,7 @@  CONFIG_ARCH_ROCKCHIP=y
 CONFIG_TEXT_BASE=0x00200000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-orangepi"
 CONFIG_ROCKCHIP_RK3399=y
@@ -20,7 +20,7 @@  CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x2e000
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x400000
+CONFIG_SPL_BSS_START_ADDR=0x2000000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
diff --git a/configs/pinebook-pro-rk3399_defconfig b/configs/pinebook-pro-rk3399_defconfig
index 6b83daf07945..3d787d0c79ad 100644
--- a/configs/pinebook-pro-rk3399_defconfig
+++ b/configs/pinebook-pro-rk3399_defconfig
@@ -5,7 +5,7 @@  CONFIG_ARCH_ROCKCHIP=y
 CONFIG_TEXT_BASE=0x00200000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_SF_DEFAULT_SPEED=20000000
 CONFIG_ENV_SIZE=0x8000
 CONFIG_ENV_OFFSET=0x3F8000
@@ -29,7 +29,7 @@  CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x400000
+CONFIG_SPL_BSS_START_ADDR=0x2000000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
diff --git a/configs/pinephone-pro-rk3399_defconfig b/configs/pinephone-pro-rk3399_defconfig
index 96316c4b303f..e185e11243e2 100644
--- a/configs/pinephone-pro-rk3399_defconfig
+++ b/configs/pinephone-pro-rk3399_defconfig
@@ -5,7 +5,7 @@  CONFIG_ARCH_ROCKCHIP=y
 CONFIG_TEXT_BASE=0x00200000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_SF_DEFAULT_SPEED=20000000
 CONFIG_ENV_SIZE=0x8000
 CONFIG_ENV_OFFSET=0x3F8000
@@ -28,7 +28,7 @@  CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x400000
+CONFIG_SPL_BSS_START_ADDR=0x2000000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
diff --git a/configs/puma-rk3399_defconfig b/configs/puma-rk3399_defconfig
index f39d352c7890..ec5ef89fcf42 100644
--- a/configs/puma-rk3399_defconfig
+++ b/configs/puma-rk3399_defconfig
@@ -6,7 +6,7 @@  CONFIG_TEXT_BASE=0x00200000
 CONFIG_SPL_GPIO=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_SF_DEFAULT_SPEED=20000000
 CONFIG_ENV_SIZE=0x3000
 CONFIG_ENV_OFFSET=0x3F8000
diff --git a/configs/roc-pc-mezzanine-rk3399_defconfig b/configs/roc-pc-mezzanine-rk3399_defconfig
index 64103eada8cf..423d11d2945f 100644
--- a/configs/roc-pc-mezzanine-rk3399_defconfig
+++ b/configs/roc-pc-mezzanine-rk3399_defconfig
@@ -6,7 +6,7 @@  CONFIG_TEXT_BASE=0x00200000
 CONFIG_SPL_GPIO=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_ENV_SIZE=0x8000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_ENV_SECT_SIZE=0x1000
@@ -29,7 +29,7 @@  CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x400000
+CONFIG_SPL_BSS_START_ADDR=0x2000000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
diff --git a/configs/roc-pc-rk3399_defconfig b/configs/roc-pc-rk3399_defconfig
index 61991e8868b3..bfb786ef937b 100644
--- a/configs/roc-pc-rk3399_defconfig
+++ b/configs/roc-pc-rk3399_defconfig
@@ -6,7 +6,7 @@  CONFIG_TEXT_BASE=0x00200000
 CONFIG_SPL_GPIO=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_SF_DEFAULT_SPEED=30000000
 CONFIG_ENV_SIZE=0x8000
 CONFIG_ENV_OFFSET=0x3F8000
@@ -30,7 +30,7 @@  CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x400000
+CONFIG_SPL_BSS_START_ADDR=0x2000000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
diff --git a/configs/rock-4c-plus-rk3399_defconfig b/configs/rock-4c-plus-rk3399_defconfig
index 86a64d191e13..93b92efcdf0e 100644
--- a/configs/rock-4c-plus-rk3399_defconfig
+++ b/configs/rock-4c-plus-rk3399_defconfig
@@ -5,7 +5,7 @@  CONFIG_ARCH_ROCKCHIP=y
 CONFIG_TEXT_BASE=0x00200000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-4c-plus"
 CONFIG_OF_LIBFDT_OVERLAY=y
@@ -24,7 +24,7 @@  CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x2e000
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x400000
+CONFIG_SPL_BSS_START_ADDR=0x2000000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
diff --git a/configs/rock-4se-rk3399_defconfig b/configs/rock-4se-rk3399_defconfig
index e3a2d5eeb180..21a48a1bebb8 100644
--- a/configs/rock-4se-rk3399_defconfig
+++ b/configs/rock-4se-rk3399_defconfig
@@ -5,7 +5,7 @@  CONFIG_ARCH_ROCKCHIP=y
 CONFIG_TEXT_BASE=0x00200000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-4se"
 CONFIG_OF_LIBFDT_OVERLAY=y
@@ -26,7 +26,7 @@  CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x2e000
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x400000
+CONFIG_SPL_BSS_START_ADDR=0x2000000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
diff --git a/configs/rock-pi-4-rk3399_defconfig b/configs/rock-pi-4-rk3399_defconfig
index 7986e07ee108..2a6ebed4b617 100644
--- a/configs/rock-pi-4-rk3399_defconfig
+++ b/configs/rock-pi-4-rk3399_defconfig
@@ -5,7 +5,7 @@  CONFIG_ARCH_ROCKCHIP=y
 CONFIG_TEXT_BASE=0x00200000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-pi-4a"
 CONFIG_OF_LIBFDT_OVERLAY=y
@@ -26,7 +26,7 @@  CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x2e000
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x400000
+CONFIG_SPL_BSS_START_ADDR=0x2000000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
diff --git a/configs/rock-pi-4c-rk3399_defconfig b/configs/rock-pi-4c-rk3399_defconfig
index f96f24a150c0..89641e8d6122 100644
--- a/configs/rock-pi-4c-rk3399_defconfig
+++ b/configs/rock-pi-4c-rk3399_defconfig
@@ -5,7 +5,7 @@  CONFIG_ARCH_ROCKCHIP=y
 CONFIG_TEXT_BASE=0x00200000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock-pi-4c"
 CONFIG_OF_LIBFDT_OVERLAY=y
@@ -24,7 +24,7 @@  CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x2e000
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x400000
+CONFIG_SPL_BSS_START_ADDR=0x2000000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
diff --git a/configs/rock-pi-n10-rk3399pro_defconfig b/configs/rock-pi-n10-rk3399pro_defconfig
index 9a8beaa81ddf..31f3623bea0b 100644
--- a/configs/rock-pi-n10-rk3399pro_defconfig
+++ b/configs/rock-pi-n10-rk3399pro_defconfig
@@ -6,7 +6,7 @@  CONFIG_TEXT_BASE=0x00200000
 CONFIG_SPL_GPIO=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399pro-rock-pi-n10"
 CONFIG_DM_RESET=y
@@ -25,7 +25,7 @@  CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x2e000
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x400000
+CONFIG_SPL_BSS_START_ADDR=0x2000000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
diff --git a/configs/rock960-rk3399_defconfig b/configs/rock960-rk3399_defconfig
index 80b41b061bdb..03cf74cfbf56 100644
--- a/configs/rock960-rk3399_defconfig
+++ b/configs/rock960-rk3399_defconfig
@@ -4,7 +4,7 @@  CONFIG_COUNTER_FREQUENCY=24000000
 CONFIG_ARCH_ROCKCHIP=y
 CONFIG_TEXT_BASE=0x00200000
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-rock960"
 CONFIG_DM_RESET=y
@@ -23,7 +23,7 @@  CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x2e000
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x400000
+CONFIG_SPL_BSS_START_ADDR=0x2000000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
diff --git a/configs/rockpro64-rk3399_defconfig b/configs/rockpro64-rk3399_defconfig
index c37d858c2c66..e67a5ccba940 100644
--- a/configs/rockpro64-rk3399_defconfig
+++ b/configs/rockpro64-rk3399_defconfig
@@ -5,7 +5,7 @@  CONFIG_ARCH_ROCKCHIP=y
 CONFIG_TEXT_BASE=0x00200000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_ENV_SIZE=0x8000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-rockpro64"
@@ -31,7 +31,7 @@  CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
 CONFIG_SPL_PAD_TO=0x7f8000
 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0x400000
+CONFIG_SPL_BSS_START_ADDR=0x2000000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set