[U-Boot] [PATCH v3 1/2] armv8: Support loading 32-bit OS in AArch32 execution state

Huan Wang alison.wang at nxp.com
Fri Jun 3 05:10:37 CEST 2016


Hi, York,

> On 05/26/2016 01:51 AM, Alison Wang wrote:
> > To support loading a 32-bit OS, the execution state will change from
> > AArch64 to AArch32 when jumping to kernel.
> >
> > The architecture information will be got through checking FIT image,
> > then U-Boot will load 32-bit OS or 64-bit OS automatically.
> >
> > Signed-off-by: Ebony Zhu <ebony.zhu at nxp.com>
> > Signed-off-by: Alison Wang <alison.wang at nxp.com>
> > Signed-off-by: Chenhui Zhao <chenhui.zhao at nxp.com>
> > ---
> > Changes in v3:
> > - Comments the functions and the arguments.
> > - Rename the real parameters.
> > - Use the macros instead of the magic values.
> > - Remove the redundant codes.
> > - Clean up all of the mess in boot_jump_linux().
> > - Add CONFIG_ARM64_SUPPORT_AARCH32 to detect for some ARM64 system
> doesn't support AArch32 state.
> >
> > Changes in v2:
> > - armv8_switch_to_el2_aarch32() is removed. armv8_switch_to_el2_m is
> used
> >   to switch to AArch64 EL2 or AArch32 Hyp.
> > - armv8_switch_to_el1_aarch32() is removed. armv8_switch_to_el1_m is
> used
> >   to switch to AArch64 EL1 or AArch32 SVC.
> >
> >  arch/arm/Kconfig                |   6 ++
> >  arch/arm/cpu/armv8/transition.S |   8 +-
> >  arch/arm/include/asm/macro.h    | 174 ++++++++++++++++++++++++++++++-
> ---------
> >  arch/arm/include/asm/system.h   | 118 ++++++++++++++++++++++++++-
> >  arch/arm/lib/bootm.c            |  19 ++++-
> >  common/image-fit.c              |  14 +++-
> >  6 files changed, 287 insertions(+), 52 deletions(-)
> >
> > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index
> > 729b181..794cb4f 100644
> > --- a/arch/arm/Kconfig
> > +++ b/arch/arm/Kconfig
> > @@ -77,6 +77,12 @@ config SYS_L2CACHE_OFF
> >  	  If SoC does not support L2CACHE or one do not want to enable
> >  	  L2CACHE, choose this option.
> >
> > +config ARM64_SUPPORT_AARCH32
> > +	bool "ARM64 system support AArch32 execution state"
> > +	default y if ARM64 && !CONFIG_THUNDERX
> > +	help
> > +	  This ARM64 system supports AArch32 execution state.
> > +
> >  choice
> >  	prompt "Target select"
> >  	default TARGET_HIKEY
> > diff --git a/arch/arm/cpu/armv8/transition.S
> > b/arch/arm/cpu/armv8/transition.S index 253a39b..417e8b4 100644
> > --- a/arch/arm/cpu/armv8/transition.S
> > +++ b/arch/arm/cpu/armv8/transition.S
> > @@ -11,13 +11,13 @@
> >  #include <asm/macro.h>
> >
> >  ENTRY(armv8_switch_to_el2)
> > -	switch_el x0, 1f, 0f, 0f
> > +	switch_el x4, 1f, 0f, 0f
> >  0:	ret
> > -1:	armv8_switch_to_el2_m x0
> > +1:	armv8_switch_to_el2_m x0, x1, x2, x3, x4
> >  ENDPROC(armv8_switch_to_el2)
> 
> Alison,
> 
> I see you are chaning macro armv8_switch_to_el2. You may have missed one
> in start.S. This is the code you can't test with our ARMv8 chip.
> 
[Alison Wang] Yes, I missed that one. In start.S, armv8_switch_to_el2 will
be called for secondary cores. I will set argument x3 as ES_TO_AARCH64 for
it. As the way to notice secondary cores about the architecture of OS may
be different for other ARMv8 chips, I will not add ES_TO_AARCH32 in start.S.
Do you agree?

Thanks for your reminder.

Best Regards,
Alison Wang


More information about the U-Boot mailing list