diff mbox series

[2/3] locking/atomic: hexagon: use generic_cmpxchg[64]_local for arch_cmpxchg[64]_local

Message ID 20231026073902.702153-1-wuqiang.matt@bytedance.com (mailing list archive)
State Handled Elsewhere
Headers show
Series [1/3] locking/atomic: arc: use generic_cmpxchg[64]_local for arch_cmpxchg[64]_local | expand

Commit Message

wuqiang.matt Oct. 26, 2023, 7:39 a.m. UTC
arch_cmpxchg[64]_local() are not defined for hexagon. So implement
them with generci_cmpxchg[64]_local, as advised by Masami Hiramatsu.

Closes: https://lore.kernel.org/linux-trace-kernel/169824660459.24340.14614817132696360531.stgit@devnote2
Closes: https://lore.kernel.org/oe-kbuild-all/202310241310.Ir5uukOG-lkp@intel.com

Signed-off-by: wuqiang.matt <wuqiang.matt@bytedance.com>
---
 arch/hexagon/include/asm/cmpxchg.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
diff mbox series

Patch

diff --git a/arch/hexagon/include/asm/cmpxchg.h b/arch/hexagon/include/asm/cmpxchg.h
index bf6cf5579cf4..c14520730194 100644
--- a/arch/hexagon/include/asm/cmpxchg.h
+++ b/arch/hexagon/include/asm/cmpxchg.h
@@ -72,4 +72,18 @@  __arch_xchg(unsigned long x, volatile void *ptr, int size)
 	__oldval;						\
 })
 
+/*
+ * always make arch_cmpxchg[64]_local available. __generic_cmpxchg[64]_local
+ * are atomic with respect to current cpu.
+ */
+#include <asm-generic/cmpxchg-local.h>
+
+#define arch_cmpxchg_local(ptr, o, n) ({				\
+	(__typeof__(*ptr))__generic_cmpxchg_local((ptr),		\
+						(unsigned long)(o),	\
+						(unsigned long)(n),	\
+						sizeof(*(ptr)));	\
+})
+#define arch_cmpxchg64_local(ptr, o, n) __generic_cmpxchg64_local((ptr), (o), (n))
+
 #endif /* _ASM_CMPXCHG_H */