linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] Define CPU_BIG_ENDIAN or warn for inconsistencies
@ 2017-06-12 22:09 Babu Moger
  2017-06-12 22:09 ` [PATCH v3 1/3] arch: Define CPU_BIG_ENDIAN for all fixed big endian archs Babu Moger
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Babu Moger @ 2017-06-12 22:09 UTC (permalink / raw)
  To: ysato, geert, jonas, stefan.kristiansson, shorne, jejb, deller,
	davem, viro, monstr
  Cc: mpe, peterz, mingo, jcmvbkbc, linux-kernel, uclinux-h8-devel,
	linux-m68k, openrisc, linux-parisc, sparclinux

Found this problem while enabling queued rwlock on SPARC.
The parameter CONFIG_CPU_BIG_ENDIAN is used to clear the
specific byte in qrwlock structure. Without this parameter,
we clear the wrong byte.
Here is the code in include/asm-generic/qrwlock.h

static inline u8 *__qrwlock_write_byte(struct qrwlock *lock)
  {
         return (u8 *)lock + 3 * IS_BUILTIN(CONFIG_CPU_BIG_ENDIAN);
  }

Also found few more references of this parameter in
drivers/of/base.c
drivers/of/fdt.c
drivers/tty/serial/earlycon.c
drivers/tty/serial/serial_core.c

Here is our previous discussion.
https://lkml.org/lkml/2017/5/24/620

Based on the discussion, it was decided to add CONFIG_CPU_BIG_ENDIAN
for all the fixed big endian architecture(frv, h8300, m68k, openrisc,
parisc and sparc). And warn if there are inconsistencies in this definition.

v2 -> v3:
 Added the choice statement for endianness selection for microblaze.
 Updated the Makefile for microblaze(Suggested by Arnd Bergmann) to
 properly compile for the correct format.
 Updated acks.

v1 -> v2:
 Updated the commit messages and acks.

Babu Moger (3):
  arch: Define CPU_BIG_ENDIAN for all fixed big endian archs
  arch/microblaze: Add choice for endianness and update Makefile
  include: warn for inconsistent endian config definition

 arch/frv/Kconfig                        |    3 +++
 arch/h8300/Kconfig                      |    3 +++
 arch/m68k/Kconfig                       |    3 +++
 arch/microblaze/Kconfig                 |   16 ++++++++++++++++
 arch/microblaze/Makefile                |    2 ++
 arch/openrisc/Kconfig                   |    3 +++
 arch/parisc/Kconfig                     |    3 +++
 arch/sparc/Kconfig                      |    3 +++
 include/linux/byteorder/big_endian.h    |    4 ++++
 include/linux/byteorder/little_endian.h |    4 ++++
 10 files changed, 44 insertions(+), 0 deletions(-)

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

* [PATCH v3 1/3] arch: Define CPU_BIG_ENDIAN for all fixed big endian archs
  2017-06-12 22:09 [PATCH v3 0/3] Define CPU_BIG_ENDIAN or warn for inconsistencies Babu Moger
@ 2017-06-12 22:09 ` Babu Moger
  2017-07-27 21:10   ` Helge Deller
  2017-06-12 22:09 ` [PATCH v3 2/3] arch/microblaze: Add choice for endianness and update Makefile Babu Moger
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Babu Moger @ 2017-06-12 22:09 UTC (permalink / raw)
  To: ysato, geert, jonas, stefan.kristiansson, shorne, jejb, deller,
	davem, viro, monstr
  Cc: mpe, peterz, mingo, jcmvbkbc, linux-kernel, uclinux-h8-devel,
	linux-m68k, openrisc, linux-parisc, sparclinux

While working on enabling queued rwlock on SPARC, found
this following code in include/asm-generic/qrwlock.h
which uses CONFIG_CPU_BIG_ENDIAN to clear a byte.

static inline u8 *__qrwlock_write_byte(struct qrwlock *lock)
 {
	return (u8 *)lock + 3 * IS_BUILTIN(CONFIG_CPU_BIG_ENDIAN);
 }

Problem is many of the fixed big endian architectures don't define
CPU_BIG_ENDIAN and clears the wrong byte.

Define CPU_BIG_ENDIAN for all the fixed big endian architecture to fix it.

Also found few more references of this config parameter in
drivers/of/base.c
drivers/of/fdt.c
drivers/tty/serial/earlycon.c
drivers/tty/serial/serial_core.c
Be aware that this may cause regressions if someone has worked-around
problems in the above code already. Remove the work-around.

Here is our original discussion
https://lkml.org/lkml/2017/5/24/620

Signed-off-by: Babu Moger <babu.moger@oracle.com>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: David S. Miller <davem@davemloft.net>
Acked-by: Stafford Horne <shorne@gmail.com>
---
 arch/frv/Kconfig      |    3 +++
 arch/h8300/Kconfig    |    3 +++
 arch/m68k/Kconfig     |    3 +++
 arch/openrisc/Kconfig |    3 +++
 arch/parisc/Kconfig   |    3 +++
 arch/sparc/Kconfig    |    3 +++
 6 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig
index eefd9a4..1cce824 100644
--- a/arch/frv/Kconfig
+++ b/arch/frv/Kconfig
@@ -17,6 +17,9 @@ config FRV
 	select HAVE_DEBUG_STACKOVERFLOW
 	select ARCH_NO_COHERENT_DMA_MMAP
 
+config CPU_BIG_ENDIAN
+	def_bool y
+
 config ZONE_DMA
 	bool
 	default y
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index 3ae8525..5380ac8 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -23,6 +23,9 @@ config H8300
 	select HAVE_ARCH_HASH
 	select CPU_NO_EFFICIENT_FFS
 
+config CPU_BIG_ENDIAN
+	def_bool y
+
 config RWSEM_GENERIC_SPINLOCK
 	def_bool y
 
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index d140206..029a58b 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -23,6 +23,9 @@ config M68K
 	select OLD_SIGSUSPEND3
 	select OLD_SIGACTION
 
+config CPU_BIG_ENDIAN
+	def_bool y
+
 config RWSEM_GENERIC_SPINLOCK
 	bool
 	default y
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index 1e95920..a0f2e4a 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -29,6 +29,9 @@ config OPENRISC
 	select CPU_NO_EFFICIENT_FFS if !OPENRISC_HAVE_INST_FF1
 	select NO_BOOTMEM
 
+config CPU_BIG_ENDIAN
+	def_bool y
+
 config MMU
 	def_bool y
 
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 531da9e..dda1f55 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -47,6 +47,9 @@ config PARISC
 	  and later HP3000 series).  The PA-RISC Linux project home page is
 	  at <http://www.parisc-linux.org/>.
 
+config CPU_BIG_ENDIAN
+	def_bool y
+
 config MMU
 	def_bool y
 
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 908f019..0d9dc49 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -92,6 +92,9 @@ config ARCH_DEFCONFIG
 config ARCH_PROC_KCORE_TEXT
 	def_bool y
 
+config CPU_BIG_ENDIAN
+	def_bool y
+
 config ARCH_ATU
 	bool
 	default y if SPARC64
-- 
1.7.1

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

* [PATCH v3 2/3] arch/microblaze: Add choice for endianness and update Makefile
  2017-06-12 22:09 [PATCH v3 0/3] Define CPU_BIG_ENDIAN or warn for inconsistencies Babu Moger
  2017-06-12 22:09 ` [PATCH v3 1/3] arch: Define CPU_BIG_ENDIAN for all fixed big endian archs Babu Moger
@ 2017-06-12 22:09 ` Babu Moger
  2017-06-12 22:10 ` [PATCH v3 3/3] include: warn for inconsistent endian config definition Babu Moger
  2017-07-04  7:11 ` [PATCH v3 0/3] Define CPU_BIG_ENDIAN or warn for inconsistencies Geert Uytterhoeven
  3 siblings, 0 replies; 9+ messages in thread
From: Babu Moger @ 2017-06-12 22:09 UTC (permalink / raw)
  To: ysato, geert, jonas, stefan.kristiansson, shorne, jejb, deller,
	davem, viro, monstr
  Cc: mpe, peterz, mingo, jcmvbkbc, linux-kernel, uclinux-h8-devel,
	linux-m68k, openrisc, linux-parisc, sparclinux

microblaze architectures can be configured for either little or
big endian formats. Add a choice option for the user to select the
correct endian format(default to big endian).

Also update the Makefile so toolchain can compile for the format
it is configured for.

Signed-off-by: Babu Moger <babu.moger@oracle.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/microblaze/Kconfig  |   16 ++++++++++++++++
 arch/microblaze/Makefile |    2 ++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index 85885a5..74aa5de 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -35,6 +35,22 @@ config MICROBLAZE
 	select VIRT_TO_BUS
 	select CPU_NO_EFFICIENT_FFS
 
+# Endianness selection
+choice
+	prompt "Endianness selection"
+	default CPU_BIG_ENDIAN
+	help
+	  microblaze architectures can be configured for either little or
+	  big endian formats. Be sure to select the appropriate mode.
+
+config CPU_BIG_ENDIAN
+	bool "Big endian"
+
+config CPU_LITTLE_ENDIAN
+	bool "Little endian"
+
+endchoice
+
 config SWAP
 	def_bool n
 
diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile
index 740f2b8..1f6c486 100644
--- a/arch/microblaze/Makefile
+++ b/arch/microblaze/Makefile
@@ -35,6 +35,8 @@ endif
 CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_DIV) += -mno-xl-soft-div
 CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_BARREL) += -mxl-barrel-shift
 CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR) += -mxl-pattern-compare
+CPUFLAGS-$(CONFIG_BIG_ENDIAN) += -mbig-endian
+CPUFLAGS-$(CONFIG_LITTLE_ENDIAN) += -mlittle-endian
 
 CPUFLAGS-1 += $(call cc-option,-mcpu=v$(CPU_VER))
 
-- 
1.7.1

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

* [PATCH v3 3/3] include: warn for inconsistent endian config definition
  2017-06-12 22:09 [PATCH v3 0/3] Define CPU_BIG_ENDIAN or warn for inconsistencies Babu Moger
  2017-06-12 22:09 ` [PATCH v3 1/3] arch: Define CPU_BIG_ENDIAN for all fixed big endian archs Babu Moger
  2017-06-12 22:09 ` [PATCH v3 2/3] arch/microblaze: Add choice for endianness and update Makefile Babu Moger
@ 2017-06-12 22:10 ` Babu Moger
  2017-07-04  7:11 ` [PATCH v3 0/3] Define CPU_BIG_ENDIAN or warn for inconsistencies Geert Uytterhoeven
  3 siblings, 0 replies; 9+ messages in thread
From: Babu Moger @ 2017-06-12 22:10 UTC (permalink / raw)
  To: ysato, geert, jonas, stefan.kristiansson, shorne, jejb, deller,
	davem, viro, monstr
  Cc: mpe, peterz, mingo, jcmvbkbc, linux-kernel, uclinux-h8-devel,
	linux-m68k, openrisc, linux-parisc, sparclinux

We have seen some generic code use config parameter CONFIG_CPU_BIG_ENDIAN
to decide the endianness.

Here are the few examples.
include/asm-generic/qrwlock.h
drivers/of/base.c
drivers/of/fdt.c
drivers/tty/serial/earlycon.c
drivers/tty/serial/serial_core.c

Display warning if CPU_BIG_ENDIAN is not defined on big endian
architecture and also warn if it defined on little endian architectures.

Here is our original discussion
https://lkml.org/lkml/2017/5/24/620

Signed-off-by: Babu Moger <babu.moger@oracle.com>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 include/linux/byteorder/big_endian.h    |    4 ++++
 include/linux/byteorder/little_endian.h |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/include/linux/byteorder/big_endian.h b/include/linux/byteorder/big_endian.h
index 3920414..ffd2159 100644
--- a/include/linux/byteorder/big_endian.h
+++ b/include/linux/byteorder/big_endian.h
@@ -3,5 +3,9 @@
 
 #include <uapi/linux/byteorder/big_endian.h>
 
+#ifndef CONFIG_CPU_BIG_ENDIAN
+#warning inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN
+#endif
+
 #include <linux/byteorder/generic.h>
 #endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */
diff --git a/include/linux/byteorder/little_endian.h b/include/linux/byteorder/little_endian.h
index 0805737..ba910bb 100644
--- a/include/linux/byteorder/little_endian.h
+++ b/include/linux/byteorder/little_endian.h
@@ -3,5 +3,9 @@
 
 #include <uapi/linux/byteorder/little_endian.h>
 
+#ifdef CONFIG_CPU_BIG_ENDIAN
+#warning inconsistent configuration, CONFIG_CPU_BIG_ENDIAN is set
+#endif
+
 #include <linux/byteorder/generic.h>
 #endif /* _LINUX_BYTEORDER_LITTLE_ENDIAN_H */
-- 
1.7.1

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

* Re: [PATCH v3 0/3] Define CPU_BIG_ENDIAN or warn for inconsistencies
  2017-06-12 22:09 [PATCH v3 0/3] Define CPU_BIG_ENDIAN or warn for inconsistencies Babu Moger
                   ` (2 preceding siblings ...)
  2017-06-12 22:10 ` [PATCH v3 3/3] include: warn for inconsistent endian config definition Babu Moger
@ 2017-07-04  7:11 ` Geert Uytterhoeven
  3 siblings, 0 replies; 9+ messages in thread
From: Geert Uytterhoeven @ 2017-07-04  7:11 UTC (permalink / raw)
  To: Babu Moger
  Cc: Yoshinori Sato, Jonas Bonn, Stefan Kristiansson, Stafford Horne,
	James E.J. Bottomley, Helge Deller, David S. Miller, Al Viro,
	Michal Simek, Michael Ellerman, Peter Zijlstra, Ingo Molnar,
	Max Filippov, linux-kernel, uclinux-h8-devel, Linux/m68k,
	openrisc, Parisc List, sparclinux

On Tue, Jun 13, 2017 at 12:09 AM, Babu Moger <babu.moger@oracle.com> wrote:
> Found this problem while enabling queued rwlock on SPARC.
> The parameter CONFIG_CPU_BIG_ENDIAN is used to clear the
> specific byte in qrwlock structure. Without this parameter,
> we clear the wrong byte.
> Here is the code in include/asm-generic/qrwlock.h
>
> static inline u8 *__qrwlock_write_byte(struct qrwlock *lock)
>   {
>          return (u8 *)lock + 3 * IS_BUILTIN(CONFIG_CPU_BIG_ENDIAN);
>   }
>
> Also found few more references of this parameter in
> drivers/of/base.c
> drivers/of/fdt.c
> drivers/tty/serial/earlycon.c
> drivers/tty/serial/serial_core.c
>
> Here is our previous discussion.
> https://lkml.org/lkml/2017/5/24/620
>
> Based on the discussion, it was decided to add CONFIG_CPU_BIG_ENDIAN
> for all the fixed big endian architecture(frv, h8300, m68k, openrisc,
> parisc and sparc). And warn if there are inconsistencies in this definition.
>
> v2 -> v3:
>  Added the choice statement for endianness selection for microblaze.
>  Updated the Makefile for microblaze(Suggested by Arnd Bergmann) to
>  properly compile for the correct format.
>  Updated acks.
>
> v1 -> v2:
>  Updated the commit messages and acks.
>
> Babu Moger (3):
>   arch: Define CPU_BIG_ENDIAN for all fixed big endian archs
>   arch/microblaze: Add choice for endianness and update Makefile
>   include: warn for inconsistent endian config definition
>
>  arch/frv/Kconfig                        |    3 +++
>  arch/h8300/Kconfig                      |    3 +++
>  arch/m68k/Kconfig                       |    3 +++
>  arch/microblaze/Kconfig                 |   16 ++++++++++++++++
>  arch/microblaze/Makefile                |    2 ++
>  arch/openrisc/Kconfig                   |    3 +++
>  arch/parisc/Kconfig                     |    3 +++
>  arch/sparc/Kconfig                      |    3 +++
>  include/linux/byteorder/big_endian.h    |    4 ++++
>  include/linux/byteorder/little_endian.h |    4 ++++
>  10 files changed, 44 insertions(+), 0 deletions(-)

We've just got a new user in c1b0bc2dabfa884d ("usb: typec:
Add support for UCSI interface").
So this series should definitely go in soon.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@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

* Re: [PATCH v3 1/3] arch: Define CPU_BIG_ENDIAN for all fixed big endian archs
  2017-06-12 22:09 ` [PATCH v3 1/3] arch: Define CPU_BIG_ENDIAN for all fixed big endian archs Babu Moger
@ 2017-07-27 21:10   ` Helge Deller
  0 siblings, 0 replies; 9+ messages in thread
From: Helge Deller @ 2017-07-27 21:10 UTC (permalink / raw)
  To: Babu Moger, ysato, geert, jonas, stefan.kristiansson, shorne,
	jejb, viro, monstr
  Cc: mpe, peterz, mingo, jcmvbkbc, linux-kernel, uclinux-h8-devel,
	linux-m68k, openrisc, linux-parisc, sparclinux

On 13.06.2017 00:09, Babu Moger wrote:
> While working on enabling queued rwlock on SPARC, found
> this following code in include/asm-generic/qrwlock.h
> which uses CONFIG_CPU_BIG_ENDIAN to clear a byte.
> 
> static inline u8 *__qrwlock_write_byte(struct qrwlock *lock)
>  {
> 	return (u8 *)lock + 3 * IS_BUILTIN(CONFIG_CPU_BIG_ENDIAN);
>  }
> 
> Problem is many of the fixed big endian architectures don't define
> CPU_BIG_ENDIAN and clears the wrong byte.
> 
> Define CPU_BIG_ENDIAN for all the fixed big endian architecture to fix it.
> 
> Also found few more references of this config parameter in
> drivers/of/base.c
> drivers/of/fdt.c
> drivers/tty/serial/earlycon.c
> drivers/tty/serial/serial_core.c
> Be aware that this may cause regressions if someone has worked-around
> problems in the above code already. Remove the work-around.
> 
> Here is our original discussion
> https://lkml.org/lkml/2017/5/24/620
> 
> Signed-off-by: Babu Moger <babu.moger@oracle.com>
> Suggested-by: Arnd Bergmann <arnd@arndb.de>
> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Acked-by: David S. Miller <davem@davemloft.net>
> Acked-by: Stafford Horne <shorne@gmail.com>

It seems for sparc it was already merged?

Anyway, you may add
Acked-by: Helge Deller <deller@gmx.de> # parisc

Helge

> ---
>  arch/frv/Kconfig      |    3 +++
>  arch/h8300/Kconfig    |    3 +++
>  arch/m68k/Kconfig     |    3 +++
>  arch/openrisc/Kconfig |    3 +++
>  arch/parisc/Kconfig   |    3 +++
>  arch/sparc/Kconfig    |    3 +++
>  6 files changed, 18 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig
> index eefd9a4..1cce824 100644
> --- a/arch/frv/Kconfig
> +++ b/arch/frv/Kconfig
> @@ -17,6 +17,9 @@ config FRV
>  	select HAVE_DEBUG_STACKOVERFLOW
>  	select ARCH_NO_COHERENT_DMA_MMAP
>  
> +config CPU_BIG_ENDIAN
> +	def_bool y
> +
>  config ZONE_DMA
>  	bool
>  	default y
> diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
> index 3ae8525..5380ac8 100644
> --- a/arch/h8300/Kconfig
> +++ b/arch/h8300/Kconfig
> @@ -23,6 +23,9 @@ config H8300
>  	select HAVE_ARCH_HASH
>  	select CPU_NO_EFFICIENT_FFS
>  
> +config CPU_BIG_ENDIAN
> +	def_bool y
> +
>  config RWSEM_GENERIC_SPINLOCK
>  	def_bool y
>  
> diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
> index d140206..029a58b 100644
> --- a/arch/m68k/Kconfig
> +++ b/arch/m68k/Kconfig
> @@ -23,6 +23,9 @@ config M68K
>  	select OLD_SIGSUSPEND3
>  	select OLD_SIGACTION
>  
> +config CPU_BIG_ENDIAN
> +	def_bool y
> +
>  config RWSEM_GENERIC_SPINLOCK
>  	bool
>  	default y
> diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
> index 1e95920..a0f2e4a 100644
> --- a/arch/openrisc/Kconfig
> +++ b/arch/openrisc/Kconfig
> @@ -29,6 +29,9 @@ config OPENRISC
>  	select CPU_NO_EFFICIENT_FFS if !OPENRISC_HAVE_INST_FF1
>  	select NO_BOOTMEM
>  
> +config CPU_BIG_ENDIAN
> +	def_bool y
> +
>  config MMU
>  	def_bool y
>  
> diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
> index 531da9e..dda1f55 100644
> --- a/arch/parisc/Kconfig
> +++ b/arch/parisc/Kconfig
> @@ -47,6 +47,9 @@ config PARISC
>  	  and later HP3000 series).  The PA-RISC Linux project home page is
>  	  at <http://www.parisc-linux.org/>.
>  
> +config CPU_BIG_ENDIAN
> +	def_bool y
> +
>  config MMU
>  	def_bool y
>  
> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
> index 908f019..0d9dc49 100644
> --- a/arch/sparc/Kconfig
> +++ b/arch/sparc/Kconfig
> @@ -92,6 +92,9 @@ config ARCH_DEFCONFIG
>  config ARCH_PROC_KCORE_TEXT
>  	def_bool y
>  
> +config CPU_BIG_ENDIAN
> +	def_bool y
> +
>  config ARCH_ATU
>  	bool
>  	default y if SPARC64
> 

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

* Re: [PATCH v3 0/3] Define CPU_BIG_ENDIAN or warn for inconsistencies
  2017-08-29  6:30 ` Greg KH
@ 2017-08-29  9:04   ` Peter Zijlstra
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Zijlstra @ 2017-08-29  9:04 UTC (permalink / raw)
  To: Greg KH
  Cc: Babu Moger, ysato, geert, jonas, stefan.kristiansson, shorne,
	jejb, deller, davem, viro, monstr, mpe, mingo, jcmvbkbc,
	linux-kernel, uclinux-h8-devel, linux-m68k, openrisc,
	linux-parisc, sparclinux, Andrew Morton

On Tue, Aug 29, 2017 at 08:30:15AM +0200, Greg KH wrote:
> On Thu, Jul 06, 2017 at 09:34:18AM -0700, Babu Moger wrote:
> > Resending the series per Greg KH's request.
> > 
> > Found this problem while enabling queued rwlock on SPARC.
> > The parameter CONFIG_CPU_BIG_ENDIAN is used to clear the
> > specific byte in qrwlock structure. Without this parameter,
> > we clear the wrong byte.
> > Here is the code in include/asm-generic/qrwlock.h
> > 
> > static inline u8 *__qrwlock_write_byte(struct qrwlock *lock)
> >   {
> >          return (u8 *)lock + 3 * IS_BUILTIN(CONFIG_CPU_BIG_ENDIAN);
> >   }
> > 
> > Also found few more references of this parameter in
> > drivers/of/base.c
> > drivers/of/fdt.c
> > drivers/tty/serial/earlycon.c
> > drivers/tty/serial/serial_core.c
> > 
> > Here is our previous discussion.
> > https://lkml.org/lkml/2017/5/24/620
> > 
> > Based on the discussion, it was decided to add CONFIG_CPU_BIG_ENDIAN
> > for all the fixed big endian architecture(frv, h8300, m68k, openrisc,
> > parisc and sparc). And warn if there are inconsistencies in this definition.
> 
> Did this series ever get picked up by anyone?  I don't know whose tree
> it should go through if not, anyone have any ideas?  I guess I could,
> but arch-specific stuff is odd...

Seems like something that akpm would pick up, but it appears people
didn't actually Cc him.

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

* Re: [PATCH v3 0/3] Define CPU_BIG_ENDIAN or warn for inconsistencies
  2017-07-06 16:34 Babu Moger
@ 2017-08-29  6:30 ` Greg KH
  2017-08-29  9:04   ` Peter Zijlstra
  0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2017-08-29  6:30 UTC (permalink / raw)
  To: Babu Moger
  Cc: ysato, geert, jonas, stefan.kristiansson, shorne, jejb, deller,
	davem, viro, monstr, mpe, peterz, mingo, jcmvbkbc, linux-kernel,
	uclinux-h8-devel, linux-m68k, openrisc, linux-parisc, sparclinux

On Thu, Jul 06, 2017 at 09:34:18AM -0700, Babu Moger wrote:
> Resending the series per Greg KH's request.
> 
> Found this problem while enabling queued rwlock on SPARC.
> The parameter CONFIG_CPU_BIG_ENDIAN is used to clear the
> specific byte in qrwlock structure. Without this parameter,
> we clear the wrong byte.
> Here is the code in include/asm-generic/qrwlock.h
> 
> static inline u8 *__qrwlock_write_byte(struct qrwlock *lock)
>   {
>          return (u8 *)lock + 3 * IS_BUILTIN(CONFIG_CPU_BIG_ENDIAN);
>   }
> 
> Also found few more references of this parameter in
> drivers/of/base.c
> drivers/of/fdt.c
> drivers/tty/serial/earlycon.c
> drivers/tty/serial/serial_core.c
> 
> Here is our previous discussion.
> https://lkml.org/lkml/2017/5/24/620
> 
> Based on the discussion, it was decided to add CONFIG_CPU_BIG_ENDIAN
> for all the fixed big endian architecture(frv, h8300, m68k, openrisc,
> parisc and sparc). And warn if there are inconsistencies in this definition.

Did this series ever get picked up by anyone?  I don't know whose tree
it should go through if not, anyone have any ideas?  I guess I could,
but arch-specific stuff is odd...

thanks,

greg k-h

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

* [PATCH v3 0/3] Define CPU_BIG_ENDIAN or warn for inconsistencies
@ 2017-07-06 16:34 Babu Moger
  2017-08-29  6:30 ` Greg KH
  0 siblings, 1 reply; 9+ messages in thread
From: Babu Moger @ 2017-07-06 16:34 UTC (permalink / raw)
  To: gregkh, ysato, geert, jonas, stefan.kristiansson, shorne, jejb,
	deller, davem, viro, monstr
  Cc: mpe, peterz, mingo, jcmvbkbc, linux-kernel, uclinux-h8-devel,
	linux-m68k, openrisc, linux-parisc, sparclinux

Resending the series per Greg KH's request.

Found this problem while enabling queued rwlock on SPARC.
The parameter CONFIG_CPU_BIG_ENDIAN is used to clear the
specific byte in qrwlock structure. Without this parameter,
we clear the wrong byte.
Here is the code in include/asm-generic/qrwlock.h

static inline u8 *__qrwlock_write_byte(struct qrwlock *lock)
  {
         return (u8 *)lock + 3 * IS_BUILTIN(CONFIG_CPU_BIG_ENDIAN);
  }

Also found few more references of this parameter in
drivers/of/base.c
drivers/of/fdt.c
drivers/tty/serial/earlycon.c
drivers/tty/serial/serial_core.c

Here is our previous discussion.
https://lkml.org/lkml/2017/5/24/620

Based on the discussion, it was decided to add CONFIG_CPU_BIG_ENDIAN
for all the fixed big endian architecture(frv, h8300, m68k, openrisc,
parisc and sparc). And warn if there are inconsistencies in this definition.

v2 -> v3:
 Added the choice statement for endianness selection for microblaze.
 Updated the Makefile for microblaze(Suggested by Arnd Bergmann) to
 properly compile for the correct format.
 Updated acks.

v1 -> v2:
 Updated the commit messages and acks.

Babu Moger (3):
  arch: Define CPU_BIG_ENDIAN for all fixed big endian archs
  arch/microblaze: Add choice for endianness and update Makefile
  include: warn for inconsistent endian config definition

 arch/frv/Kconfig                        |    3 +++
 arch/h8300/Kconfig                      |    3 +++
 arch/m68k/Kconfig                       |    3 +++
 arch/microblaze/Kconfig                 |   16 ++++++++++++++++
 arch/microblaze/Makefile                |    2 ++
 arch/openrisc/Kconfig                   |    3 +++
 arch/parisc/Kconfig                     |    3 +++
 arch/sparc/Kconfig                      |    3 +++
 include/linux/byteorder/big_endian.h    |    4 ++++
 include/linux/byteorder/little_endian.h |    4 ++++
 10 files changed, 44 insertions(+), 0 deletions(-)

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

end of thread, other threads:[~2017-08-29  9:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-12 22:09 [PATCH v3 0/3] Define CPU_BIG_ENDIAN or warn for inconsistencies Babu Moger
2017-06-12 22:09 ` [PATCH v3 1/3] arch: Define CPU_BIG_ENDIAN for all fixed big endian archs Babu Moger
2017-07-27 21:10   ` Helge Deller
2017-06-12 22:09 ` [PATCH v3 2/3] arch/microblaze: Add choice for endianness and update Makefile Babu Moger
2017-06-12 22:10 ` [PATCH v3 3/3] include: warn for inconsistent endian config definition Babu Moger
2017-07-04  7:11 ` [PATCH v3 0/3] Define CPU_BIG_ENDIAN or warn for inconsistencies Geert Uytterhoeven
2017-07-06 16:34 Babu Moger
2017-08-29  6:30 ` Greg KH
2017-08-29  9:04   ` Peter Zijlstra

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