Thread (4 messages) flat view 4 messages, 2 authors, 2021-02-10
STALE2018d LANDED

Landed in mainline as fd659e8f2c6d on 2021-02-08.

[PATCH 1/3] powerpc/32s: Change mfsrin() into a static inline function

From: Christophe Leroy <hidden>
Date: 2021-02-06 11:48:17
Also in: lkml
Subsystem: kernel virtual machine for powerpc (kvm/powerpc), linux for powerpc (32-bit and 64-bit), the rest · Maintainers: Madhavan Srinivasan, Linus Torvalds

mfsrin() is a macro.

Change in into an inline function to avoid conflicts in KVM
and make it more evolutive.

Signed-off-by: Christophe Leroy <redacted>
---
 arch/powerpc/include/asm/reg.h    | 11 ++++++++---
 arch/powerpc/kvm/book3s_emulate.c |  4 ----
 2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index d05dca30604d..f0fb03c9f289 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -1414,9 +1414,14 @@ static inline void msr_check_and_clear(unsigned long bits)
 }
 
 #ifdef CONFIG_PPC32
-#define mfsrin(v)	({unsigned int rval; \
-			asm volatile("mfsrin %0,%1" : "=r" (rval) : "r" (v)); \
-					rval;})
+static inline u32 mfsrin(u32 idx)
+{
+	u32 val;
+
+	asm volatile("mfsrin %0, %1" : "=r" (val): "r" (idx));
+
+	return val;
+}
 
 static inline void mtsrin(u32 val, u32 idx)
 {
diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerpc/kvm/book3s_emulate.c
index b08cc15f31c7..fdb57be71aa6 100644
--- a/arch/powerpc/kvm/book3s_emulate.c
+++ b/arch/powerpc/kvm/book3s_emulate.c
@@ -61,10 +61,6 @@
 #define SPRN_GQR6		918
 #define SPRN_GQR7		919
 
-/* Book3S_32 defines mfsrin(v) - but that messes up our abstract
- * function pointers, so let's just disable the define. */
-#undef mfsrin
-
 enum priv_level {
 	PRIV_PROBLEM = 0,
 	PRIV_SUPER = 1,
-- 
2.25.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help