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

"Ahmed S. Darwish" <[email protected]> Tue, 2 Jun 2026 15:28:36 +0200
Newsgroups dev.linux.lists.x86-cpuid,org.kernel.vger.linux-kernel
Message-ID <ah7ahOrmPfhX_7bT@lx-t490>
On Mon, 01 Jun 2026, Borislav Petkov wrote:
>
> On Mon, Jun 01, 2026 at 07:34:03PM +0200, Maciej Wieczor-Retman wrote:
> > I think at this point in the series 'c' is not initialized if you follow:
> >
> > microcode_check()
> > 	-> store_cpu_caps()
> > 		-> get_cpu_cap()
>
> How do you mean?
>
> the el0 in get_cpu_cap() uses the already parsed during early boot leaf while
> microcode_check() is the late microcode loading path which happens when the
> admin sets it in motion.
>
> Or what am I missing?
>

He is correct.

    microcode_check(struct cpuinfo_x86 *prev_info) {
	struct cpuinfo_x86 curr_info;

	...
	store_cpu_caps(&curr_info);
    }

    store_cpu_caps(struct cpuinfo_x86 *curr_info) {
	// Unlike x86_capability[], the CPUID table contents are not copied
	memcpy(&curr_info->x86_capability, &boot_cpu_data.x86_capability, ...);

	get_cpu_cap(curr_info);
    }

    get_cpu_cap(struct cpuinfo_x86 *c) {
	...

	// Output extraction from an un-initialized stack space
	el0 = cpuid_leaf(c, 0x80000000);
    }

I'll fix it.

Thanks,
Ahmed