Skip to contentSkip to conversation

Patch "metag: Fix __cmpxchg_u32 asm constraint for CMP" has been added to the 3.14-stable tree

PATCH [email protected] 1 participant 1 message Aug 18, 2016 Stable branch

lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

metag: Fix __cmpxchg_u32 asm constraint for CMP

to the 3.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
metag-fix-__cmpxchg_u32-asm-constraint-for-cmp.patch
and it can be found in the queue-3.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 6154c187b97ee7513046bb4eb317a89f738f13ef Mon Sep 17 00:00:00 2001

From: James Hogan <[email protected]>
Date: Thu, 4 Aug 2016 17:36:08 +0100
Subject: metag: Fix __cmpxchg_u32 asm constraint for CMP

From: James Hogan <[email protected]>

commit 6154c187b97ee7513046bb4eb317a89f738f13ef upstream.

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")
---
 arch/metag/include/asm/cmpxchg_lnkget.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/metag/include/asm/cmpxchg_lnkget.h +1 -1
@@ -73,7 +73,7 @@ static inline unsigned long __cmpxchg_u3
 		      "	DCACHE	[%2], %0\n"
 #endif
 		      "2:\n"
-		      : "=&d" (temp), "=&da" (retval)
+		      : "=&d" (temp), "=&d" (retval)
 		      : "da" (m), "bd" (old), "da" (new)
 		      : "cc"
 		      );

Patches currently in stable-queue which might be from [email protected] are

queue-3.14/metag-fix-__cmpxchg_u32-asm-constraint-for-cmp.patch queue-3.14/mips-kvm-add-missing-gfn-range-check.patch queue-3.14/ftrace-recordmcount-work-around-for-addition-of-metag-magic-but-not-relocations.patch queue-3.14/mips-kvm-propagate-kseg0-mapped-tlb-fault-errors.patch queue-3.14/mips-kvm-fix-mapped-fault-broken-commpage-handling.patch queue-3.14/mips-kvm-fix-gfn-range-check-in-kseg0-tlb-faults.patch