[PATCH 7/9] powerpc: Add little endian variants of LHZX_BE and friends

From
Christophe Leroy <hidden>
Date
2024-08-16 14:37:36
Also in
linux-arch, lkml
Reply to
Christophe Leroy, 2024-08-16
To support getrandom in VDSO which is based on little endian storage,
add macros equivalent to LHZX_BE for little endian accesses.

And move it outside of __powerpc64__ #ifdef so that it can also be
used for PPC32.

Signed-off-by: Christophe Leroy <redacted>
---
 arch/powerpc/include/asm/asm-compat.h | 40 +++++++++++++++++----------
 1 file changed, 26 insertions(+), 14 deletions(-)
diff --git a/arch/powerpc/include/asm/asm-compat.h b/arch/powerpc/include/asm/asm-compat.h
index 2bc53c646ccd..ef8e79ae669a 100644
--- a/arch/powerpc/include/asm/asm-compat.h
+++ b/arch/powerpc/include/asm/asm-compat.h
@@ -25,20 +25,6 @@
 #define PPC_LR_STKOFF	16
 #define PPC_MIN_STKFRM	112
 
-#ifdef __BIG_ENDIAN__
-#define LHZX_BE	stringify_in_c(lhzx)
-#define LWZX_BE	stringify_in_c(lwzx)
-#define LDX_BE	stringify_in_c(ldx)
-#define STWX_BE	stringify_in_c(stwx)
-#define STDX_BE	stringify_in_c(stdx)
-#else
-#define LHZX_BE	stringify_in_c(lhbrx)
-#define LWZX_BE	stringify_in_c(lwbrx)
-#define LDX_BE	stringify_in_c(ldbrx)
-#define STWX_BE	stringify_in_c(stwbrx)
-#define STDX_BE	stringify_in_c(stdbrx)
-#endif
-
 #else /* 32-bit */
 
 /* operations for longs and pointers */
@@ -61,4 +47,30 @@
 
 #endif
 
+#ifdef __BIG_ENDIAN__
+#define LHZX_BE	stringify_in_c(lhzx)
+#define LWZX_BE	stringify_in_c(lwzx)
+#define LDX_BE	stringify_in_c(ldx)
+#define STWX_BE	stringify_in_c(stwx)
+#define STDX_BE	stringify_in_c(stdx)
+
+#define LHZX_LE	stringify_in_c(lhbrx)
+#define LWZX_LE	stringify_in_c(lwbrx)
+#define LDX_LE	stringify_in_c(ldbrx)
+#define STWX_LE	stringify_in_c(stwbrx)
+#define STDX_LE	stringify_in_c(stdbrx)
+#else
+#define LHZX_BE	stringify_in_c(lhbrx)
+#define LWZX_BE	stringify_in_c(lwbrx)
+#define LDX_BE	stringify_in_c(ldbrx)
+#define STWX_BE	stringify_in_c(stwbrx)
+#define STDX_BE	stringify_in_c(stdbrx)
+
+#define LHZX_LE	stringify_in_c(lhzx)
+#define LWZX_LE	stringify_in_c(lwzx)
+#define LDX_LE	stringify_in_c(ldx)
+#define STWX_LE	stringify_in_c(stwx)
+#define STDX_LE	stringify_in_c(stdx)
+#endif
+
 #endif /* _ASM_POWERPC_ASM_COMPAT_H */
-- 
2.44.0

Thread (15 messages) 15 messages, 3 authors, last reply 2024-08-17
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help