Re: [PATCH v7 034/120] x86/cacheinfo: Use parsed CPUID(0x8000001d)

Maciej Wieczor-Retman <[email protected]> Mon, 1 Jun 2026 15:42:34 +0200
Newsgroups dev.linux.lists.x86-cpuid,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On 2026-05-28 at 17:37:56 +0200, Ahmed S. Darwish wrote:
>diff --git a/arch/x86/kernel/cpu/cacheinfo.c b/arch/x86/kernel/cpu/cacheinfo.c
>index 91020f85c000..86a8e1dad935 100644
>--- a/arch/x86/kernel/cpu/cacheinfo.c
>+++ b/arch/x86/kernel/cpu/cacheinfo.c
>@@ -237,16 +237,22 @@ static int cpuid4_info_fill_done(struct _cpuid4_info *id4, union _cpuid4_leaf_ea
> 	return 0;
> }
> 
>-static int amd_fill_cpuid4_info(int index, struct _cpuid4_info *id4)
>+static int amd_fill_cpuid4_info(struct cpuinfo_x86 *c, int index, struct _cpuid4_info *id4)
> {
> 	union _cpuid4_leaf_eax eax;
> 	union _cpuid4_leaf_ebx ebx;
> 	union _cpuid4_leaf_ecx ecx;
>-	u32 ignored;
> 
>-	if (boot_cpu_has(X86_FEATURE_TOPOEXT) || boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)
>-		cpuid_count(0x8000001d, index, &eax.full, &ebx.full, &ecx.full, &ignored);
>-	else
>+	if (boot_cpu_has(X86_FEATURE_TOPOEXT) || boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) {
>+		const struct cpuid_regs *regs = cpuid_subleaf_n_raw(c, 0x8000001d, index);
>+
>+		if (!regs)
>+			return -EIO;
>+
>+		eax.full = regs->eax;
>+		ebx.full = regs->ebx;
>+		ecx.full = regs->ecx;
>+	} else
> 		legacy_amd_cpuid4(index, &eax, &ebx, &ecx);

This 'else' branch still needs the curly brackets per formatting standards.

-- 
Kind regards
Maciej Wieczór-Retman