[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250506050437.10264-27-darwi@linutronix.de>
Date: Tue, 6 May 2025 07:04:37 +0200
From: "Ahmed S. Darwish" <darwi@...utronix.de>
To: Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Andrew Cooper <andrew.cooper3@...rix.com>,
"H. Peter Anvin" <hpa@...or.com>,
John Ogness <john.ogness@...utronix.de>,
x86@...nel.org,
x86-cpuid@...ts.linux.dev,
LKML <linux-kernel@...r.kernel.org>,
"Ahmed S. Darwish" <darwi@...utronix.de>
Subject: [PATCH v1 26/26] x86/cpu: Rescan CPUID table after unlocking the full CPUID range
Intel CPUs have an MSR bit to limit CPUID enumeration to leaf two, which
can be set by old BIOSen before Linux boots.
Rescan the CPU's CPUID table after unlocking its full CPUID range. Use
scanned CPUID(0x0) access, instead of a direct CPUID query, afterwards.
References: 066941bd4eeb ("x86: unmask CPUID levels on Intel CPUs")
References: 0c2f6d04619e ("x86/topology/intel: Unlock CPUID before evaluating anything")
Signed-off-by: Ahmed S. Darwish <darwi@...utronix.de>
---
arch/x86/kernel/cpu/intel.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 5cefe726c18d..461d01e04fb0 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -192,11 +192,14 @@ void intel_unlock_cpuid_leafs(struct cpuinfo_x86 *c)
return;
/*
- * The BIOS can have limited CPUID to leaf 2, which breaks feature
- * enumeration. Unlock it and update the maximum leaf info.
+ * Intel CPUs have an MSR bit to limit CPUID enumeration to CPUID(0x2),
+ * which can be set by old BIOSes before Linux boots. Unlock the CPU's
+ * full CPUID range then rescan its CPUID table.
*/
- if (msr_clear_bit(MSR_IA32_MISC_ENABLE, MSR_IA32_MISC_ENABLE_LIMIT_CPUID_BIT) > 0)
- c->cpuid_level = cpuid_eax(0);
+ if (msr_clear_bit(MSR_IA32_MISC_ENABLE, MSR_IA32_MISC_ENABLE_LIMIT_CPUID_BIT) > 0) {
+ cpuid_rescan_cpu(c);
+ c->cpuid_level = cpudata_cpuid(c, 0x0)->max_std_leaf;
+ }
}
static void early_init_intel(struct cpuinfo_x86 *c)
--
2.49.0
Powered by blists - more mailing lists