Message ID | 20190221013034.9099-7-andre.przywara@arm.com |
---|---|
State | Deferred |
Delegated to: | Jagannadha Sutradharudu Teki |
Headers | show |
Series | sunxi: Allow FEL capable SPLs with 32bit builds | expand |
On 21.02.19 02:30, Andre Przywara wrote: > At the moment we build the SPL and U-Boot proper for the 64-bit AArch64 > instruction set. But since the cores provide an AArch32 compatibility mode > and in fact the BootROM runs in 32-bit mode, it can be useful to have at > least the SPL run in AArch32 as well. This has two advantages: > - As AArch32 features the compact Thumb2 instruction encoding, we can > get a much smaller image size, which is a relief for our SPL. > - Staying in AArch32, with the MMU turned off, allows an easy return to > the BootROM and its FEL mode. This enables FEL booting on those SoCs. > > Introduce a Kconfig option which toggles between CONFIG_ARM64 and > CONFIG_CPU_V7A, to allow easy switching between the two modes. This can > be manually selected in menuconfig, but follow-up patches will introduce > a separate defconfig for that purpose. > > Signed-off-by: Andre Przywara <andre.przywara@arm.com> > --- > arch/arm/mach-sunxi/Kconfig | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig > index 74e234cded..347d737fd0 100644 > --- a/arch/arm/mach-sunxi/Kconfig > +++ b/arch/arm/mach-sunxi/Kconfig > @@ -146,6 +146,10 @@ config SUNXI_DRAM_MAX_SIZE > default 0xC0000000 if MACH_SUN50I || MACH_SUN50I_H5 || MACH_SUN50I_H6 > default 0x80000000 > > +config SUNXI_ARMV8_32BIT_BUILD > + bool "Build 32-bit binaries for ARMv8 SoCs" > + default n > + > choice > prompt "Sunxi SoC Variant" > optional > @@ -275,7 +279,8 @@ config MACH_SUN9I > > config MACH_SUN50I > bool "sun50i (Allwinner A64)" > - select ARM64 > + select ARM64 if !SUNXI_ARMV8_32BIT_BUILD Can't you make this "imply ARM64" instead and then just set ARM64=n;CPU_V7A=y in the defconfig? Alex > + select CPU_V7A if SUNXI_ARMV8_32BIT_BUILD > select DM_I2C > select PHY_SUN4I_USB > select SUN6I_PRCM > @@ -291,14 +296,16 @@ config MACH_SUN50I > > config MACH_SUN50I_H5 > bool "sun50i (Allwinner H5)" > - select ARM64 > + select ARM64 if !SUNXI_ARMV8_32BIT_BUILD > + select CPU_V7A if SUNXI_ARMV8_32BIT_BUILD > select MACH_SUNXI_H3_H5 > select FIT > select SPL_LOAD_FIT > > config MACH_SUN50I_H6 > bool "sun50i (Allwinner H6)" > - select ARM64 > + select ARM64 if !SUNXI_ARMV8_32BIT_BUILD > + select CPU_V7A if SUNXI_ARMV8_32BIT_BUILD > select SUPPORT_SPL > select FIT > select SPL_LOAD_FIT >
Hi Alex, On 2/22/19 2:13 AM, Alexander Graf wrote: > > > On 21.02.19 02:30, Andre Przywara wrote: >> At the moment we build the SPL and U-Boot proper for the 64-bit AArch64 >> instruction set. But since the cores provide an AArch32 compatibility mode >> and in fact the BootROM runs in 32-bit mode, it can be useful to have at >> least the SPL run in AArch32 as well. This has two advantages: >> - As AArch32 features the compact Thumb2 instruction encoding, we can >> get a much smaller image size, which is a relief for our SPL. >> - Staying in AArch32, with the MMU turned off, allows an easy return to >> the BootROM and its FEL mode. This enables FEL booting on those SoCs. >> >> Introduce a Kconfig option which toggles between CONFIG_ARM64 and >> CONFIG_CPU_V7A, to allow easy switching between the two modes. This can >> be manually selected in menuconfig, but follow-up patches will introduce >> a separate defconfig for that purpose. >> >> Signed-off-by: Andre Przywara <andre.przywara@arm.com> >> --- >> arch/arm/mach-sunxi/Kconfig | 13 ++++++++++--- >> 1 file changed, 10 insertions(+), 3 deletions(-) >> >> diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig >> index 74e234cded..347d737fd0 100644 >> --- a/arch/arm/mach-sunxi/Kconfig >> +++ b/arch/arm/mach-sunxi/Kconfig >> @@ -146,6 +146,10 @@ config SUNXI_DRAM_MAX_SIZE >> default 0xC0000000 if MACH_SUN50I || MACH_SUN50I_H5 || MACH_SUN50I_H6 >> default 0x80000000 >> >> +config SUNXI_ARMV8_32BIT_BUILD >> + bool "Build 32-bit binaries for ARMv8 SoCs" >> + default n >> + >> choice >> prompt "Sunxi SoC Variant" >> optional >> @@ -275,7 +279,8 @@ config MACH_SUN9I >> >> config MACH_SUN50I >> bool "sun50i (Allwinner A64)" >> - select ARM64 >> + select ARM64 if !SUNXI_ARMV8_32BIT_BUILD > > Can't you make this "imply ARM64" instead and then just set > ARM64=n;CPU_V7A=y in the defconfig? Ha, that indeed sounds tempting, and actually I tried this before, but it doesn't work. The kernel doc says that an "imply" setting can be overwritten by a direct dependency or a visible prompt. ARM64 is not visible (empty bool), so I figured that introducing this simple symbol is the smallest pain to tackle this issue. Cheers, Andre. > > Alex > >> + select CPU_V7A if SUNXI_ARMV8_32BIT_BUILD >> select DM_I2C >> select PHY_SUN4I_USB >> select SUN6I_PRCM >> @@ -291,14 +296,16 @@ config MACH_SUN50I >> >> config MACH_SUN50I_H5 >> bool "sun50i (Allwinner H5)" >> - select ARM64 >> + select ARM64 if !SUNXI_ARMV8_32BIT_BUILD >> + select CPU_V7A if SUNXI_ARMV8_32BIT_BUILD >> select MACH_SUNXI_H3_H5 >> select FIT >> select SPL_LOAD_FIT >> >> config MACH_SUN50I_H6 >> bool "sun50i (Allwinner H6)" >> - select ARM64 >> + select ARM64 if !SUNXI_ARMV8_32BIT_BUILD >> + select CPU_V7A if SUNXI_ARMV8_32BIT_BUILD >> select SUPPORT_SPL >> select FIT >> select SPL_LOAD_FIT >>
On 26.02.19 00:32, Andre Przywara wrote: > Hi Alex, > > On 2/22/19 2:13 AM, Alexander Graf wrote: >> >> >> On 21.02.19 02:30, Andre Przywara wrote: >>> At the moment we build the SPL and U-Boot proper for the 64-bit AArch64 >>> instruction set. But since the cores provide an AArch32 compatibility >>> mode >>> and in fact the BootROM runs in 32-bit mode, it can be useful to have at >>> least the SPL run in AArch32 as well. This has two advantages: >>> - As AArch32 features the compact Thumb2 instruction encoding, we can >>> get a much smaller image size, which is a relief for our SPL. >>> - Staying in AArch32, with the MMU turned off, allows an easy return to >>> the BootROM and its FEL mode. This enables FEL booting on those SoCs. >>> >>> Introduce a Kconfig option which toggles between CONFIG_ARM64 and >>> CONFIG_CPU_V7A, to allow easy switching between the two modes. This can >>> be manually selected in menuconfig, but follow-up patches will introduce >>> a separate defconfig for that purpose. >>> >>> Signed-off-by: Andre Przywara <andre.przywara@arm.com> >>> --- >>> arch/arm/mach-sunxi/Kconfig | 13 ++++++++++--- >>> 1 file changed, 10 insertions(+), 3 deletions(-) >>> >>> diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig >>> index 74e234cded..347d737fd0 100644 >>> --- a/arch/arm/mach-sunxi/Kconfig >>> +++ b/arch/arm/mach-sunxi/Kconfig >>> @@ -146,6 +146,10 @@ config SUNXI_DRAM_MAX_SIZE >>> default 0xC0000000 if MACH_SUN50I || MACH_SUN50I_H5 || >>> MACH_SUN50I_H6 >>> default 0x80000000 >>> +config SUNXI_ARMV8_32BIT_BUILD >>> + bool "Build 32-bit binaries for ARMv8 SoCs" >>> + default n >>> + >>> choice >>> prompt "Sunxi SoC Variant" >>> optional >>> @@ -275,7 +279,8 @@ config MACH_SUN9I >>> config MACH_SUN50I >>> bool "sun50i (Allwinner A64)" >>> - select ARM64 >>> + select ARM64 if !SUNXI_ARMV8_32BIT_BUILD >> >> Can't you make this "imply ARM64" instead and then just set >> ARM64=n;CPU_V7A=y in the defconfig? > > Ha, that indeed sounds tempting, and actually I tried this before, but > it doesn't work. The kernel doc says that an "imply" setting can be > overwritten by a direct dependency or a visible prompt. ARM64 is not > visible (empty bool), so I figured that introducing this simple symbol > is the smallest pain to tackle this issue. If you say you already did try imply, then I'm all happy :). Alex
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index 74e234cded..347d737fd0 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig @@ -146,6 +146,10 @@ config SUNXI_DRAM_MAX_SIZE default 0xC0000000 if MACH_SUN50I || MACH_SUN50I_H5 || MACH_SUN50I_H6 default 0x80000000 +config SUNXI_ARMV8_32BIT_BUILD + bool "Build 32-bit binaries for ARMv8 SoCs" + default n + choice prompt "Sunxi SoC Variant" optional @@ -275,7 +279,8 @@ config MACH_SUN9I config MACH_SUN50I bool "sun50i (Allwinner A64)" - select ARM64 + select ARM64 if !SUNXI_ARMV8_32BIT_BUILD + select CPU_V7A if SUNXI_ARMV8_32BIT_BUILD select DM_I2C select PHY_SUN4I_USB select SUN6I_PRCM @@ -291,14 +296,16 @@ config MACH_SUN50I config MACH_SUN50I_H5 bool "sun50i (Allwinner H5)" - select ARM64 + select ARM64 if !SUNXI_ARMV8_32BIT_BUILD + select CPU_V7A if SUNXI_ARMV8_32BIT_BUILD select MACH_SUNXI_H3_H5 select FIT select SPL_LOAD_FIT config MACH_SUN50I_H6 bool "sun50i (Allwinner H6)" - select ARM64 + select ARM64 if !SUNXI_ARMV8_32BIT_BUILD + select CPU_V7A if SUNXI_ARMV8_32BIT_BUILD select SUPPORT_SPL select FIT select SPL_LOAD_FIT
At the moment we build the SPL and U-Boot proper for the 64-bit AArch64 instruction set. But since the cores provide an AArch32 compatibility mode and in fact the BootROM runs in 32-bit mode, it can be useful to have at least the SPL run in AArch32 as well. This has two advantages: - As AArch32 features the compact Thumb2 instruction encoding, we can get a much smaller image size, which is a relief for our SPL. - Staying in AArch32, with the MMU turned off, allows an easy return to the BootROM and its FEL mode. This enables FEL booting on those SoCs. Introduce a Kconfig option which toggles between CONFIG_ARM64 and CONFIG_CPU_V7A, to allow easy switching between the two modes. This can be manually selected in menuconfig, but follow-up patches will introduce a separate defconfig for that purpose. Signed-off-by: Andre Przywara <andre.przywara@arm.com> --- arch/arm/mach-sunxi/Kconfig | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)