Re: [PATCH v7 018/120] x86/cpuid: Parse CPUID(0x16)

From: Ahmed S. Darwish

Date: Thu Jun 18 2026 - 15:37:03 EST


On Thu, 18 Jun 2026, Borislav Petkov wrote:
>
> On Thu, May 28, 2026 at 05:37:40PM +0200, Ahmed S. Darwish wrote:
> > diff --git a/arch/x86/kernel/cpu/cpuid_parser.h b/arch/x86/kernel/cpu/cpuid_parser.h
> > index 8b0d44b745c5..ee1958f3d369 100644
> > --- a/arch/x86/kernel/cpu/cpuid_parser.h
> > +++ b/arch/x86/kernel/cpu/cpuid_parser.h
> > @@ -144,6 +144,7 @@ struct cpuid_parse_entry {
> > */
> > #define CPUID_COMMON_ENTRIES \
> > /* Leaf Subleaf Reader function */ \
> > + CPUID_PARSE_ENTRY ( 0x16, 0, generic ), \
> > CPUID_PARSE_ENTRY ( 0x80000000, 0, 0x80000000 ), \
> > CPUID_PARSE_ENTRY ( 0x80000002, 0, generic ), \
> > CPUID_PARSE_ENTRY ( 0x80000003, 0, generic ), \
> > @@ -180,5 +181,6 @@ struct cpuid_vendor_entry {
> >
> > #define CPUID_VENDOR_ENTRIES \
> > /* Leaf Vendor list */ \
> > + CPUID_VENDOR_ENTRY(0x16, X86_VENDOR_INTEL), \
> >
>
> If this leaf is Intel-specific, why is it being added to the common entries
> too?

CPUID leaf parsing entries are split into:

CPUID_EARLY_ENTRIES
CPUID_COMMON_ENTRIES

CPUID_VENDOR_ENTRIES is not a parser entries table. It just attaches
vendor tags to a leaf if/when a leaf needs it.

The confusion stems from naming the vendor tags table with an _ENTRIES
suffix, just like EARLY and COMMON.

I'll find a better name for it. I guess CPUID_VENDOR_TAGS should work.

>
> * For vendor-specific leaves, a matching entry must be added to the CPUID leaf
> * vendor table later defined. Leaves which are here, but without a matching
> * vendor entry, are treated by the CPUID parser as valid for all x86 vendors.
>
> Why?
>
>
> I guess it has to do with that vendor parsing in 016 but parsing things twice
> better have a very good justification.
>

If a CPUID leaf parser entry has no vendor tag, then it's parsed for all
x86 vendors.

There's no parsing things twice here. Sorry, I guess it just that way
because of the CPUID_VENDOR_ENTRIES name misnormer.

Thanks!
Ahmed