linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] arch: Kconfig: Let all little endian architectures define CPU_LITTLE_ENDIAN explicitly
@ 2014-08-12 22:48 Chen Gang
  2014-08-13  5:08 ` Sam Ravnborg
  2014-08-13  8:03 ` Geert Uytterhoeven
  0 siblings, 2 replies; 9+ messages in thread
From: Chen Gang @ 2014-08-12 22:48 UTC (permalink / raw)
  To: linux-arm-kernel

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).


Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
 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(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c49a775..0510a5d 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -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
 
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 62b4ae1..290a253 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -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"
diff --git a/arch/c6x/Kconfig b/arch/c6x/Kconfig
index 77ea09b..56a8f53 100644
--- a/arch/c6x/Kconfig
+++ b/arch/c6x/Kconfig
@@ -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/
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 64aefb7..fa12d34 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -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
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 541e7cc..a1b3568 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -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"
 
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2] arch: Kconfig: Let all little endian architectures define CPU_LITTLE_ENDIAN explicitly
  2014-08-12 22:48 [PATCH v2] arch: Kconfig: Let all little endian architectures define CPU_LITTLE_ENDIAN explicitly Chen Gang
@ 2014-08-13  5:08 ` Sam Ravnborg
  2014-08-13  5:32   ` Chen Gang
  2014-08-13  8:03 ` Geert Uytterhoeven
  1 sibling, 1 reply; 9+ messages in thread
From: Sam Ravnborg @ 2014-08-13  5:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Aug 13, 2014 at 06:48:35AM +0800, Chen Gang wrote:
> 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).
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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2] arch: Kconfig: Let all little endian architectures define CPU_LITTLE_ENDIAN explicitly
  2014-08-13  5:08 ` Sam Ravnborg
@ 2014-08-13  5:32   ` Chen Gang
  2014-08-13  6:51     ` H. Peter Anvin
  0 siblings, 1 reply; 9+ messages in thread
From: Chen Gang @ 2014-08-13  5:32 UTC (permalink / raw)
  To: linux-arm-kernel



On 8/13/14 13:08, Sam Ravnborg wrote:
> On Wed, Aug 13, 2014 at 06:48:35AM +0800, Chen Gang wrote:
>> 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).
> 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.

> 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.
-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2] arch: Kconfig: Let all little endian architectures define CPU_LITTLE_ENDIAN explicitly
  2014-08-13  5:32   ` Chen Gang
@ 2014-08-13  6:51     ` H. Peter Anvin
  2014-08-13  7:44       ` Chen Gang
  0 siblings, 1 reply; 9+ messages in thread
From: H. Peter Anvin @ 2014-08-13  6:51 UTC (permalink / raw)
  To: linux-arm-kernel

On 08/12/2014 10:32 PM, Chen Gang wrote:
> 
> Yeah, we need.
> 
>> 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.
> 

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2] arch: Kconfig: Let all little endian architectures define CPU_LITTLE_ENDIAN explicitly
  2014-08-13  6:51     ` H. Peter Anvin
@ 2014-08-13  7:44       ` Chen Gang
  0 siblings, 0 replies; 9+ messages in thread
From: Chen Gang @ 2014-08-13  7:44 UTC (permalink / raw)
  To: linux-arm-kernel



On 8/13/14 14:51, H. Peter Anvin wrote:
> On 08/12/2014 10:32 PM, Chen Gang wrote:
>>
>> Yeah, we need.
>>
>>> 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.
>>
> 
> 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
> 

OK, what you said sounds reasonable to me. After search "endian" in
"./arch", xtensa also can be support both big endian or little endian.

> 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.
-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2] arch: Kconfig: Let all little endian architectures define CPU_LITTLE_ENDIAN explicitly
  2014-08-12 22:48 [PATCH v2] arch: Kconfig: Let all little endian architectures define CPU_LITTLE_ENDIAN explicitly Chen Gang
  2014-08-13  5:08 ` Sam Ravnborg
@ 2014-08-13  8:03 ` Geert Uytterhoeven
  2014-08-13  8:16   ` Chen Gang
  2014-08-22 11:09   ` Michal Marek
  1 sibling, 2 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2014-08-13  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

CC kbuild

On Wed, Aug 13, 2014 at 12:48 AM, Chen Gang <gang.chen.5i5j@gmail.com> wrote:
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index c49a775..0510a5d 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -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 -- geert at linux-m68k.org

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2] arch: Kconfig: Let all little endian architectures define CPU_LITTLE_ENDIAN explicitly
  2014-08-13  8:03 ` Geert Uytterhoeven
@ 2014-08-13  8:16   ` Chen Gang
  2014-08-22 11:09   ` Michal Marek
  1 sibling, 0 replies; 9+ messages in thread
From: Chen Gang @ 2014-08-13  8:16 UTC (permalink / raw)
  To: linux-arm-kernel


On 8/13/14 16:03, Geert Uytterhoeven wrote:
> CC kbuild
> 
> On Wed, Aug 13, 2014 at 12:48 AM, Chen Gang <gang.chen.5i5j@gmail.com> wrote:
>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>> index c49a775..0510a5d 100644
>> --- a/arch/arm/Kconfig
>> +++ b/arch/arm/Kconfig
>> @@ -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"?
> 

That sounds a good idea to me.

> Also we could have "config CPU_BIG_ENDIAN", too, and error out
> if none or both are selected (can Kconfig error out?).
> 

It is a good idea to me, welcome any members ideas, especially Kbuild
members' ideas, suggestions or completions.


Thanks.
-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2] arch: Kconfig: Let all little endian architectures define CPU_LITTLE_ENDIAN explicitly
  2014-08-13  8:03 ` Geert Uytterhoeven
  2014-08-13  8:16   ` Chen Gang
@ 2014-08-22 11:09   ` Michal Marek
  2014-08-23  2:31     ` Chen Gang
  1 sibling, 1 reply; 9+ messages in thread
From: Michal Marek @ 2014-08-22 11:09 UTC (permalink / raw)
  To: linux-arm-kernel

Dne 13.8.2014 10:03, Geert Uytterhoeven napsal(a):
> CC kbuild
> 
> On Wed, Aug 13, 2014 at 12:48 AM, Chen Gang <gang.chen.5i5j@gmail.com> wrote:
>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>> index c49a775..0510a5d 100644
>> --- a/arch/arm/Kconfig
>> +++ b/arch/arm/Kconfig
>> @@ -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"?

Yes!


> Also we could have "config CPU_BIG_ENDIAN", too, and error out
> if none or both are selected (can Kconfig error out?).

We can error out in the Makefile, if there is consensus that we should
be doing so.

Michal

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2] arch: Kconfig: Let all little endian architectures define CPU_LITTLE_ENDIAN explicitly
  2014-08-22 11:09   ` Michal Marek
@ 2014-08-23  2:31     ` Chen Gang
  0 siblings, 0 replies; 9+ messages in thread
From: Chen Gang @ 2014-08-23  2:31 UTC (permalink / raw)
  To: linux-arm-kernel

On 8/22/14 19:09, Michal Marek wrote:
> Dne 13.8.2014 10:03, Geert Uytterhoeven napsal(a):
>> CC kbuild
>>
>> On Wed, Aug 13, 2014 at 12:48 AM, Chen Gang <gang.chen.5i5j@gmail.com> wrote:
>>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>>> index c49a775..0510a5d 100644
>>> --- a/arch/arm/Kconfig
>>> +++ b/arch/arm/Kconfig
>>> @@ -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"?
> 
> Yes!
> 
> 
>> Also we could have "config CPU_BIG_ENDIAN", too, and error out
>> if none or both are selected (can Kconfig error 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.
-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-08-23  2:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-12 22:48 [PATCH v2] arch: Kconfig: Let all little endian architectures define CPU_LITTLE_ENDIAN explicitly Chen Gang
2014-08-13  5:08 ` Sam Ravnborg
2014-08-13  5:32   ` Chen Gang
2014-08-13  6:51     ` H. Peter Anvin
2014-08-13  7:44       ` Chen Gang
2014-08-13  8:03 ` Geert Uytterhoeven
2014-08-13  8:16   ` Chen Gang
2014-08-22 11:09   ` Michal Marek
2014-08-23  2:31     ` Chen Gang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).