1#ifndef __ASM_LSE_H
2#define __ASM_LSE_H
3
4#if defined(CONFIG_AS_LSE) && defined(CONFIG_ARM64_LSE_ATOMICS)
5
6#include <linux/stringify.h>
7#include <asm/alternative.h>
8
9#ifdef __ASSEMBLER__
10
11.arch_extension lse
12
13.macro alt_lse, llsc, lse
14 alternative_insn "\llsc", "\lse", ARM64_HAS_LSE_ATOMICS
15.endm
16
17#else
18
19__asm__(".arch_extension lse");
20
21
22#define __LL_SC_INLINE notrace
23#define __LL_SC_PREFIX(x) __ll_sc_##x
24#define __LL_SC_EXPORT(x) EXPORT_SYMBOL(__LL_SC_PREFIX(x))
25
26
27#define __LL_SC_CALL(op) "bl\t" __stringify(__LL_SC_PREFIX(op)) "\n"
28#define __LL_SC_CLOBBERS "x16", "x17", "x30"
29
30
31#define ARM64_LSE_ATOMIC_INSN(llsc, lse) \
32 ALTERNATIVE(llsc, lse, ARM64_HAS_LSE_ATOMICS)
33
34#endif
35#else
36
37#ifdef __ASSEMBLER__
38
39.macro alt_lse, llsc, lse
40 \llsc
41.endm
42
43#else
44
45#define __LL_SC_INLINE static inline
46#define __LL_SC_PREFIX(x) x
47#define __LL_SC_EXPORT(x)
48
49#define ARM64_LSE_ATOMIC_INSN(llsc, lse) llsc
50
51#endif
52#endif
53#endif
54