Message ID | 20210901075602.17345-1-patrice.chotard@foss.st.com |
---|---|
State | Accepted |
Commit | c8510e397fad4056619d2dab6f2b61c48766a239 |
Delegated to: | Patrick Delaunay |
Headers | show |
Series | stm32mp: Fix board_get_usable_ram_top() | expand |
Hi Patrice, On 9/1/21 9:56 AM, Patrice Chotard wrote: > When booting in EFI, lib/efi_loader/efi_memory.c calls > board_get_usable_ram_top(0) which returns by default > gd->ram_base + gd->ram_size which is the top of DDR. > > In case of OPTEE boot, the top of DDR is currently reserved by OPTEE, > board_get_usable_ram_top(0) must return an address outside OPTEE > reserved memory. > > gd->ram_top matches this constraint as it has already been initialized > by substracting all DT reserved-memory (included OPTEE memory area). > > Fixes: 92b611e8b003 ("stm32mp: correctly handle board_get_usable_ram_top(0)") > > Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> > --- > > arch/arm/mach-stm32mp/dram_init.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm/mach-stm32mp/dram_init.c b/arch/arm/mach-stm32mp/dram_init.c > index 94f25f34e0..920b99bb68 100644 > --- a/arch/arm/mach-stm32mp/dram_init.c > +++ b/arch/arm/mach-stm32mp/dram_init.c > @@ -47,7 +47,7 @@ ulong board_get_usable_ram_top(ulong total_size) > struct lmb lmb; > > if (!total_size) > - return gd->ram_base + gd->ram_size; > + return gd->ram_top; > > /* found enough not-reserved memory to relocated U-Boot */ > lmb_init(&lmb); > Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Thanks Patrick
Hi Patrice, On 9/1/21 9:56 AM, Patrice Chotard wrote: > When booting in EFI, lib/efi_loader/efi_memory.c calls > board_get_usable_ram_top(0) which returns by default > gd->ram_base + gd->ram_size which is the top of DDR. > > In case of OPTEE boot, the top of DDR is currently reserved by OPTEE, > board_get_usable_ram_top(0) must return an address outside OPTEE > reserved memory. > > gd->ram_top matches this constraint as it has already been initialized > by substracting all DT reserved-memory (included OPTEE memory area). > > Fixes: 92b611e8b003 ("stm32mp: correctly handle board_get_usable_ram_top(0)") > > Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> > --- > > arch/arm/mach-stm32mp/dram_init.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > Applied to u-boot-stm/master, thanks! Regards Patrick
diff --git a/arch/arm/mach-stm32mp/dram_init.c b/arch/arm/mach-stm32mp/dram_init.c index 94f25f34e0..920b99bb68 100644 --- a/arch/arm/mach-stm32mp/dram_init.c +++ b/arch/arm/mach-stm32mp/dram_init.c @@ -47,7 +47,7 @@ ulong board_get_usable_ram_top(ulong total_size) struct lmb lmb; if (!total_size) - return gd->ram_base + gd->ram_size; + return gd->ram_top; /* found enough not-reserved memory to relocated U-Boot */ lmb_init(&lmb);
When booting in EFI, lib/efi_loader/efi_memory.c calls board_get_usable_ram_top(0) which returns by default gd->ram_base + gd->ram_size which is the top of DDR. In case of OPTEE boot, the top of DDR is currently reserved by OPTEE, board_get_usable_ram_top(0) must return an address outside OPTEE reserved memory. gd->ram_top matches this constraint as it has already been initialized by substracting all DT reserved-memory (included OPTEE memory area). Fixes: 92b611e8b003 ("stm32mp: correctly handle board_get_usable_ram_top(0)") Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> --- arch/arm/mach-stm32mp/dram_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)