[PATCH 1/8] common: spl: spl: Update stack pointer address

Tom Rini trini at konsulko.com
Fri Jun 2 17:50:11 CEST 2023


On Fri, May 12, 2023 at 01:39:29PM +0530, Devarsh Thakkar wrote:
> Hi Nikhil, Vignesh, Tom,
> 
> Nikhil,
> Thanks for the patch.
> 
> On 11/05/23 15:29, Nikhil M Jain wrote:
> 
> I think more apt subject would be "Update stack pointer after relocation"
> > At SPL stage when stack is relocated, the stack pointer needs to be
> > updated, 
> 
> since
> the stack pointer may point to stack in on chip memory even
> > though stack is relocated.
> > 
> > Signed-off-by: Nikhil M Jain <n-jain1 at ti.com>
> > ---
> >  common/spl/spl.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/common/spl/spl.c b/common/spl/spl.c
> > index 72078a8ebc..206caf4f8b 100644
> > --- a/common/spl/spl.c
> > +++ b/common/spl/spl.c
> > @@ -992,6 +992,7 @@ ulong spl_relocate_stack_gd(void)
> >  #endif
> >  	/* Get stack position: use 8-byte alignment for ABI compliance */
> >  	ptr = CONFIG_SPL_STACK_R_ADDR - roundup(sizeof(gd_t),16);
> > +	gd->start_addr_sp = ptr;
> >  	new_gd = (gd_t *)ptr;
> 
> Seems to me you are setting gd->start_addr_sp to new gd's base address, are
> they both supposed to be same ?
> 
> Vignesh, Tom,
> 
> Could you please have a look at this patch and comment ? Does the caller of
> this function need to set gd->start_addr_sp or it's ok to set in here only?

This seems a fine enough place to do it in SPL, yes.

-- 
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/20230602/444bd515/attachment.sig>


More information about the U-Boot mailing list