[PATCH 3/6] board: ti: am62x: Avoid overwriting reserve mem for AM62 SIP

Tom Rini trini at konsulko.com
Wed Nov 8 14:18:44 CET 2023


On Wed, Nov 08, 2023 at 03:43:03PM +0530, Nitin Yadav wrote:
> 
> 
> On 31/10/23 19:25, Tom Rini wrote:
> > On Tue, Oct 31, 2023 at 06:58:06PM +0530, Nitin Yadav wrote:
> >> AM62 SIP has 512MB RAM. But the top of the RAM is reserved for
> >> TF-A and OPTEE. U-Boot relocating there would cause overwriting
> >> of these reserved regions. Fix this by limit U-Boot to first
> >> 64MB of RAM for all boards with 512MB.
> >>
> >> Signed-off-by: Vignesh Raghavendra <vigneshr at ti.com>
> >> Signed-off-by: Nitin Yadav <n-yadav at ti.com>
> >> ---
> >>  board/ti/am62x/evm.c | 11 +++++++++++
> >>  1 file changed, 11 insertions(+)
> >>
> >> diff --git a/board/ti/am62x/evm.c b/board/ti/am62x/evm.c
> >> index ad93908840..ad3e415592 100644
> >> --- a/board/ti/am62x/evm.c
> >> +++ b/board/ti/am62x/evm.c
> >> @@ -18,6 +18,7 @@
> >>  #include <asm/io.h>
> >>  #include <asm/arch/hardware.h>
> >>  #include <dm/uclass.h>
> >> +#include <linux/sizes.h>
> >>  
> >>  DECLARE_GLOBAL_DATA_PTR;
> >>  
> >> @@ -59,6 +60,16 @@ int dram_init_banksize(void)
> >>  	return fdtdec_setup_memory_banksize();
> >>  }
> >>  
> >> +phys_size_t get_effective_memsize(void)
> >> +{
> >> +	/*
> >> +	* Just below 512MB are TF-A and OPTEE reserve regions, thus
> >> +	* SPL/U-Boot RAM has to start below that. Leave 64MB space for
> >> +	* all reserved memories.
> >> +	*/
> >> +	return gd->ram_size == SZ_512M ? SZ_512M - SZ_64M : gd->ram_size;
> >> +}
> > 
> > Where are TF-A and OPTEE in other cases? Are we not able to read the
> > reserved memory nodes and handle this through that?
>
> This is first Board where we have 512M of RAM, Others have 2GB of RAM.
> That's why we are reserving this space.

And how is this reservation being communicated / documented ? Why do we
need something different here, when we don't on 2GB of memory? The
normal case is U-Boot goes and plays around at the top of memory, so
there should be something happening in that previous case, where is it /
why isn't it something that works here?

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20231108/581e7c61/attachment.sig>


More information about the U-Boot mailing list