[PATCH v7 028/120] x86/cpu: Use parsed CPUID(0x2)

From: Ahmed S. Darwish

Date: Thu May 28 2026 - 12:01:22 EST


For Intel TLB detection, use parsed CPUID(0x2) instead of a direct CPUID
query.

Remove the maximum CPUID level check since the CPUID API's NULL check is
equivalent.

Signed-off-by: Ahmed S. Darwish <darwi@xxxxxxxxxxxxx>
---
arch/x86/kernel/cpu/intel.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index f28c0efb7c8f..4d190dd64e95 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -709,14 +709,14 @@ static void intel_tlb_lookup(const struct leaf_0x2_table *desc)
static void intel_detect_tlb(struct cpuinfo_x86 *c)
{
const struct leaf_0x2_table *desc;
- union leaf_0x2_regs regs;
- u8 *ptr;
+ const struct cpuid_regs *regs;
+ const u8 *ptr;

- if (c->cpuid_level < 2)
+ regs = cpuid_leaf_raw(c, 0x2);
+ if (!regs)
return;

- cpuid_leaf_0x2(&regs);
- for_each_cpuid_0x2_desc(regs, ptr, desc)
+ for_each_parsed_cpuid_0x2_desc(regs, ptr, desc)
intel_tlb_lookup(desc);
}

--
2.54.0