summaryrefslogtreecommitdiffstats
path: root/arch/s390/lib
diff options
context:
space:
mode:
authorVasily Gorbik <gor@linux.vnet.ibm.com>2017-10-12 13:01:47 +0200
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2017-10-18 14:11:33 +0200
commitf554be42fd0fd8dd14680c67f2db26b3e7de9670 (patch)
tree68d1e054f9a40bbe29d3d5b3c2ef79437d6e71ee /arch/s390/lib
parent686140a1a9c41d85a4212a1c26d671139b76404b (diff)
downloadlinux-stable-f554be42fd0fd8dd14680c67f2db26b3e7de9670.tar.gz
linux-stable-f554be42fd0fd8dd14680c67f2db26b3e7de9670.tar.bz2
linux-stable-f554be42fd0fd8dd14680c67f2db26b3e7de9670.zip
s390/spinlock: use cpu alternatives to enable niai instruction
Enable niai instruction in the spinlock code at run-time for machines on which facility 49 is available (zEC12 and newer). Signed-off-by: Vasily Gorbik <gor@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/lib')
-rw-r--r--arch/s390/lib/spinlock.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/arch/s390/lib/spinlock.c b/arch/s390/lib/spinlock.c
index 43b0d46c3786..920503174252 100644
--- a/arch/s390/lib/spinlock.c
+++ b/arch/s390/lib/spinlock.c
@@ -12,6 +12,7 @@
#include <linux/init.h>
#include <linux/smp.h>
#include <linux/percpu.h>
+#include <asm/alternative.h>
#include <asm/io.h>
int spin_retry = -1;
@@ -73,9 +74,7 @@ static inline int arch_load_niai4(int *lock)
int owner;
asm volatile(
-#ifdef CONFIG_HAVE_MARCH_ZEC12_FEATURES
- " .long 0xb2fa0040\n" /* NIAI 4 */
-#endif
+ ALTERNATIVE("", ".long 0xb2fa0040", 49) /* NIAI 4 */
" l %0,%1\n"
: "=d" (owner) : "Q" (*lock) : "memory");
return owner;
@@ -86,9 +85,7 @@ static inline int arch_cmpxchg_niai8(int *lock, int old, int new)
int expected = old;
asm volatile(
-#ifdef CONFIG_HAVE_MARCH_ZEC12_FEATURES
- " .long 0xb2fa0080\n" /* NIAI 8 */
-#endif
+ ALTERNATIVE("", ".long 0xb2fa0080", 49) /* NIAI 8 */
" cs %0,%3,%1\n"
: "=d" (old), "=Q" (*lock)
: "0" (old), "d" (new), "Q" (*lock)