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

Borislav Petkov <[email protected]> Fri, 29 May 2026 19:29:45 -0700
Newsgroups dev.linux.lists.x86-cpuid,org.kernel.vger.linux-kernel
Message-ID <20260530022945.GAahpLmX47wsYUs4QH@fat_crate.local>
On Thu, May 28, 2026 at 05:37:31PM +0200, Ahmed S. Darwish wrote:
> Use parsed CPUID(0x0) instead of a direct CPUID query.
> 
> Signed-off-by: Ahmed S. Darwish <[email protected]>
> ---
>  arch/x86/kernel/cpu/common.c | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
> index 5cae6c48dd25..281dc591ea79 100644
> --- a/arch/x86/kernel/cpu/common.c
> +++ b/arch/x86/kernel/cpu/common.c
> @@ -942,11 +942,15 @@ void get_cpu_vendor(struct cpuinfo_x86 *c)
>  
>  void cpu_detect(struct cpuinfo_x86 *c)
>  {
> -	/* Get vendor name */
> -	cpuid(0x00000000, (unsigned int *)&c->cpuid_level,
> -	      (unsigned int *)&c->x86_vendor_id[0],
> -	      (unsigned int *)&c->x86_vendor_id[8],
> -	      (unsigned int *)&c->x86_vendor_id[4]);
> +	const struct leaf_0x0_0 *l0 = cpuid_leaf(c, 0x0);
> +
> +	if (!l0)
> +		return;

What for?

-- 
Regards/Gruss,
    Boris.

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