Skip to content

Commit 6191b25

Browse files
Marc Zyngierwilldeacon
authored andcommitted
arm64: Unconditionally enable LSE support
LSE atomics have been in the architecture since ARMv8.1 (released in 2014), and are hopefully supported by all modern toolchains. Drop the optional nature of LSE support in the kernel, and always compile the support in, as this really is very little code. LL/SC still is the default, and the switch to LSE is done dynamically. Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Will Deacon <will@kernel.org>
1 parent e3baa5d commit 6191b25

7 files changed

Lines changed: 0 additions & 66 deletions

File tree

arch/arm64/Kconfig

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1873,22 +1873,6 @@ config ARM64_PAN
18731873
The feature is detected at runtime, and will remain as a 'nop'
18741874
instruction if the cpu does not implement the feature.
18751875

1876-
config ARM64_LSE_ATOMICS
1877-
bool
1878-
default ARM64_USE_LSE_ATOMICS
1879-
1880-
config ARM64_USE_LSE_ATOMICS
1881-
bool "Atomic instructions"
1882-
default y
1883-
help
1884-
As part of the Large System Extensions, ARMv8.1 introduces new
1885-
atomic instructions that are designed specifically to scale in
1886-
very large systems.
1887-
1888-
Say Y here to make use of these instructions for the in-kernel
1889-
atomic routines. This incurs a small overhead on CPUs that do
1890-
not support these instructions.
1891-
18921876
endmenu # "ARMv8.1 architectural features"
18931877

18941878
menu "ARMv8.2 architectural features"

arch/arm64/include/asm/insn.h

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,6 @@ u32 aarch64_insn_gen_extr(enum aarch64_insn_variant variant,
671671
enum aarch64_insn_register Rn,
672672
enum aarch64_insn_register Rd,
673673
u8 lsb);
674-
#ifdef CONFIG_ARM64_LSE_ATOMICS
675674
u32 aarch64_insn_gen_atomic_ld_op(enum aarch64_insn_register result,
676675
enum aarch64_insn_register address,
677676
enum aarch64_insn_register value,
@@ -683,28 +682,6 @@ u32 aarch64_insn_gen_cas(enum aarch64_insn_register result,
683682
enum aarch64_insn_register value,
684683
enum aarch64_insn_size_type size,
685684
enum aarch64_insn_mem_order_type order);
686-
#else
687-
static inline
688-
u32 aarch64_insn_gen_atomic_ld_op(enum aarch64_insn_register result,
689-
enum aarch64_insn_register address,
690-
enum aarch64_insn_register value,
691-
enum aarch64_insn_size_type size,
692-
enum aarch64_insn_mem_atomic_op op,
693-
enum aarch64_insn_mem_order_type order)
694-
{
695-
return AARCH64_BREAK_FAULT;
696-
}
697-
698-
static inline
699-
u32 aarch64_insn_gen_cas(enum aarch64_insn_register result,
700-
enum aarch64_insn_register address,
701-
enum aarch64_insn_register value,
702-
enum aarch64_insn_size_type size,
703-
enum aarch64_insn_mem_order_type order)
704-
{
705-
return AARCH64_BREAK_FAULT;
706-
}
707-
#endif
708685
u32 aarch64_insn_gen_dmb(enum aarch64_insn_mb_type type);
709686
u32 aarch64_insn_gen_dsb(enum aarch64_insn_mb_type type);
710687
u32 aarch64_insn_gen_mrs(enum aarch64_insn_register result,

arch/arm64/include/asm/lse.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
#include <asm/atomic_ll_sc.h>
66

7-
#ifdef CONFIG_ARM64_LSE_ATOMICS
8-
97
#define __LSE_PREAMBLE ".arch_extension lse\n"
108

119
#include <linux/compiler_types.h>
@@ -27,11 +25,4 @@
2725
#define ARM64_LSE_ATOMIC_INSN(llsc, lse) \
2826
ALTERNATIVE(llsc, __LSE_PREAMBLE lse, ARM64_HAS_LSE_ATOMICS)
2927

30-
#else /* CONFIG_ARM64_LSE_ATOMICS */
31-
32-
#define __lse_ll_sc_body(op, ...) __ll_sc_##op(__VA_ARGS__)
33-
34-
#define ARM64_LSE_ATOMIC_INSN(llsc, lse) llsc
35-
36-
#endif /* CONFIG_ARM64_LSE_ATOMICS */
3728
#endif /* __ASM_LSE_H */

arch/arm64/kernel/cpufeature.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2560,15 +2560,13 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
25602560
ARM64_CPUID_FIELDS(ID_AA64MMFR1_EL1, PAN, PAN3)
25612561
},
25622562
#endif /* CONFIG_ARM64_EPAN */
2563-
#ifdef CONFIG_ARM64_LSE_ATOMICS
25642563
{
25652564
.desc = "LSE atomic instructions",
25662565
.capability = ARM64_HAS_LSE_ATOMICS,
25672566
.type = ARM64_CPUCAP_SYSTEM_FEATURE,
25682567
.matches = has_cpuid_feature,
25692568
ARM64_CPUID_FIELDS(ID_AA64ISAR0_EL1, ATOMIC, IMP)
25702569
},
2571-
#endif /* CONFIG_ARM64_LSE_ATOMICS */
25722570
{
25732571
.desc = "Virtualization Host Extensions",
25742572
.capability = ARM64_HAS_VIRT_HOST_EXTN,

arch/arm64/kvm/at.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,7 +1700,6 @@ int __kvm_find_s1_desc_level(struct kvm_vcpu *vcpu, u64 va, u64 ipa, int *level)
17001700
}
17011701
}
17021702

1703-
#ifdef CONFIG_ARM64_LSE_ATOMICS
17041703
static int __lse_swap_desc(u64 __user *ptep, u64 old, u64 new)
17051704
{
17061705
u64 tmp = old;
@@ -1725,12 +1724,6 @@ static int __lse_swap_desc(u64 __user *ptep, u64 old, u64 new)
17251724

17261725
return ret;
17271726
}
1728-
#else
1729-
static int __lse_swap_desc(u64 __user *ptep, u64 old, u64 new)
1730-
{
1731-
return -EINVAL;
1732-
}
1733-
#endif
17341727

17351728
static int __llsc_swap_desc(u64 __user *ptep, u64 old, u64 new)
17361729
{

arch/arm64/lib/insn.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,6 @@ u32 aarch64_insn_gen_load_store_ex(enum aarch64_insn_register reg,
611611
state);
612612
}
613613

614-
#ifdef CONFIG_ARM64_LSE_ATOMICS
615614
static u32 aarch64_insn_encode_ldst_order(enum aarch64_insn_mem_order_type type,
616615
u32 insn)
617616
{
@@ -755,7 +754,6 @@ u32 aarch64_insn_gen_cas(enum aarch64_insn_register result,
755754
return aarch64_insn_encode_register(AARCH64_INSN_REGTYPE_RS, insn,
756755
value);
757756
}
758-
#endif
759757

760758
u32 aarch64_insn_gen_add_sub_imm(enum aarch64_insn_register dst,
761759
enum aarch64_insn_register src,

arch/arm64/net/bpf_jit_comp.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,6 @@ static int emit_atomic_ld_st(const struct bpf_insn *insn, struct jit_ctx *ctx)
776776
return 0;
777777
}
778778

779-
#ifdef CONFIG_ARM64_LSE_ATOMICS
780779
static int emit_lse_atomic(const struct bpf_insn *insn, struct jit_ctx *ctx)
781780
{
782781
const u8 code = insn->code;
@@ -843,12 +842,6 @@ static int emit_lse_atomic(const struct bpf_insn *insn, struct jit_ctx *ctx)
843842

844843
return 0;
845844
}
846-
#else
847-
static inline int emit_lse_atomic(const struct bpf_insn *insn, struct jit_ctx *ctx)
848-
{
849-
return -EINVAL;
850-
}
851-
#endif
852845

853846
static int emit_ll_sc_atomic(const struct bpf_insn *insn, struct jit_ctx *ctx)
854847
{

0 commit comments

Comments
 (0)