Commit f554be42 authored by Vasily Gorbik's avatar Vasily Gorbik Committed by Martin Schwidefsky

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: default avatarVasily Gorbik <gor@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 686140a1
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <asm/atomic_ops.h> #include <asm/atomic_ops.h>
#include <asm/barrier.h> #include <asm/barrier.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/alternative.h>
#define SPINLOCK_LOCKVAL (S390_lowcore.spinlock_lockval) #define SPINLOCK_LOCKVAL (S390_lowcore.spinlock_lockval)
...@@ -86,9 +87,7 @@ static inline void arch_spin_unlock(arch_spinlock_t *lp) ...@@ -86,9 +87,7 @@ static inline void arch_spin_unlock(arch_spinlock_t *lp)
{ {
typecheck(int, lp->lock); typecheck(int, lp->lock);
asm volatile( asm volatile(
#ifdef CONFIG_HAVE_MARCH_ZEC12_FEATURES ALTERNATIVE("", ".long 0xb2fa0070", 49) /* NIAI 7 */
" .long 0xb2fa0070\n" /* NIAI 7 */
#endif
" sth %1,%0\n" " sth %1,%0\n"
: "=Q" (((unsigned short *) &lp->lock)[1]) : "=Q" (((unsigned short *) &lp->lock)[1])
: "d" (0) : "cc", "memory"); : "d" (0) : "cc", "memory");
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/percpu.h> #include <linux/percpu.h>
#include <asm/alternative.h>
#include <asm/io.h> #include <asm/io.h>
int spin_retry = -1; int spin_retry = -1;
...@@ -73,9 +74,7 @@ static inline int arch_load_niai4(int *lock) ...@@ -73,9 +74,7 @@ static inline int arch_load_niai4(int *lock)
int owner; int owner;
asm volatile( asm volatile(
#ifdef CONFIG_HAVE_MARCH_ZEC12_FEATURES ALTERNATIVE("", ".long 0xb2fa0040", 49) /* NIAI 4 */
" .long 0xb2fa0040\n" /* NIAI 4 */
#endif
" l %0,%1\n" " l %0,%1\n"
: "=d" (owner) : "Q" (*lock) : "memory"); : "=d" (owner) : "Q" (*lock) : "memory");
return owner; return owner;
...@@ -86,9 +85,7 @@ static inline int arch_cmpxchg_niai8(int *lock, int old, int new) ...@@ -86,9 +85,7 @@ static inline int arch_cmpxchg_niai8(int *lock, int old, int new)
int expected = old; int expected = old;
asm volatile( asm volatile(
#ifdef CONFIG_HAVE_MARCH_ZEC12_FEATURES ALTERNATIVE("", ".long 0xb2fa0080", 49) /* NIAI 8 */
" .long 0xb2fa0080\n" /* NIAI 8 */
#endif
" cs %0,%3,%1\n" " cs %0,%3,%1\n"
: "=d" (old), "=Q" (*lock) : "=d" (old), "=Q" (*lock)
: "0" (old), "d" (new), "Q" (*lock) : "0" (old), "d" (new), "Q" (*lock)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment