Message ID | 20211013095445.18428-2-peng.fan@oss.nxp.com |
---|---|
State | Deferred |
Delegated to: | Tom Rini |
Headers | show |
Series | [1/2] board_f: fix use of GD_FLG_SKIP_RELOC | expand |
Hi Peng, On Wed, 13 Oct 2021 at 03:18, Peng Fan (OSS) <peng.fan@oss.nxp.com> wrote: > > From: Peng Fan <peng.fan@nxp.com> > > U-Boot binary is quite large with more options enabled, it not hurt > on real silicon with high performance. But on simulation platform, > it is quite slow to relocate the U-Boot binary to new address, > so let's support skipping relocation. > > Users could use 'gd->flags |= GD_FLG_SKIP_RELOC;' in board_early_init_f > or other place that early than relocate_code. > > Signed-off-by: Peng Fan <peng.fan@nxp.com> > --- > arch/arm/lib/crt0_64.S | 6 ++++++ > 1 file changed, 6 insertions(+) Reviewed-by: Simon Glass <sjg@chromium.org> > > diff --git a/arch/arm/lib/crt0_64.S b/arch/arm/lib/crt0_64.S > index 680e674fa3..d57ca84ee4 100644 > --- a/arch/arm/lib/crt0_64.S > +++ b/arch/arm/lib/crt0_64.S > @@ -12,6 +12,7 @@ > #include <config.h> > #include <asm-offsets.h> > #include <asm/macro.h> > +#include <asm-generic/global_data.h> > #include <linux/linkage.h> > > /* > @@ -95,6 +96,7 @@ ENTRY(_main) > bl board_init_f > > #if !defined(CONFIG_SPL_BUILD) > + ldr x1, [x18, #GD_FLAGS] > /* > * Set up intermediate environment (new sp and gd) and call > * relocate_code(addr_moni). Trick here is that we'll return > @@ -122,6 +124,10 @@ ENTRY(_main) > ldr x9, [x18, #GD_RELOC_OFF] /* x9 <- gd->reloc_off */ > add lr, lr, x9 /* new return address after relocation */ > ldr x0, [x18, #GD_RELOCADDR] /* x0 <- gd->relocaddr */ > + > + tst x1, #GD_FLG_SKIP_RELOC > + bne relocation_return Could we document this feature somewhere, or add a comment here as to why this is useful? > + > b relocate_code > > relocation_return: > -- > 2.30.0 > Regards, SImon
diff --git a/arch/arm/lib/crt0_64.S b/arch/arm/lib/crt0_64.S index 680e674fa3..d57ca84ee4 100644 --- a/arch/arm/lib/crt0_64.S +++ b/arch/arm/lib/crt0_64.S @@ -12,6 +12,7 @@ #include <config.h> #include <asm-offsets.h> #include <asm/macro.h> +#include <asm-generic/global_data.h> #include <linux/linkage.h> /* @@ -95,6 +96,7 @@ ENTRY(_main) bl board_init_f #if !defined(CONFIG_SPL_BUILD) + ldr x1, [x18, #GD_FLAGS] /* * Set up intermediate environment (new sp and gd) and call * relocate_code(addr_moni). Trick here is that we'll return @@ -122,6 +124,10 @@ ENTRY(_main) ldr x9, [x18, #GD_RELOC_OFF] /* x9 <- gd->reloc_off */ add lr, lr, x9 /* new return address after relocation */ ldr x0, [x18, #GD_RELOCADDR] /* x0 <- gd->relocaddr */ + + tst x1, #GD_FLG_SKIP_RELOC + bne relocation_return + b relocate_code relocation_return: