summaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2017-06-06 23:08:31 +1000
committerMichael Ellerman <mpe@ellerman.id.au>2017-07-02 20:40:17 +1000
commitede8e2bbb0eb3370e4dc5484b40eb22850a09b92 (patch)
tree495e7183076966dd9ff7ebe2763dd624da0cc354 /arch/powerpc
parentfd851a3cdc196bfc1d229b5f22369069af532bf8 (diff)
downloadlinux-ede8e2bbb0eb3370e4dc5484b40eb22850a09b92.tar.gz
linux-ede8e2bbb0eb3370e4dc5484b40eb22850a09b92.tar.bz2
linux-ede8e2bbb0eb3370e4dc5484b40eb22850a09b92.zip
powerpc/64: implement spin loop primitives
Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/include/asm/processor.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index c49165a7439c..832775771bd3 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -428,6 +428,26 @@ static inline unsigned long __pack_fe01(unsigned int fpmode)
#ifdef CONFIG_PPC64
#define cpu_relax() do { HMT_low(); HMT_medium(); barrier(); } while (0)
+
+#define spin_begin() HMT_low()
+
+#define spin_cpu_relax() barrier()
+
+#define spin_cpu_yield() spin_cpu_relax()
+
+#define spin_end() HMT_medium()
+
+#define spin_until_cond(cond) \
+do { \
+ if (unlikely(!(cond))) { \
+ spin_begin(); \
+ do { \
+ spin_cpu_relax(); \
+ } while (!(cond)); \
+ spin_end(); \
+ } \
+} while (0)
+
#else
#define cpu_relax() barrier()
#endif