xref: /linux/arch/arm64/include/asm/lse.h (revision 6f7e6393d1ce636bb7ec77a7fe7b77458fddf701)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_LSE_H
3 #define __ASM_LSE_H
4 
5 #include <asm/atomic_ll_sc.h>
6 
7 #define __LSE_PREAMBLE	".arch_extension lse\n"
8 
9 #include <linux/compiler_types.h>
10 #include <linux/export.h>
11 #include <linux/stringify.h>
12 #include <asm/alternative.h>
13 #include <asm/alternative-macros.h>
14 #include <asm/atomic_lse.h>
15 #include <asm/cpucaps.h>
16 
17 #define __lse_ll_sc_body(op, ...)					\
18 ({									\
19 	alternative_has_cap_likely(ARM64_HAS_LSE_ATOMICS) ?		\
20 		__lse_##op(__VA_ARGS__) :				\
21 		__ll_sc_##op(__VA_ARGS__);				\
22 })
23 
24 /* In-line patching at runtime */
25 #define ARM64_LSE_ATOMIC_INSN(llsc, lse)				\
26 	ALTERNATIVE(llsc, __LSE_PREAMBLE lse, ARM64_HAS_LSE_ATOMICS)
27 
28 #endif	/* __ASM_LSE_H */
29