Re: [PATCH 1/2] x86/topology: Name the AMD core-type values

From: Pawan Gupta

Date: Tue Jul 07 2026 - 13:53:03 EST


On Mon, Jul 06, 2026 at 05:47:13PM -0700, Borislav Petkov wrote:
> On Mon, Jul 06, 2026 at 11:29:07AM -0700, Pawan Gupta wrote:
> > > /**
> > > * x86_match_cpu - match current CPU against an array of x86_cpu_ids
> > > * @match: Pointer to array of x86_cpu_ids. Last entry terminated with
> > > @@ -81,7 +53,7 @@ const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id *match)
> > > continue;
> > > if (m->feature != X86_FEATURE_ANY && !cpu_has(c, m->feature))
> > > continue;
> > > - if (!x86_match_vendor_cpu_type(c, m))
> > > + if (m->type != X86_CPU_TYPE_ANY && c->topo.cpu_type != m->type)
> >
> > ... matching a hybrid CPU to any cpu_type.
>
> I don't know what you mean here.

Vulnerability enumeration is done on the BSP, for a hybrid system with BSP
as a performance-core, a vulnerability that only affects efficiency-cores
would not be enumerated. So, x86_match_cpu() currently returns a match for
any cpu-type on a hybrid system.

> enum x86_topology_cpu_type {
> /* X86_CPU_TYPE_ANY */
> TOPO_CPU_TYPE_ANY = 0,
> TOPO_CPU_TYPE_PERFORMANCE,
> TOPO_CPU_TYPE_EFFICIENCY,
> TOPO_CPU_TYPE_UNKNOWN,
> };
>
> These are the Linux-specific CPU types and all vendor CPU types will be mapped
> to them. I hope 255 are enough.

255 should be more than enough, but it doesn't take resolve the problem of
matching a hybrid CPU to any cpu_type.

Apart from struct cpuinfo_x86 for each CPU, we have separate boot_cpu_data
for BSP. One possible solution is to set cpu_type to TOPO_CPU_TYPE_ANY in
BSP specific struct for hybrid systems.

For more accurate matching, x86_topology_cpu_type could be a u32 with
bit-fields for each CPU type. And boot_cpu_data can have:

boot_cpu_data.topo.cpu_type = (TOPO_CPU_TYPE_PERFORMANCE | TOPO_CPU_TYPE_EFFICIENCY | ...)

on a hybrid system. Problem with this approach is, unless secondary CPUs
are brought up, BSP will not know what all cpu-types are present in the
system. Also with bit-fields, possible cpu-types are further limited.

To circumvent this problem, current implementation matches a hybrid CPU
with any cpu_type.

> > Also, I think now cpu_vuln_blacklist[] needs TOPO_CPU_TYPE_EFFICIENCY
> > instead of ATOM.
> >
> > VULNBL_INTEL_TYPE(INTEL_ALDERLAKE, ATOM, RFDS | VMSCAPE),
> > VULNBL_INTEL_STEPS(INTEL_ALDERLAKE, X86_STEP_MAX, VMSCAPE),
> > VULNBL_INTEL_STEPS(INTEL_ALDERLAKE_L, X86_STEP_MAX, RFDS | VMSCAPE),
> > VULNBL_INTEL_TYPE(INTEL_RAPTORLAKE, ATOM, RFDS | VMSCAPE),
>
> Ack, right, ATOM == EFFICIENCY in Intel-speak, so I'd need to convert those.
>
> Thx.
>
> --
> Regards/Gruss,
> Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette