All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/8xx: Fix do_mtspr_cpu6 build on older compilers
@ 2016-03-15  6:25 Scott Wood
  2016-03-15 10:18 ` Christophe Leroy
  0 siblings, 1 reply; 3+ messages in thread
From: Scott Wood @ 2016-03-15  6:25 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, Scott Wood, Christophe Leroy

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@buserror.net>
Cc: Christophe Leroy <christophe.leroy@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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-15 17:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-15  6:25 [PATCH] powerpc/8xx: Fix do_mtspr_cpu6 build on older compilers Scott Wood
2016-03-15 10:18 ` Christophe Leroy
2016-03-15 17:35   ` Scott Wood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.