Re: [PATCH v6 39/90] x86/cacheinfo: Use parsed CPUID(0x8000001d)
From: Maciej Wieczor-Retman
Date: Fri Apr 17 2026 - 10:50:58 EST
On 2026-03-27 at 03:15:53 +0100, 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 part after 'else' also needs to be inside curly brackets.
--
Kind regards
Maciej Wieczór-Retman