diff options
author | James Hogan <james.hogan@imgtec.com> | 2016-08-04 17:36:08 +0100 |
---|---|---|
committer | Sasha Levin <alexander.levin@verizon.com> | 2016-08-19 23:08:36 -0400 |
commit | 403f056afd87471b1ef68c0519c8723afae4babb (patch) | |
tree | 66b7e1c022245f4c4d20a448eab0dc2fb4cfe7a0 /arch | |
parent | a2036fb1a801d2b75ddc1d407b97519f9cac5a0b (diff) |
metag: Fix __cmpxchg_u32 asm constraint for CMP
[ Upstream commit 6154c187b97ee7513046bb4eb317a89f738f13ef ]
The LNKGET based atomic sequence in __cmpxchg_u32 has slightly incorrect
constraints for the return value which under certain circumstances can
allow an address unit register to be used as the first operand of a CMP
instruction. This isn't a valid instruction however as the encodings
only allow a data unit to be specified. This would result in an
assembler error like the following:
Error: failed to assemble instruction: "CMP A0.2,D0Ar6"
Fix by changing the constraint from "=&da" (assigned, early clobbered,
data or address unit register) to "=&d" (data unit register only).
The constraint for the second operand, "bd" (an op2 register where op1
is a data unit register and the instruction supports O2R) is already
correct assuming the first operand is a data unit register.
Other cases of CMP in inline asm have had their constraints checked, and
appear to all be fine.
Fixes: 6006c0d8ce94 ("metag: Atomics, locks and bitops")
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-metag@vger.kernel.org
Cc: <stable@vger.kernel.org> # 3.9.x-
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/metag/include/asm/cmpxchg_lnkget.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/metag/include/asm/cmpxchg_lnkget.h b/arch/metag/include/asm/cmpxchg_lnkget.h index 0154e2807ebb..2369ad394876 100644 --- a/arch/metag/include/asm/cmpxchg_lnkget.h +++ b/arch/metag/include/asm/cmpxchg_lnkget.h @@ -73,7 +73,7 @@ static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old, " DCACHE [%2], %0\n" #endif "2:\n" - : "=&d" (temp), "=&da" (retval) + : "=&d" (temp), "=&d" (retval) : "da" (m), "bd" (old), "da" (new) : "cc" ); |