Re: [PATCH 1/2] x86/topology: Name the AMD core-type values
From: Pawan Gupta
Date: Tue Jul 07 2026 - 16:47:19 EST
On Tue, Jul 07, 2026 at 09:29:32PM +0200, Thomas Gleixner wrote:
> On Tue, Jul 07 2026 at 10:52, Pawan Gupta wrote:
> > 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.
>
> Abusing the type, which enumerates performance properties, for
> vulnerability crystal ball logic is simply broken.
>
> The type is a per CPU property and has nothing to do with hybrid or
> not. Hybrid is a packet property.
>
> Just because it is convenient does not make it more correct. If you need
> to enable mitigations on hybrid systems, then explicitely check for the
> hybrid property.
Right, I was convoluting 2 different goals. Vulnerability enumeration
should explicitly check for hybrid.
Currently, only RFDS needs to check for hybrid. It is probably not worth
creating a new mechanism for cpu_type check for vulnerability enumeration.
Below should work with current set of CPUs. Please let me know if there is
a better way to handle this:
---
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index a3df21d26460..836076b1a3b5 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1316,10 +1316,8 @@ static const struct x86_cpu_id cpu_vuln_blacklist[] __initconst = {
VULNBL_INTEL_STEPS(INTEL_TIGERLAKE, X86_STEP_MAX, GDS | ITS | ITS_NATIVE_ONLY),
VULNBL_INTEL_STEPS(INTEL_LAKEFIELD, X86_STEP_MAX, MMIO | MMIO_SBDS | RETBLEED),
VULNBL_INTEL_STEPS(INTEL_ROCKETLAKE, X86_STEP_MAX, MMIO | RETBLEED | GDS | ITS | ITS_NATIVE_ONLY),
- 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),
VULNBL_INTEL_STEPS(INTEL_RAPTORLAKE, X86_STEP_MAX, VMSCAPE),
VULNBL_INTEL_STEPS(INTEL_RAPTORLAKE_P, X86_STEP_MAX, RFDS | VMSCAPE),
VULNBL_INTEL_STEPS(INTEL_RAPTORLAKE_S, X86_STEP_MAX, RFDS | VMSCAPE),
@@ -1388,7 +1386,20 @@ static bool __init vulnerable_to_rfds(u64 x86_arch_cap_msr)
return true;
/* Only consult the blacklist when there is no enumeration: */
- return cpu_matches(cpu_vuln_blacklist, RFDS);
+ if (!cpu_matches(cpu_vuln_blacklist, RFDS))
+ return false;
+
+ /*
+ * ADL and RPL are only affected if they have Atom CPUs.
+ * Hybrids have both Core and Atom CPUs, mark them vulnerable.
+ */
+ if ((boot_cpu_data.x86_model == 0x97 ||
+ boot_cpu_data.x86_model == 0xB7) &&
+ boot_cpu_data.topo.hw_cpu_type == INTEL_CPU_TYPE_CORE &&
+ !boot_cpu_has(X86_FEATURE_HYBRID_CPU))
+ return false;
+
+ return true;
}
static bool __init vulnerable_to_its(u64 x86_arch_cap_msr)