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