summaryrefslogtreecommitdiffstats
path: root/arch/arm64/include/asm/barrier.h
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2018-01-31 15:55:24 +0000
committerWill Deacon <will.deacon@arm.com>2018-07-05 10:05:05 +0100
commit598865c5f32d6e11e99f2aac07348e5fd17cdc03 (patch)
tree139fcf2abd81aee3dfc63e6444a192b497a12049 /arch/arm64/include/asm/barrier.h
parent76f4e2da45b44bf70f61c28fcbc91668492463e0 (diff)
downloadlinux-598865c5f32d6e11e99f2aac07348e5fd17cdc03.tar.bz2
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); \