arch: Kconfig: Let all little endian architectures define CPU_LITTLE_ENDIAN explicitly
Subsystems (5)
PATCH v2 1/1 arch: Kconfig: Let all little endian architectures define CPU_LITTLE_ENDIAN explicitly
x86 and ia64 are always little endian. And another architectures may be little endian: mips, sh, powerpc, and m32r (may mark CPU_LITTLE_ENDIAN explicitly); also arm(64) and c6x (which may be !CPU_BIG_ENDIAN).
Some drivers (e.g. some of "drivers/isdn/hisax") may only support little endian (CPU_LITTLE_ENDIAN), and some drivers may only support big endian (!CPU_LITTLE_ENDIAN).
So export all little endian architectures within kernel wide, so can let Kconfig easier for the modules which only support little endian or only for big endian (assume !CPU_LITTLE_ENDIAN is same as CPU_BIG_ENDIAN).
--- arch/arm/Kconfig | 5 +++++ arch/arm64/Kconfig | 4 ++++ arch/c6x/Kconfig | 4 ++++ arch/ia64/Kconfig | 3 +++ arch/x86/Kconfig | 3 +++ 5 files changed, 19 insertions(+)
arch/arm/Kconfig +5 -0
@@ -199,6 +199,11 @@ config NEED_DMA_MAP_STATE config ARCH_SUPPORTS_UPROBES def_bool y +config CPU_LITTLE_ENDIAN + depends on !CPU_BIG_ENDIAN + def_bool y + + config ARCH_HAS_DMA_SET_COHERENT_MASK bool
arch/arm64/Kconfig +4 -0
@@ -129,6 +129,10 @@ config KERNEL_MODE_NEON config FIX_EARLYCON_MEM def_bool y +config CPU_LITTLE_ENDIAN + depends on !CPU_BIG_ENDIAN + def_bool y + source "init/Kconfig" source "kernel/Kconfig.freezer"
arch/c6x/Kconfig +4 -0
@@ -48,6 +48,10 @@ config C6X_BIG_KERNEL If unsure, say N. +config CPU_LITTLE_ENDIAN + depends on !CPU_BIG_ENDIAN + def_bool y + source "init/Kconfig" # Use the generic interrupt handling code in kernel/irq/
arch/ia64/Kconfig +3 -0
@@ -133,6 +133,9 @@ config AUDIT_ARCH bool default y +config CPU_LITTLE_ENDIAN + def_bool y + menuconfig PARAVIRT_GUEST bool "Paravirtualized guest support" depends on BROKEN
arch/x86/Kconfig +3 -0
@@ -270,6 +270,9 @@ config ARCH_SUPPORTS_UPROBES config FIX_EARLYCON_MEM def_bool y +config CPU_LITTLE_ENDIAN + def_bool y + source "init/Kconfig" source "kernel/Kconfig.freezer"
Signature · 1 line
1.7.11.7
Quoted 11 lines · Chen Gang
x86 and ia64 are always little endian. And another architectures may be little endian: mips, sh, powerpc, and m32r (may mark
CPU_LITTLE_ENDIANexplicitly); also arm(64) and c6x (which may be !CPU_BIG_ENDIAN).Some drivers (e.g. some of "
drivers/isdn/hisax") may only support little endian (CPU_LITTLE_ENDIAN), and some drivers may only support big endian (!CPU_LITTLE_ENDIAN).So export all little endian architectures within kernel wide, so can let
Kconfigeasier for the modules which only support little endian or only for big endian (assume !CPU_LITTLE_ENDIAN is same asCPU_BIG_ENDIAN).
We need to cover three cases here:
- An arch supports only little endian
- An arch supports only big endian
- An arch may be both little and big endian
The solution you suggest assumes that an arch is either little or big endian. But we cannot ignore the hybriads that can do both.
Sam
Quoted 9 lines · Sam Ravnborg
Quoted 8 lines · Chen Gang
x86 and ia64 are always little endian. And another architectures may be little endian: mips, sh, powerpc, and m32r (may mark
CPU_LITTLE_ENDIANexplicitly); also arm(64) and c6x (which may be !CPU_BIG_ENDIAN).Some drivers (e.g. some of "
drivers/isdn/hisax") may only support little endian (CPU_LITTLE_ENDIAN), and some drivers may only support big endian (!CPU_LITTLE_ENDIAN).
Quoted 8 lines
Quoted 3 lines
So export all little endian architectures within kernel wide, so can let
Kconfigeasier for the modules which only support little endian or only for big endian (assume !CPU_LITTLE_ENDIAN is same asCPU_BIG_ENDIAN).We need to cover three cases here:
- An arch supports only little endian
- An arch supports only big endian
- An arch may be both little and big endian
Yeah, we need.
Quoted 3 lines
The solution you suggest assumes that an arch is either little or big endian. But we cannot ignore the hybriads that can do both.
For the architectures which can do both, for me, they are: sh, powerpc, m32r, and mips (may mark CPU_LITTLE_ENDIAN), also are: arm/arm64, and c6x (may mark !CPU_BIG_ENDIAN).
For the architectures which only support little endian: x86, and ia64.
The left, I assumes they are big endian (no any 'ENDIAN' can be found in their Kconfig files). In my memory, except related with Intel, all are (or support) big endian.
Thanks.
Signature · 3 lines
Chen Gang Open, share, and attitude like air, water, and life which God blessed
H. Peter Anvin
reviewerQuoted 11 lines · Chen Gang
Yeah, we need.
Quoted 3 lines
The solution you suggest assumes that an arch is either little or big endian. But we cannot ignore the hybriads that can do both.
For the architectures which can do both, for me, they are: sh, powerpc, m32r, and mips (may mark
CPU_LITTLE_ENDIAN), also are: arm/arm64, and c6x (may mark !CPU_BIG_ENDIAN).
Quoted 6 lines
For the architectures which only support little endian: x86, and ia64.
The left, I assumes they are big endian (no any 'ENDIAN' can be found in their
Kconfigfiles). In my memory, except related with Intel, all are (or support) big endian.
I'm quite certain that is wrong. From memory, for example, I believe CRIS is littleendian, and sure enough:
: tazenda 103 ; less arch/cris/include/uapi/asm/byteorder.h #ifndef _CRIS_BYTEORDER_H
#define _CRIS_BYTEORDER_H
#include <linux/byteorder/little_endian.h>
#endif
As far as I know, endianism is always a compile-time option on Linux, so we should be able to relatively easily define the architecture so that we either have hardwired littleendian, bigendian, or prompt.
-hpa
Quoted 22 lines · H. Peter Anvin
Quoted 11 lines · Chen Gang
Yeah, we need.
Quoted 3 lines
The solution you suggest assumes that an arch is either little or big endian. But we cannot ignore the hybriads that can do both.
For the architectures which can do both, for me, they are: sh, powerpc, m32r, and mips (may mark
CPU_LITTLE_ENDIAN), also are: arm/arm64, and c6x (may mark !CPU_BIG_ENDIAN).Quoted 6 lines
For the architectures which only support little endian: x86, and ia64.
The left, I assumes they are big endian (no any 'ENDIAN' can be found in their
Kconfigfiles). In my memory, except related with Intel, all are (or support) big endian.I'm quite certain that is wrong. From memory, for example, I believe CRIS is littleendian, and sure enough:
Quoted 8 lines
: tazenda 103 ; less
arch/cris/include/uapi/asm/byteorder.h#ifndef_CRIS_BYTEORDER_H
#define_CRIS_BYTEORDER_H#include <
linux/byteorder/little_endian.h>#endif
OK, what you said sounds reasonable to me. After search "endian" in "./arch", xtensa also can be support both big endian or little endian.
Quoted 4 lines
As far as I know, endianism is always a compile-time option on Linux, so we should be able to relatively easily define the architecture so that we either have hardwired littleendian, bigendian, or prompt.
Yeah, but that may break building and re-config manually. So it is still necessary to check little endian or big endian during configuration time ("make *config").
Thanks.
Signature · 3 lines
Chen Gang Open, share, and attitude like air, water, and life which God blessed
CC kbuild
Quoted 5 lines · Chen Gang
arch/arm/Kconfig +0
-0
arch/arm/Kconfig config NEED_DMA_MAP_STATE · line 208
Quoted 10 lines
arch/arm/Kconfig +5
-0@@ -199,6 +199,11 @@ config NEED_DMA_MAP_STATE config ARCH_SUPPORTS_UPROBES def_bool y +config CPU_LITTLE_ENDIAN + depends on !CPU_BIG_ENDIAN + def_bool y + + config ARCH_HAS_DMA_SET_COHERENT_MASK bool
As this is a common symbol, and replicated for all affected architectures, I'm wondering if we should have the "config CPU_LITTLE_ENDIAN" in common Kconfig code instead, and make the individual architectures do a "select CPU_LITTLE_ENDIAN"?
Also we could have "config CPU_BIG_ENDIAN", too, and error out if none or both are selected (can Kconfig error out?).
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Quoted 11 lines · Geert Uytterhoeven
CC kbuild
Quoted 8 lines · Chen Gang
arch/arm/Kconfig +0
-0@@ -199,6 +199,11 @@ config NEED_DMA_MAP_STATE config ARCH_SUPPORTS_UPROBES def_bool y
Quoted 13 lines
arch/arm/Kconfig config NEED_DMA_MAP_STATE · line 208
Quoted 7 lines
arch/arm/Kconfig +5
-0+config CPU_LITTLE_ENDIAN + depends on !CPU_BIG_ENDIAN + def_bool y + + config ARCH_HAS_DMA_SET_COHERENT_MASK boolAs this is a common symbol, and replicated for all affected architectures, I'm wondering if we should have the "config
CPU_LITTLE_ENDIAN" in commonKconfigcode instead, and make the individual architectures do a "selectCPU_LITTLE_ENDIAN"?
That sounds a good idea to me.
Quoted 3 lines
Also we could have "config
CPU_BIG_ENDIAN", too, and error out if none or both are selected (canKconfigerror out?).
It is a good idea to me, welcome any members ideas, especially Kbuild members' ideas, suggestions or completions.
Thanks.
Signature · 3 lines
Chen Gang Open, share, and attitude like air, water, and life which God blessed
Dne 13.8.2014 10:03, Geert Uytterhoeven napsal(a):
Quoted 11 lines
CC kbuild
Quoted 8 lines · Chen Gang
arch/arm/Kconfig +0
-0@@ -199,6 +199,11 @@ config NEED_DMA_MAP_STATE config ARCH_SUPPORTS_UPROBES def_bool y
Quoted 12 lines
arch/arm/Kconfig config NEED_DMA_MAP_STATE · line 208
Quoted 7 lines
arch/arm/Kconfig +5
-0+config CPU_LITTLE_ENDIAN + depends on !CPU_BIG_ENDIAN + def_bool y + + config ARCH_HAS_DMA_SET_COHERENT_MASK boolAs this is a common symbol, and replicated for all affected architectures, I'm wondering if we should have the "config
CPU_LITTLE_ENDIAN" in commonKconfigcode instead, and make the individual architectures do a "selectCPU_LITTLE_ENDIAN"?
Yes!
Quoted 2 lines
Also we could have "config
CPU_BIG_ENDIAN", too, and error out if none or both are selected (canKconfigerror out?).
We can error out in the Makefile, if there is consensus that we should be doing so.
Michal
Quoted 25 lines · Michal Marek
Dne 13.8.2014 10:03, Geert Uytterhoeven napsal(a):
Quoted 11 lines
CC kbuild
Quoted 8 lines · Chen Gang
arch/arm/Kconfig +0
-0@@ -199,6 +199,11 @@ config NEED_DMA_MAP_STATE config ARCH_SUPPORTS_UPROBES def_bool yQuoted 12 lines
arch/arm/Kconfig config NEED_DMA_MAP_STATE · line 208
Quoted 7 lines
arch/arm/Kconfig +5
-0+config CPU_LITTLE_ENDIAN + depends on !CPU_BIG_ENDIAN + def_bool y + + config ARCH_HAS_DMA_SET_COHERENT_MASK boolAs this is a common symbol, and replicated for all affected architectures, I'm wondering if we should have the "config
CPU_LITTLE_ENDIAN" in commonKconfigcode instead, and make the individual architectures do a "selectCPU_LITTLE_ENDIAN"?
Quoted 9 lines
Yes!
Quoted 2 lines
Also we could have "config
CPU_BIG_ENDIAN", too, and error out if none or both are selected (canKconfigerror out?).We can error out in the
Makefile, if there is consensus that we should be doing so.
OK, thanks. I have sent patch v3 for it, and did not check related error in Kconfig files.
Please check the related patches (excuse me, I send the patch v3 only according to "scripts/maintainers.pl", maybe not cc to you explicitly).
Thanks.
Signature · 3 lines
Chen Gang Open, share, and attitude like air, water, and life which God blessed