1 /* SPDX-License-Identifier: GPL-2.0 */
5 #if defined(CONFIG_AS_LSE) && defined(CONFIG_ARM64_LSE_ATOMICS)
7 #include <linux/stringify.h>
8 #include <asm/alternative.h>
14 .macro alt_lse
, llsc
, lse
15 alternative_insn
"\llsc", "\lse", ARM64_HAS_LSE_ATOMICS
18 #else /* __ASSEMBLER__ */
20 __asm__(".arch_extension lse");
22 /* Move the ll/sc atomics out-of-line */
23 #define __LL_SC_INLINE notrace
24 #define __LL_SC_PREFIX(x) __ll_sc_##x
25 #define __LL_SC_EXPORT(x) EXPORT_SYMBOL(__LL_SC_PREFIX(x))
27 /* Macro for constructing calls to out-of-line ll/sc atomics */
28 #define __LL_SC_CALL(op) "bl\t" __stringify(__LL_SC_PREFIX(op)) "\n"
29 #define __LL_SC_CLOBBERS "x16", "x17", "x30"
31 /* In-line patching at runtime */
32 #define ARM64_LSE_ATOMIC_INSN(llsc, lse) \
33 ALTERNATIVE(llsc, lse, ARM64_HAS_LSE_ATOMICS)
35 #endif /* __ASSEMBLER__ */
36 #else /* CONFIG_AS_LSE && CONFIG_ARM64_LSE_ATOMICS */
40 .macro alt_lse
, llsc
, lse
44 #else /* __ASSEMBLER__ */
46 #define __LL_SC_INLINE static inline
47 #define __LL_SC_PREFIX(x) x
48 #define __LL_SC_EXPORT(x)
50 #define ARM64_LSE_ATOMIC_INSN(llsc, lse) llsc
52 #endif /* __ASSEMBLER__ */
53 #endif /* CONFIG_AS_LSE && CONFIG_ARM64_LSE_ATOMICS */
54 #endif /* __ASM_LSE_H */