ARM: rework endianess selection

Choosing big-endian vs little-endian kernels in Kconfig has not worked
correctly since the introduction of CONFIG_ARCH_MULTIPLATFORM a long
time ago.

The problems is that CONFIG_BIG_ENDIAN depends on
ARCH_SUPPORTS_BIG_ENDIAN, which can set by any one platform
in the config, but would actually have to be supported by all
of them.

This was mostly ok for ARMv6/ARMv7 builds, since these are BE8 and
tend to just work aside from problems in nonportable device drivers.
For ARMv4/v5 machines, CONFIG_BIG_ENDIAN and CONFIG_ARCH_MULTIPLATFORM
were never set together, so this was disabled on all those machines
except for IXP4xx.

As IXP4xx can now become part of ARCH_MULTIPLATFORM, it seems better to
formalize this logic: all ARMv4/v5 platforms get an explicit dependency
on being either big-endian (ixp4xx) or little-endian (the rest). We may
want to fix ixp4xx in the future to support both, but it does not work
in LE mode at the moment.

For the ARMv6/v7 platforms, there are two ways this could be handled

 a) allow both modes only for platforms selecting
    'ARCH_SUPPORTS_BIG_ENDIAN' today, but only LE mode for the
    others, given that these were added intentionally at some
    point.

 b) allow both modes everwhere, given that it was already possible
    to build that way by e.g. selecting ARCH_VIRT, and that the
    list is not an accurate reflection of which platforms may or
    may not work.

Out of these, I picked b) because it seemed slighly more logical
to me.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann 2022-04-04 11:52:31 +02:00
parent a3102fafdc
commit 5d6f52671e
34 changed files with 54 additions and 33 deletions

View File

@ -349,6 +349,7 @@ config ARCH_MULTIPLATFORM
config ARCH_FOOTBRIDGE
bool "FootBridge"
depends on CPU_LITTLE_ENDIAN
select CPU_SA110
select FOOTBRIDGE
select NEED_MACH_MEMORY_H
@ -358,7 +359,7 @@ config ARCH_FOOTBRIDGE
config ARCH_IXP4XX
bool "IXP4xx-based"
select ARCH_SUPPORTS_BIG_ENDIAN
depends on CPU_BIG_ENDIAN
select ARM_PATCH_PHYS_VIRT
select CPU_XSCALE
select GPIO_IXP4XX
@ -374,6 +375,7 @@ config ARCH_IXP4XX
config ARCH_PXA
bool "PXA2xx/PXA3xx-based"
depends on CPU_LITTLE_ENDIAN
select ARCH_MTD_XIP
select ARM_CPU_SUSPEND if PM
select AUTO_ZRELADDR
@ -393,6 +395,7 @@ config ARCH_PXA
config ARCH_RPC
bool "RiscPC"
depends on !CC_IS_CLANG && GCC_VERSION < 90100 && GCC_VERSION >= 60000
depends on CPU_LITTLE_ENDIAN
select ARCH_ACORN
select ARCH_MAY_HAVE_PC_FDC
select ARCH_SPARSEMEM_ENABLE
@ -411,6 +414,7 @@ config ARCH_RPC
config ARCH_SA1100
bool "SA1100-based"
depends on CPU_LITTLE_ENDIAN
select ARCH_MTD_XIP
select ARCH_SPARSEMEM_ENABLE
select CLKSRC_MMIO
@ -429,6 +433,7 @@ config ARCH_SA1100
config ARCH_OMAP1
bool "TI OMAP1"
depends on CPU_LITTLE_ENDIAN
select ARCH_OMAP
select CLKSRC_MMIO
select GENERIC_IRQ_CHIP
@ -505,7 +510,6 @@ config ARCH_VIRT
select ARM_GIC_V3_ITS if PCI
select ARM_PSCI
select HAVE_ARM_ARCH_TIMER
select ARCH_SUPPORTS_BIG_ENDIAN
config ARCH_AIROHA
bool "Airoha SoC Support"

View File

@ -2,6 +2,7 @@
config MACH_ASM9260
bool "Alphascale ASM9260"
depends on ARCH_MULTI_V5
depends on CPU_LITTLE_ENDIAN
select CPU_ARM926T
select ASM9260_TIMER
help

View File

@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
menuconfig ARCH_ASPEED
bool "Aspeed BMC architectures"
depends on ARCH_MULTI_V5 || ARCH_MULTI_V6 || ARCH_MULTI_V7
depends on (CPU_LITTLE_ENDIAN && ARCH_MULTI_V5) || ARCH_MULTI_V6 || ARCH_MULTI_V7
select SRAM
select WATCHDOG
select ASPEED_WATCHDOG

View File

@ -1,7 +1,8 @@
# SPDX-License-Identifier: GPL-2.0-only
menuconfig ARCH_AT91
bool "AT91/Microchip SoCs"
depends on ARCH_MULTI_V4T || ARCH_MULTI_V5 || ARCH_MULTI_V7 || ARM_SINGLE_ARMV7M
depends on (CPU_LITTLE_ENDIAN && (ARCH_MULTI_V4T || ARCH_MULTI_V5)) || \
ARCH_MULTI_V7 || ARM_SINGLE_ARMV7M
select ARM_CPU_SUSPEND if PM && ARCH_MULTI_V7
select COMMON_CLK_AT91
select GPIOLIB

View File

@ -2,6 +2,7 @@
menuconfig ARCH_CLPS711X
bool "Cirrus Logic EP721x/EP731x-based"
depends on ARCH_MULTI_V4T
depends on CPU_LITTLE_ENDIAN
select CLPS711X_TIMER
select CPU_ARM720T
select GPIOLIB

View File

@ -3,6 +3,7 @@
menuconfig ARCH_DAVINCI
bool "TI DaVinci"
depends on ARCH_MULTI_V5
depends on CPU_LITTLE_ENDIAN
select DAVINCI_TIMER
select ZONE_DMA
select PM_GENERIC_DOMAINS if PM

View File

@ -2,6 +2,7 @@
menuconfig ARCH_EP93XX
bool "EP93xx-based"
depends on ARCH_MULTI_V4T
depends on CPU_LITTLE_ENDIAN
select ARCH_SPARSEMEM_ENABLE
select ARM_AMBA
select ARM_VIC

View File

@ -8,7 +8,6 @@
menuconfig ARCH_EXYNOS
bool "Samsung Exynos"
depends on ARCH_MULTI_V7
select ARCH_SUPPORTS_BIG_ENDIAN
select ARM_AMBA
select ARM_GIC
select EXYNOS_IRQ_COMBINER

View File

@ -2,6 +2,7 @@
menuconfig ARCH_GEMINI
bool "Cortina Systems Gemini"
depends on ARCH_MULTI_V4
depends on CPU_LITTLE_ENDIAN
select ARCH_HAS_RESET_CONTROLLER
select ARM_AMBA
select ARM_APPENDED_DTB # Old Redboot bootloaders deployed

View File

@ -2,7 +2,6 @@
config ARCH_HIGHBANK
bool "Calxeda ECX-1000/2000 (Highbank/Midway)"
depends on ARCH_MULTI_V7
select ARCH_SUPPORTS_BIG_ENDIAN
select ARM_AMBA
select ARM_ERRATA_764369 if SMP
select ARM_ERRATA_775420

View File

@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
config ARCH_HISI
bool "Hisilicon SoC Support"
depends on ARCH_MULTI_V7 || ARCH_MULTI_V5
depends on ARCH_MULTI_V7 || (ARCH_MULTI_V5 && CPU_LITTLE_ENDIAN)
select ARM_AMBA
select ARM_GIC if ARCH_MULTI_V7
select ARM_TIMER_SP804

View File

@ -1,8 +1,8 @@
# SPDX-License-Identifier: GPL-2.0-only
menuconfig ARCH_MXC
bool "Freescale i.MX family"
depends on ARCH_MULTI_V4_V5 || ARCH_MULTI_V6_V7 || ARM_SINGLE_ARMV7M
select ARCH_SUPPORTS_BIG_ENDIAN
depends on (ARCH_MULTI_V4_V5 && CPU_LITTLE_ENDIAN) || \
ARCH_MULTI_V6_V7 || ARM_SINGLE_ARMV7M
select CLKSRC_IMX_GPT
select GENERIC_IRQ_CHIP
select GPIOLIB

View File

@ -2,6 +2,7 @@
menuconfig ARCH_IOP32X
bool "IOP32x-based platforms"
depends on ARCH_MULTI_V5
depends on CPU_LITTLE_ENDIAN
select CPU_XSCALE
select GPIO_IOP
select GPIOLIB

View File

@ -8,7 +8,6 @@ config ARCH_KEYSTONE
select ARCH_HAS_RESET_CONTROLLER
select ARM_ERRATA_798181 if SMP
select COMMON_CLK_KEYSTONE
select ARCH_SUPPORTS_BIG_ENDIAN
select ZONE_DMA if ARM_LPAE
select PINCTRL
select PM_GENERIC_DOMAINS if PM

View File

@ -3,6 +3,7 @@
config ARCH_LPC32XX
bool "NXP LPC32XX"
depends on ARCH_MULTI_V5
depends on CPU_LITTLE_ENDIAN
select ARM_AMBA
select CLKSRC_LPC32XX
select CPU_ARM926T

View File

@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
menuconfig ARCH_MMP
bool "Marvell PXA168/910/MMP2/MMP3"
depends on ARCH_MULTI_V5 || ARCH_MULTI_V7
depends on (CPU_LITTLE_ENDIAN && ARCH_MULTI_V5) || ARCH_MULTI_V7
select GPIO_PXA
select GPIOLIB
select PINCTRL

View File

@ -2,6 +2,7 @@
menuconfig ARCH_MOXART
bool "MOXA ART SoC"
depends on ARCH_MULTI_V4
depends on CPU_LITTLE_ENDIAN
select CPU_FA526
select ARM_DMA_MEM_BUFFERABLE
select FARADAY_FTINTC010

View File

@ -2,6 +2,7 @@
menuconfig ARCH_MV78XX0
bool "Marvell MV78xx0"
depends on ARCH_MULTI_V5
depends on CPU_LITTLE_ENDIAN
select CPU_FEROCEON
select GPIOLIB
select MVEBU_MBUS

View File

@ -1,8 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
menuconfig ARCH_MVEBU
bool "Marvell Engineering Business Unit (MVEBU) SoCs"
depends on ARCH_MULTI_V7 || ARCH_MULTI_V5
select ARCH_SUPPORTS_BIG_ENDIAN
depends on ARCH_MULTI_V7 || (ARCH_MULTI_V5 && CPU_LITTLE_ENDIAN)
select CLKSRC_MMIO
select PINCTRL
select PLAT_ORION

View File

@ -16,6 +16,7 @@ config SOC_IMX28
config ARCH_MXS
bool "Freescale MXS (i.MX23, i.MX28) support"
depends on ARCH_MULTI_V5
depends on CPU_LITTLE_ENDIAN
select GPIOLIB
select MXS_TIMER
select PINCTRL

View File

@ -2,6 +2,7 @@
menuconfig ARCH_NOMADIK
bool "ST-Ericsson Nomadik"
depends on ARCH_MULTI_V5
depends on CPU_LITTLE_ENDIAN
select ARM_AMBA
select ARM_VIC
select CLKSRC_NOMADIK_MTU

View File

@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
menuconfig ARCH_NPCM
bool "Nuvoton NPCM Architecture"
depends on ARCH_MULTI_V5 || ARCH_MULTI_V7
depends on (ARCH_MULTI_V5 && CPU_LITTLE_ENDIAN) || ARCH_MULTI_V7
select PINCTRL
if ARCH_NPCM

View File

@ -2,6 +2,7 @@
config ARCH_NSPIRE
bool "TI-NSPIRE based"
depends on ARCH_MULTI_V4_V5
depends on CPU_LITTLE_ENDIAN
select CPU_ARM926T
select GENERIC_IRQ_CHIP
select ARM_AMBA

View File

@ -2,6 +2,7 @@
menuconfig ARCH_ORION5X
bool "Marvell Orion"
depends on ARCH_MULTI_V5
depends on CPU_LITTLE_ENDIAN
select CPU_FEROCEON
select GPIOLIB
select MVEBU_MBUS

View File

@ -1,6 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
menuconfig ARCH_OXNAS
bool "Oxford Semiconductor OXNAS Family SoCs"
depends on (ARCH_MULTI_V5 && CPU_LITTLE_ENDIAN) || ARCH_MULTI_V6
select ARCH_HAS_RESET_CONTROLLER
select COMMON_CLK_OXNAS
select GPIOLIB
@ -11,7 +12,6 @@ menuconfig ARCH_OXNAS
select RESET_OXNAS
select VERSATILE_FPGA_IRQ
select PINCTRL
depends on ARCH_MULTI_V5 || ARCH_MULTI_V6
help
Support for OxNas SoC family developed by Oxford Semiconductor.

View File

@ -2,7 +2,6 @@
menuconfig ARCH_QCOM
bool "Qualcomm Support"
depends on ARCH_MULTI_V7
select ARCH_SUPPORTS_BIG_ENDIAN
select ARM_GIC
select ARM_AMBA
select PINCTRL

View File

@ -8,6 +8,7 @@
menuconfig ARCH_S3C24XX
bool "Samsung S3C24XX SoCs"
depends on ARCH_MULTI_V4T || ARCH_MULTI_V5
depends on CPU_LITTLE_ENDIAN
select ATAGS
select CLKSRC_SAMSUNG_PWM
select GPIO_SAMSUNG

View File

@ -3,7 +3,6 @@ menuconfig ARCH_INTEL_SOCFPGA
bool "Altera SOCFPGA family"
depends on ARCH_MULTI_V7
select ARCH_HAS_RESET_CONTROLLER
select ARCH_SUPPORTS_BIG_ENDIAN
select ARM_AMBA
select ARM_GIC
select CACHE_L2X0

View File

@ -5,7 +5,7 @@
menuconfig PLAT_SPEAR
bool "ST SPEAr Family"
depends on ARCH_MULTI_V7 || ARCH_MULTI_V5
depends on ARCH_MULTI_V7 || (ARCH_MULTI_V5 && CPU_LITTLE_ENDIAN)
select ARM_AMBA
select CLKSRC_MMIO
select GPIOLIB

View File

@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
menuconfig ARCH_SUNXI
bool "Allwinner SoCs"
depends on ARCH_MULTI_V5 || ARCH_MULTI_V7
depends on (CPU_LITTLE_ENDIAN && ARCH_MULTI_V5) || ARCH_MULTI_V7
select ARCH_HAS_RESET_CONTROLLER
select CLKSRC_MMIO
select GENERIC_IRQ_CHIP
@ -40,7 +40,6 @@ config MACH_SUN7I
default ARCH_SUNXI
select ARM_GIC
select ARM_PSCI
select ARCH_SUPPORTS_BIG_ENDIAN
select HAVE_ARM_ARCH_TIMER
select SUN5I_HSTIMER

View File

@ -2,6 +2,7 @@
config ARCH_VERSATILE
bool "ARM Ltd. Versatile family"
depends on ARCH_MULTI_V5
depends on CPU_LITTLE_ENDIAN
select ARM_AMBA
select ARM_TIMER_SP804
select ARM_VIC
@ -19,6 +20,7 @@ config ARCH_VERSATILE
menuconfig ARCH_INTEGRATOR
bool "ARM Ltd. Integrator family"
depends on ARCH_MULTI_V4T || ARCH_MULTI_V5 || ARCH_MULTI_V6
depends on CPU_LITTLE_ENDIAN || ARCH_MULTI_V6
select ARM_AMBA
select CMA
select DMA_CMA
@ -143,7 +145,7 @@ endif
menuconfig ARCH_REALVIEW
bool "ARM Ltd. RealView family"
depends on ARCH_MULTI_V5 || ARCH_MULTI_V6 || ARCH_MULTI_V7
depends on (CPU_LITTLE_ENDIAN && ARCH_MULTI_V5) || ARCH_MULTI_V6 || ARCH_MULTI_V7
select ARM_AMBA
select ARM_GIC
select ARM_TIMER_SP804
@ -247,7 +249,6 @@ endif
menuconfig ARCH_VEXPRESS
bool "ARM Ltd. Versatile Express family"
depends on ARCH_MULTI_V7
select ARCH_SUPPORTS_BIG_ENDIAN
select ARM_AMBA
select ARM_GIC
select ARM_GLOBAL_TIMER

View File

@ -10,6 +10,7 @@ config ARCH_VT8500
config ARCH_WM8505
bool "VIA/Wondermedia 85xx and WM8650"
depends on ARCH_MULTI_V5
depends on CPU_LITTLE_ENDIAN
select ARCH_VT8500
select CPU_ARM926T

View File

@ -3,7 +3,6 @@ config ARCH_ZYNQ
bool "Xilinx Zynq ARM Cortex A9 Platform"
depends on ARCH_MULTI_V7
select ARCH_HAS_RESET_CONTROLLER
select ARCH_SUPPORTS_BIG_ENDIAN
select ARM_AMBA
select ARM_GIC
select ARM_GLOBAL_TIMER

View File

@ -738,15 +738,29 @@ config SWP_EMULATE
If unsure, say Y.
choice
prompt "CPU Endianess"
default CPU_LITTLE_ENDIAN
config CPU_LITTLE_ENDIAN
bool "Built little-endian kernel"
help
Say Y if you plan on running a kernel in little-endian mode.
This is the default and is used in practically all modern user
space builds.
config CPU_BIG_ENDIAN
bool "Build big-endian kernel"
depends on ARCH_SUPPORTS_BIG_ENDIAN
depends on !LD_IS_LLD
help
Say Y if you plan on running a kernel in big-endian mode.
Note that your board must be properly built and your board
port must properly enable any big-endian related features
of your chipset/board/processor.
This works on many machines using ARMv6 or newer processors
but requires big-endian user space.
The only ARMv5 platform with big-endian support is
Intel IXP4xx.
endchoice
config CPU_ENDIAN_BE8
bool
@ -1122,12 +1136,6 @@ config ARM_DMA_MEM_BUFFERABLE
config ARM_HEAVY_MB
bool
config ARCH_SUPPORTS_BIG_ENDIAN
bool
help
This option specifies the architecture can support big endian
operation.
config DEBUG_ALIGN_RODATA
bool "Make rodata strictly non-executable"
depends on STRICT_KERNEL_RWX