Skip to content

Commit 395af86

Browse files
ctmarinaswilldeacon
authored andcommitted
arm64: Move the LSE gas support detection to Kconfig
As the Kconfig syntax gained support for $(as-instr) tests, move the LSE gas support detection from Makefile to the main arm64 Kconfig and remove the additional CONFIG_AS_LSE definition and check. Cc: Will Deacon <[email protected]> Reviewed-by: Vladimir Murzin <[email protected]> Tested-by: Vladimir Murzin <[email protected]> Signed-off-by: Catalin Marinas <[email protected]> Signed-off-by: Will Deacon <[email protected]>
1 parent 42d519e commit 395af86

File tree

5 files changed

+15
-13
lines changed

5 files changed

+15
-13
lines changed

arch/arm64/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,6 +1363,11 @@ config ARM64_PAN
13631363
instruction if the cpu does not implement the feature.
13641364

13651365
config ARM64_LSE_ATOMICS
1366+
bool
1367+
default ARM64_USE_LSE_ATOMICS
1368+
depends on $(as-instr,.arch_extension lse)
1369+
1370+
config ARM64_USE_LSE_ATOMICS
13661371
bool "Atomic instructions"
13671372
depends on JUMP_LABEL
13681373
default y

arch/arm64/Makefile

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,8 @@ LDFLAGS_vmlinux += --fix-cortex-a53-843419
3030
endif
3131
endif
3232

33-
# Check for binutils support for specific extensions
34-
lseinstr := $(call as-instr,.arch_extension lse,-DCONFIG_AS_LSE=1)
35-
36-
ifeq ($(CONFIG_ARM64_LSE_ATOMICS), y)
37-
ifeq ($(lseinstr),)
33+
ifeq ($(CONFIG_ARM64_USE_LSE_ATOMICS), y)
34+
ifneq ($(CONFIG_ARM64_LSE_ATOMICS), y)
3835
$(warning LSE atomics not supported by binutils)
3936
endif
4037
endif
@@ -53,11 +50,11 @@ $(warning Detected assembler with broken .inst; disassembly will be unreliable)
5350
endif
5451
endif
5552

56-
KBUILD_CFLAGS += -mgeneral-regs-only $(lseinstr) $(brokengasinst) \
53+
KBUILD_CFLAGS += -mgeneral-regs-only $(brokengasinst) \
5754
$(compat_vdso) $(cc_has_k_constraint)
5855
KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
5956
KBUILD_CFLAGS += $(call cc-disable-warning, psabi)
60-
KBUILD_AFLAGS += $(lseinstr) $(brokengasinst) $(compat_vdso)
57+
KBUILD_AFLAGS += $(brokengasinst) $(compat_vdso)
6158

6259
KBUILD_CFLAGS += $(call cc-option,-mabi=lp64)
6360
KBUILD_AFLAGS += $(call cc-option,-mabi=lp64)

arch/arm64/include/asm/atomic_ll_sc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#include <linux/stringify.h>
1414

15-
#if IS_ENABLED(CONFIG_ARM64_LSE_ATOMICS) && IS_ENABLED(CONFIG_AS_LSE)
15+
#ifdef CONFIG_ARM64_LSE_ATOMICS
1616
#define __LL_SC_FALLBACK(asm_ops) \
1717
" b 3f\n" \
1818
" .subsection 1\n" \

arch/arm64/include/asm/lse.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#include <asm/atomic_ll_sc.h>
66

7-
#if defined(CONFIG_AS_LSE) && defined(CONFIG_ARM64_LSE_ATOMICS)
7+
#ifdef CONFIG_ARM64_LSE_ATOMICS
88

99
#include <linux/compiler_types.h>
1010
#include <linux/export.h>
@@ -36,13 +36,13 @@ static inline bool system_uses_lse_atomics(void)
3636
#define ARM64_LSE_ATOMIC_INSN(llsc, lse) \
3737
ALTERNATIVE(llsc, lse, ARM64_HAS_LSE_ATOMICS)
3838

39-
#else /* CONFIG_AS_LSE && CONFIG_ARM64_LSE_ATOMICS */
39+
#else /* CONFIG_ARM64_LSE_ATOMICS */
4040

4141
static inline bool system_uses_lse_atomics(void) { return false; }
4242

4343
#define __lse_ll_sc_body(op, ...) __ll_sc_##op(__VA_ARGS__)
4444

4545
#define ARM64_LSE_ATOMIC_INSN(llsc, lse) llsc
4646

47-
#endif /* CONFIG_AS_LSE && CONFIG_ARM64_LSE_ATOMICS */
47+
#endif /* CONFIG_ARM64_LSE_ATOMICS */
4848
#endif /* __ASM_LSE_H */

arch/arm64/kernel/cpufeature.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,7 +1291,7 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
12911291
.cpu_enable = cpu_enable_pan,
12921292
},
12931293
#endif /* CONFIG_ARM64_PAN */
1294-
#if defined(CONFIG_AS_LSE) && defined(CONFIG_ARM64_LSE_ATOMICS)
1294+
#ifdef CONFIG_ARM64_LSE_ATOMICS
12951295
{
12961296
.desc = "LSE atomic instructions",
12971297
.capability = ARM64_HAS_LSE_ATOMICS,
@@ -1302,7 +1302,7 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
13021302
.sign = FTR_UNSIGNED,
13031303
.min_field_value = 2,
13041304
},
1305-
#endif /* CONFIG_AS_LSE && CONFIG_ARM64_LSE_ATOMICS */
1305+
#endif /* CONFIG_ARM64_LSE_ATOMICS */
13061306
{
13071307
.desc = "Software prefetching using PRFM",
13081308
.capability = ARM64_HAS_NO_HW_PREFETCH,

0 commit comments

Comments
 (0)