[PATCH] powerpc/8xx: Fix do_mtspr_cpu6 build on older compilers

Scott Wood oss at buserror.net
Tue Mar 15 17:25:51 AEDT 2016


Some versions of GCC, reportedly before 4.9, fail with
arch/powerpc/mm/8xx_mmu.c:139:2: error: memory input 1 is not directly
addressable

Use a register constraint instead of a memory constraint to avoid this.
Also change the one-element array into a simple variable.

Signed-off-by: Scott Wood <oss at buserror.net>
Cc: Christophe Leroy <christophe.leroy at c-s.fr>
---
Christope, could you test?  And was there any particular reason for the [1]?

 arch/powerpc/include/asm/reg_8xx.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/include/asm/reg_8xx.h b/arch/powerpc/include/asm/reg_8xx.h
index d41412c..cb7dfb9 100644
--- a/arch/powerpc/include/asm/reg_8xx.h
+++ b/arch/powerpc/include/asm/reg_8xx.h
@@ -53,11 +53,11 @@
 #ifdef CONFIG_8xx_CPU6
 #define do_mtspr_cpu6(rn, rn_addr, v)	\
 	do {								\
-		int _reg_cpu6 = rn_addr, _tmp_cpu6[1];		\
-		asm volatile("stw %0, %1;"				\
-			     "lwz %0, %1;"				\
+		int _reg_cpu6 = rn_addr, _tmp_cpu6;		\
+		asm volatile("stwx %0, 0, %1;"				\
+			     "lwzx %0, 0, %1;"				\
 			     "mtspr " __stringify(rn) ",%2" :		\
-			     : "r" (_reg_cpu6), "m"(_tmp_cpu6),		\
+			     : "r" (_reg_cpu6), "r" (&_tmp_cpu6),	\
 			       "r" ((unsigned long)(v))			\
 			     : "memory");				\
 	} while (0)
-- 
2.5.0



More information about the Linuxppc-dev mailing list