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

Borislav Petkov <[email protected]> Thu, 18 Jun 2026 11:52:31 -0700
Newsgroups dev.linux.lists.x86-cpuid,org.kernel.vger.linux-kernel
Message-ID <20260618185231.GCajQ-b8VSy19-y6xZ@fat_crate.local>
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?

 * 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.

Thx.

-- 
Regards/Gruss,
    Boris.

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