summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Leroy <christophe.leroy@csgroup.eu>2021-01-22 07:15:03 +0000
committerMichael Ellerman <mpe@ellerman.id.au>2021-04-21 22:52:32 +1000
commit867e762480f4ad4106b16299a373fa23eccf5b4b (patch)
treeab51452de09976cabdc038caa6d92e49c98238cb
parentf56607e85ee38f2a5bb7096e24e2d40f35d714f9 (diff)
downloadlinux-stable-867e762480f4ad4106b16299a373fa23eccf5b4b.tar.gz
linux-stable-867e762480f4ad4106b16299a373fa23eccf5b4b.tar.bz2
linux-stable-867e762480f4ad4106b16299a373fa23eccf5b4b.zip
powerpc/32: Use r2 in wrtspr() instead of r0
wrtspr() is a function to write an arbitrary value in a special register. It is used on 8xx to write to SPRN_NRI, SPRN_EID and SPRN_EIE. Writing any value to one of those will play with MSR EE and MSR RI regardless of that value. r0 is used many places in the generated code and using r0 for that creates an unnecessary dependency of this instruction with preceding ones using r0 in a few places in vmlinux. r2 is most likely the most stable register as it contains the pointer to 'current'. Using r2 instead of r0 avoids that unnecessary dependency. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/69f9968f4b592fefda55227f0f7430ea612cc950.1611299687.git.christophe.leroy@csgroup.eu
-rw-r--r--arch/powerpc/include/asm/reg.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index 9086a2644c89..7c81d3e563b2 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -1394,8 +1394,7 @@ static inline void mtmsr_isync(unsigned long val)
: "r" ((unsigned long)(v)) \
: "memory")
#endif
-#define wrtspr(rn) asm volatile("mtspr " __stringify(rn) ",0" : \
- : : "memory")
+#define wrtspr(rn) asm volatile("mtspr " __stringify(rn) ",2" : : : "memory")
static inline void wrtee(unsigned long val)
{