cpu: Re-enable CPU mitigations by default for !X86 architectures

Rename x86's to CPU_MITIGATIONS, define it in generic code, and force it
on for all architectures exception x86. A recent commit to turn
mitigations off by default if SPECULATION_MITIGATIONS=n kinda sorta
missed that "cpu_mitigations" is completely generic, whereas
SPECULATION_MITIGATIONS is x86-specific.

Rename x86's SPECULATIVE_MITIGATIONS instead of keeping both and have it
select CPU_MITIGATIONS, as having two configs for the same thing is
unnecessary and confusing. This will also allow x86 to use the knob to
manage mitigations that aren't strictly related to speculative
execution.

Use another Kconfig to communicate to common code that CPU_MITIGATIONS
is already defined instead of having x86's menu depend on the common
CPU_MITIGATIONS. This allows keeping a single point of contact for all
of x86's mitigations, and it's not clear that other architectures *want*
to allow disabling mitigations at compile-time.

Fixes: f337a6a21e2f ("x86/cpu: Actually turn off mitigations by default for SPECULATION_MITIGATIONS=n")
Closes: https://lkml.kernel.org/r/20240413115324.53303a68%40canb.auug.org.au
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Reported-by: Michael Ellerman <mpe@ellerman.id.au>
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
Acked-by: Borislav Petkov (AMD) <bp@alien8.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20240420000556.2645001-2-seanjc@google.com

authored by Sean Christopherson and committed by Borislav Petkov (AMD) fe42754b a0a8d15a

Changed files
+16 -7
arch
kernel
+8
arch/Kconfig
··· 9 9 # 10 10 source "arch/$(SRCARCH)/Kconfig" 11 11 12 + config ARCH_CONFIGURES_CPU_MITIGATIONS 13 + bool 14 + 15 + if !ARCH_CONFIGURES_CPU_MITIGATIONS 16 + config CPU_MITIGATIONS 17 + def_bool y 18 + endif 19 + 12 20 menu "General architecture-dependent options" 13 21 14 22 config ARCH_HAS_SUBPAGE_FAULTS
+6 -5
arch/x86/Kconfig
··· 62 62 select ACPI_HOTPLUG_CPU if ACPI_PROCESSOR && HOTPLUG_CPU 63 63 select ARCH_32BIT_OFF_T if X86_32 64 64 select ARCH_CLOCKSOURCE_INIT 65 + select ARCH_CONFIGURES_CPU_MITIGATIONS 65 66 select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE 66 67 select ARCH_ENABLE_HUGEPAGE_MIGRATION if X86_64 && HUGETLB_PAGE && MIGRATION 67 68 select ARCH_ENABLE_MEMORY_HOTPLUG if X86_64 ··· 2489 2488 def_bool y 2490 2489 depends on CALL_PADDING && !CFI_CLANG 2491 2490 2492 - menuconfig SPECULATION_MITIGATIONS 2493 - bool "Mitigations for speculative execution vulnerabilities" 2491 + menuconfig CPU_MITIGATIONS 2492 + bool "Mitigations for CPU vulnerabilities" 2494 2493 default y 2495 2494 help 2496 - Say Y here to enable options which enable mitigations for 2497 - speculative execution hardware vulnerabilities. 2495 + Say Y here to enable options which enable mitigations for hardware 2496 + vulnerabilities (usually related to speculative execution). 2498 2497 2499 2498 If you say N, all mitigations will be disabled. You really 2500 2499 should know what you are doing to say so. 2501 2500 2502 - if SPECULATION_MITIGATIONS 2501 + if CPU_MITIGATIONS 2503 2502 2504 2503 config MITIGATION_PAGE_TABLE_ISOLATION 2505 2504 bool "Remove the kernel mapping in user mode"
+2 -2
kernel/cpu.c
··· 3207 3207 }; 3208 3208 3209 3209 static enum cpu_mitigations cpu_mitigations __ro_after_init = 3210 - IS_ENABLED(CONFIG_SPECULATION_MITIGATIONS) ? CPU_MITIGATIONS_AUTO : 3211 - CPU_MITIGATIONS_OFF; 3210 + IS_ENABLED(CONFIG_CPU_MITIGATIONS) ? CPU_MITIGATIONS_AUTO : 3211 + CPU_MITIGATIONS_OFF; 3212 3212 3213 3213 static int __init mitigations_parse_cmdline(char *arg) 3214 3214 {