Commit 598865c5 authored by Will Deacon's avatar Will Deacon
Browse files

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: default avatarWill Deacon <will.deacon@arm.com>
parent 76f4e2da
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -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);					\