]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - arch/arm64/include/asm/lse.h
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[mirror_ubuntu-bionic-kernel.git] / arch / arm64 / include / asm / lse.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
c09d6a04
WD
2#ifndef __ASM_LSE_H
3#define __ASM_LSE_H
4
5#if defined(CONFIG_AS_LSE) && defined(CONFIG_ARM64_LSE_ATOMICS)
6
7#include <linux/stringify.h>
c09d6a04 8#include <asm/alternative.h>
c09d6a04 9
084f9037
WD
10#ifdef __ASSEMBLER__
11
12.arch_extension lse
13
14.macro alt_lse, llsc, lse
c739dc83 15 alternative_insn "\llsc", "\lse", ARM64_HAS_LSE_ATOMICS
084f9037
WD
16.endm
17
18#else /* __ASSEMBLER__ */
19
c09d6a04
WD
20__asm__(".arch_extension lse");
21
22/* Move the ll/sc atomics out-of-line */
b7eed6dd 23#define __LL_SC_INLINE notrace
c09d6a04
WD
24#define __LL_SC_PREFIX(x) __ll_sc_##x
25#define __LL_SC_EXPORT(x) EXPORT_SYMBOL(__LL_SC_PREFIX(x))
26
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"
5be8b70a 29#define __LL_SC_CLOBBERS "x16", "x17", "x30"
c09d6a04
WD
30
31/* In-line patching at runtime */
32#define ARM64_LSE_ATOMIC_INSN(llsc, lse) \
c739dc83 33 ALTERNATIVE(llsc, lse, ARM64_HAS_LSE_ATOMICS)
c09d6a04 34
084f9037
WD
35#endif /* __ASSEMBLER__ */
36#else /* CONFIG_AS_LSE && CONFIG_ARM64_LSE_ATOMICS */
37
38#ifdef __ASSEMBLER__
39
40.macro alt_lse, llsc, lse
41 \llsc
42.endm
43
44#else /* __ASSEMBLER__ */
c09d6a04
WD
45
46#define __LL_SC_INLINE static inline
47#define __LL_SC_PREFIX(x) x
48#define __LL_SC_EXPORT(x)
49
50#define ARM64_LSE_ATOMIC_INSN(llsc, lse) llsc
51
084f9037 52#endif /* __ASSEMBLER__ */
c09d6a04
WD
53#endif /* CONFIG_AS_LSE && CONFIG_ARM64_LSE_ATOMICS */
54#endif /* __ASM_LSE_H */