summaryrefslogtreecommitdiff
path: root/arch/x86/kernel/cpu/common.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-04-14 14:24:45 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2026-04-14 14:24:45 -0700
commit9f2bb6c7b364f186aa37c524f6df33bd488d4efa (patch)
treebb3334b84c1bfaaed5ac763282d1f8a38d3db946 /arch/x86/kernel/cpu/common.c
parent49b30f3e9cde3403b8719dfcddc923bce572b69c (diff)
parent124ad3034ec0029b65178f3ab8a6cdca5a0b0519 (diff)
downloadlinux-next-9f2bb6c7b364f186aa37c524f6df33bd488d4efa.tar.gz
linux-next-9f2bb6c7b364f186aa37c524f6df33bd488d4efa.zip
Merge tag 'x86_cpu_for_7.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 cpu updates from Dave Hansen: - Complete LASS enabling: deal with vsyscall and EFI The existing Linear Address Space Separation (LASS) support punted on support for common EFI and vsyscall configs. Complete the implementation by supporting EFI and vsyscall=xonly. - Clean up CPUID usage in newer Intel "avs" audio driver and update the x86-cpuid-db file * tag 'x86_cpu_for_7.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: tools/x86/kcpuid: Update bitfields to x86-cpuid-db v3.0 ASoC: Intel: avs: Include CPUID header at file scope ASoC: Intel: avs: Check maximum valid CPUID leaf x86/cpu: Remove LASS restriction on vsyscall emulation x86/vsyscall: Disable LASS if vsyscall mode is set to EMULATE x86/vsyscall: Restore vsyscall=xonly mode under LASS x86/traps: Consolidate user fixups in the #GP handler x86/vsyscall: Reorganize the page fault emulation code x86/cpu: Remove LASS restriction on EFI x86/efi: Disable LASS while executing runtime services x86/cpu: Defer LASS enabling until userspace comes up
Diffstat (limited to 'arch/x86/kernel/cpu/common.c')
-rw-r--r--arch/x86/kernel/cpu/common.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index ec0670114efa..8060cccd24d8 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -409,27 +409,29 @@ out:
cr4_clear_bits(X86_CR4_UMIP);
}
-static __always_inline void setup_lass(struct cpuinfo_x86 *c)
+static int enable_lass(unsigned int cpu)
+{
+ cr4_set_bits(X86_CR4_LASS);
+
+ return 0;
+}
+
+/*
+ * Finalize features that need to be enabled just before entering
+ * userspace. Note that this only runs on a single CPU. Use appropriate
+ * callbacks if all the CPUs need to reflect the same change.
+ */
+static int cpu_finalize_pre_userspace(void)
{
if (!cpu_feature_enabled(X86_FEATURE_LASS))
- return;
+ return 0;
- /*
- * Legacy vsyscall page access causes a #GP when LASS is active.
- * Disable LASS because the #GP handler doesn't support vsyscall
- * emulation.
- *
- * Also disable LASS when running under EFI, as some runtime and
- * boot services rely on 1:1 mappings in the lower half.
- */
- if (IS_ENABLED(CONFIG_X86_VSYSCALL_EMULATION) ||
- IS_ENABLED(CONFIG_EFI)) {
- setup_clear_cpu_cap(X86_FEATURE_LASS);
- return;
- }
+ /* Runs on all online CPUs and future CPUs that come online. */
+ cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "x86/lass:enable", enable_lass, NULL);
- cr4_set_bits(X86_CR4_LASS);
+ return 0;
}
+late_initcall(cpu_finalize_pre_userspace);
/* These bits should not change their value after CPU init is finished. */
static const unsigned long cr4_pinned_mask = X86_CR4_SMEP | X86_CR4_SMAP | X86_CR4_UMIP |
@@ -2061,7 +2063,6 @@ static void identify_cpu(struct cpuinfo_x86 *c)
setup_smep(c);
setup_smap(c);
setup_umip(c);
- setup_lass(c);
/*
* The vendor-specific functions might have changed features.