summaryrefslogtreecommitdiffstats
path: root/arch/arm64/include/asm/barrier.h
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2018-01-31 16:55:24 +0100
committerWill Deacon <will.deacon@arm.com>2018-07-05 11:05:05 +0200
commit598865c5f32d6e11e99f2aac07348e5fd17cdc03 (patch)
tree139fcf2abd81aee3dfc63e6444a192b497a12049 /arch/arm64/include/asm/barrier.h
parentarm64: kexec: always reset to EL2 if present (diff)
downloadlinux-598865c5f32d6e11e99f2aac07348e5fd17cdc03.tar.xz
linux-598865c5f32d6e11e99f2aac07348e5fd17cdc03.zip
arm64: barrier: Implement smp_cond_load_relaxed
We can provide an implementation of smp_cond_load_relaxed using READ_ONCE and __cmpwait_relaxed. Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm64/include/asm/barrier.h')
-rw-r--r--arch/arm64/include/asm/barrier.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/barrier.h b/arch/arm64/include/asm/barrier.h
index f11518af96a9..822a9192c551 100644
--- a/arch/arm64/include/asm/barrier.h
+++ b/arch/arm64/include/asm/barrier.h
@@ -128,6 +128,19 @@ do { \
__u.__val; \
})
+#define smp_cond_load_relaxed(ptr, cond_expr) \
+({ \
+ typeof(ptr) __PTR = (ptr); \
+ typeof(*ptr) VAL; \
+ for (;;) { \
+ VAL = READ_ONCE(*__PTR); \
+ if (cond_expr) \
+ break; \
+ __cmpwait_relaxed(__PTR, VAL); \
+ } \
+ VAL; \
+})
+
#define smp_cond_load_acquire(ptr, cond_expr) \
({ \
typeof(ptr) __PTR = (ptr); \