Skip to content

Commit

Permalink
powerpc/asm: Remove UPD_CONSTR after GCC 4.9 removal
Browse files Browse the repository at this point in the history
UPD_CONSTR was previously a preprocessor define for an old GCC 4.9
inline asm bug with m<> constraints.

Fixes: 6563139 ("powerpc: remove GCC version check for UPD_CONSTR")
Suggested-by: Nathan Chancellor <[email protected]>
Suggested-by: Christophe Leroy <[email protected]>
Suggested-by: Michael Ellerman <[email protected]>
Signed-off-by: Nick Desaulniers <[email protected]>
Reviewed-by: Nathan Chancellor <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
nickdesaulniers authored and mpe committed Oct 8, 2021
1 parent 7eff9bc commit 2a24d80
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
2 changes: 0 additions & 2 deletions arch/powerpc/include/asm/asm-const.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@
# define ASM_CONST(x) __ASM_CONST(x)
#endif

#define UPD_CONSTR "<>"

#endif /* _ASM_POWERPC_ASM_CONST_H */
8 changes: 4 additions & 4 deletions arch/powerpc/include/asm/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ static __inline__ int arch_atomic_read(const atomic_t *v)
{
int t;

__asm__ __volatile__("lwz%U1%X1 %0,%1" : "=r"(t) : "m"UPD_CONSTR(v->counter));
__asm__ __volatile__("lwz%U1%X1 %0,%1" : "=r"(t) : "m<>"(v->counter));

return t;
}

static __inline__ void arch_atomic_set(atomic_t *v, int i)
{
__asm__ __volatile__("stw%U0%X0 %1,%0" : "=m"UPD_CONSTR(v->counter) : "r"(i));
__asm__ __volatile__("stw%U0%X0 %1,%0" : "=m<>"(v->counter) : "r"(i));
}

#define ATOMIC_OP(op, asm_op) \
Expand Down Expand Up @@ -320,14 +320,14 @@ static __inline__ s64 arch_atomic64_read(const atomic64_t *v)
{
s64 t;

__asm__ __volatile__("ld%U1%X1 %0,%1" : "=r"(t) : "m"UPD_CONSTR(v->counter));
__asm__ __volatile__("ld%U1%X1 %0,%1" : "=r"(t) : "m<>"(v->counter));

return t;
}

static __inline__ void arch_atomic64_set(atomic64_t *v, s64 i)
{
__asm__ __volatile__("std%U0%X0 %1,%0" : "=m"UPD_CONSTR(v->counter) : "r"(i));
__asm__ __volatile__("std%U0%X0 %1,%0" : "=m<>"(v->counter) : "r"(i));
}

#define ATOMIC64_OP(op, asm_op) \
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/include/asm/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ static inline u##size name(const volatile u##size __iomem *addr) \
{ \
u##size ret; \
__asm__ __volatile__("sync;"#insn"%U1%X1 %0,%1;twi 0,%0,0;isync"\
: "=r" (ret) : "m"UPD_CONSTR (*addr) : "memory"); \
: "=r" (ret) : "m<>" (*addr) : "memory"); \
return ret; \
}

#define DEF_MMIO_OUT_D(name, size, insn) \
static inline void name(volatile u##size __iomem *addr, u##size val) \
{ \
__asm__ __volatile__("sync;"#insn"%U0%X0 %1,%0" \
: "=m"UPD_CONSTR (*addr) : "r" (val) : "memory"); \
: "=m<>" (*addr) : "r" (val) : "memory"); \
mmiowb_set_pending(); \
}

Expand Down
6 changes: 3 additions & 3 deletions arch/powerpc/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ __pu_failed: \
"1: " op "%U1%X1 %0,%1 # put_user\n" \
EX_TABLE(1b, %l2) \
: \
: "r" (x), "m"UPD_CONSTR (*addr) \
: "r" (x), "m<>" (*addr) \
: \
: label)

Expand Down Expand Up @@ -143,7 +143,7 @@ do { \
"1: "op"%U1%X1 %0, %1 # get_user\n" \
EX_TABLE(1b, %l2) \
: "=r" (x) \
: "m"UPD_CONSTR (*addr) \
: "m<>" (*addr) \
: \
: label)

Expand Down Expand Up @@ -200,7 +200,7 @@ __gus_failed: \
".previous\n" \
EX_TABLE(1b, 3b) \
: "=r" (err), "=r" (x) \
: "m"UPD_CONSTR (*addr), "i" (-EFAULT), "0" (err))
: "m<>" (*addr), "i" (-EFAULT), "0" (err))

#ifdef __powerpc64__
#define __get_user_asm2(x, addr, err) \
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/kvm/powerpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ static inline u64 sp_to_dp(u32 fprs)

preempt_disable();
enable_kernel_fp();
asm ("lfs%U1%X1 0,%1; stfd%U0%X0 0,%0" : "=m"UPD_CONSTR (fprd) : "m"UPD_CONSTR (fprs)
asm ("lfs%U1%X1 0,%1; stfd%U0%X0 0,%0" : "=m<>" (fprd) : "m<>" (fprs)
: "fr0");
preempt_enable();
return fprd;
Expand All @@ -1106,7 +1106,7 @@ static inline u32 dp_to_sp(u64 fprd)

preempt_disable();
enable_kernel_fp();
asm ("lfd%U1%X1 0,%1; stfs%U0%X0 0,%0" : "=m"UPD_CONSTR (fprs) : "m"UPD_CONSTR (fprd)
asm ("lfd%U1%X1 0,%1; stfs%U0%X0 0,%0" : "=m<>" (fprs) : "m<>" (fprd)
: "fr0");
preempt_enable();
return fprs;
Expand Down

0 comments on commit 2a24d80

Please sign in to comment.