[PATCH] x86/mce: Use ZENx features for Zen IF quirk

From: Yazen Ghannam
Date: Mon Aug 11 2025 - 16:34:45 EST


Zen1 through Zen5 systems have a quirk related to Instruction Fetch
poison consumption.

Currently, the quirk is applied to families 17h, 18h, 19h, and 1Ah.
However, family numbers don't apply directly to Zen CPU revisions.

Update the quirk check to use the "X86_FEATURE_ZEN" CPU features to
apply only to affected CPU revisions.

Signed-off-by: Yazen Ghannam <yazen.ghannam@xxxxxxx>
---
arch/x86/kernel/cpu/mce/core.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
index 4da4eab56c81..0ef164568077 100644
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -1951,8 +1951,11 @@ static void apply_quirks_amd(struct cpuinfo_x86 *c)
if (c->x86 == 0x15 && c->x86_model <= 0xf)
mce_flags.overflow_recov = 1;

- if (c->x86 >= 0x17 && c->x86 <= 0x1A)
- mce_flags.zen_ifu_quirk = 1;
+ mce_flags.zen_ifu_quirk = cpu_feature_enabled(X86_FEATURE_ZEN1) ||
+ cpu_feature_enabled(X86_FEATURE_ZEN2) ||
+ cpu_feature_enabled(X86_FEATURE_ZEN3) ||
+ cpu_feature_enabled(X86_FEATURE_ZEN4) ||
+ cpu_feature_enabled(X86_FEATURE_ZEN5);
}

static void apply_quirks_intel(struct cpuinfo_x86 *c)

---
base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
change-id: 20250811-wip-mca-reduce-if-quirk-83a9744fa057