Re: [PATCH v7 013/120] x86/cpu: Use parsed CPUID(0x80000000)

From: Borislav Petkov

Date: Mon Jun 01 2026 - 21:24:37 EST


On Thu, May 28, 2026 at 05:37:35PM +0200, Ahmed S. Darwish wrote:
> At early boot code, use parsed CPUID(0x80000000) instead of invoking a
> direct CPUID query.
>
> The original code has the check:
>
> extended_cpuid_level = ((eax & 0xffff0000) == 0x80000000) ? eax : 0;
>
> to protect against Intel 32-bit machines without an extended range, where a
> CPUID(0x80000000) query will repeat the output of the max-valid standard
> CPUID leaf output.
>
> A similar check is already done at the CPUID parser's own CPUID(0x80000000)
> read function:
>
> if (CPUID_RANGE(el0->max_ext_leaf) != CPUID_EXT_START) {
> // Handle error
> }
>
> Thus, for the call-site, the parsed CPUID NULL check below:
>
> el0 = cpuid_leaf(c, 0x80000000);
> extended_cpuid_level = el0 ? el0->max_ext_leaf : 0;
>
> is sufficient.

I don't think this needs the code examples - just explain that the check is
done by the parser now.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette