diff options
author | Will Deacon <will.deacon@arm.com> | 2018-01-31 16:55:24 +0100 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2018-07-05 11:05:05 +0200 |
commit | 598865c5f32d6e11e99f2aac07348e5fd17cdc03 (patch) | |
tree | 139fcf2abd81aee3dfc63e6444a192b497a12049 /arch/arm64/include/asm/barrier.h | |
parent | arm64: kexec: always reset to EL2 if present (diff) | |
download | linux-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.h | 13 |
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); \ |