s390x: io: declare s390x CPU as big endian
PATCH 1/1 s390x: io: declare s390x CPU as big endian
To use the swap byte transformations we need to declare the s390x architecture as big endian.
--- lib/s390x/asm/io.h | 1 + 1 file changed, 1 insertion(+)
lib/s390x/asm/io.h +1 -0
@@ -10,6 +10,7 @@#define _ASMS390X_IO_H_#define __iomem +#define __cpu_is_be () (1)#include <asm-generic/io.h>
Signature · 1 line
2.25.1
Quoted 14 lines · Pierre Morel
To use the swap byte transformations we need to declare the s390x architecture as big endian.
Signed-off-by Pierre Morel <[email protected]>--- lib/s390x/asm/io.h | 1 + 1 file changed, 1 insertion(+)lib/s390x/asm/io.h +0
-0
lib/s390x/asm/io.h line 16
Quoted 7 lines
lib/s390x/asm/io.h +1
-0@@ -10,6 +10,7 @@#define _ASMS390X_IO_H_#define __iomem +#define __cpu_is_be () (1)#include <asm-generic/io.h>
Alternatively, I think you could also move this sequence from lib/ppc64/asm/io.h into lib/asm-generic/io.h:
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define __cpu_is_be() (0)
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define __cpu_is_be() (1)
#else
#error Undefined byte order
#endif
(replacing the hardcoded __cpu_is_be() in the generic code).
Thomas
Quoted 36 lines · On Fri, 12 Nov 2021 08:38:38 +0100 Thomas Huth <[email protected]> wrote:
Quoted 14 lines · Pierre Morel
To use the swap byte transformations we need to declare the s390x architecture as big endian.
Signed-off-by Pierre Morel <[email protected]>--- lib/s390x/asm/io.h | 1 + 1 file changed, 1 insertion(+)lib/s390x/asm/io.h +0
-0lib/s390x/asm/io.h line 16
Quoted 7 lines
lib/s390x/asm/io.h +1
-0@@ -10,6 +10,7 @@#define _ASMS390X_IO_H_#define __iomem +#define __cpu_is_be () (1)#include <asm-generic/io.h> Reviewed-by Thomas Huth <[email protected]>Alternatively, I think you could also move this sequence from
lib/ppc64/asm/io.hintolib/asm-generic/io.h:#if
__BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__
#define__cpu_is_be()(0)
#elif__BYTE_ORDER__==__ORDER_BIG_ENDIAN__
#define__cpu_is_be()(1)
#else
#error Undefined byte order
#endif
Quoted 3 lines
(replacing the hardcoded
__cpu_is_be()in the generic code).Thomas
I think this looks cleaner