Skip to content

Commit fb7bfa3

Browse files
andyhhpingomolnar
authored andcommitted
x86/cpu/amd: Correct the microcode table for Zenbleed
The good revisions are tied to exact steppings, meaning it's not valid to match on model number alone, let alone a range. This is probably only a latent issue. From public microcode archives, the following CPUs exist 17-30-00, 17-60-00, 17-70-00 and would be captured by the model ranges. They're likely pre-production steppings, and likely didn't get Zenbleed microcode, but it's still incorrect to compare them to a different steppings revision. Either way, convert the logic to use x86_match_min_microcode_rev(), which is the preferred mechanism. Fixes: 522b1d6 ("x86/cpu/amd: Add a Zenbleed fix") Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Mario Limonciello <mario.limonciello@amd.com> Cc: x86@kernel.org Link: https://patch.msgid.link/20251126130352.880424-1-andrew.cooper3@citrix.com
1 parent 8f0b4cc commit fb7bfa3

1 file changed

Lines changed: 9 additions & 21 deletions

File tree

arch/x86/kernel/cpu/amd.c

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -951,26 +951,14 @@ static void init_amd_zen1(struct cpuinfo_x86 *c)
951951
}
952952
}
953953

954-
static bool cpu_has_zenbleed_microcode(void)
955-
{
956-
u32 good_rev = 0;
957-
958-
switch (boot_cpu_data.x86_model) {
959-
case 0x30 ... 0x3f: good_rev = 0x0830107b; break;
960-
case 0x60 ... 0x67: good_rev = 0x0860010c; break;
961-
case 0x68 ... 0x6f: good_rev = 0x08608107; break;
962-
case 0x70 ... 0x7f: good_rev = 0x08701033; break;
963-
case 0xa0 ... 0xaf: good_rev = 0x08a00009; break;
964-
965-
default:
966-
return false;
967-
}
968-
969-
if (boot_cpu_data.microcode < good_rev)
970-
return false;
971-
972-
return true;
973-
}
954+
static const struct x86_cpu_id amd_zenbleed_microcode[] = {
955+
ZEN_MODEL_STEP_UCODE(0x17, 0x31, 0x0, 0x0830107b),
956+
ZEN_MODEL_STEP_UCODE(0x17, 0x60, 0x1, 0x0860010c),
957+
ZEN_MODEL_STEP_UCODE(0x17, 0x68, 0x1, 0x08608107),
958+
ZEN_MODEL_STEP_UCODE(0x17, 0x71, 0x0, 0x08701033),
959+
ZEN_MODEL_STEP_UCODE(0x17, 0xa0, 0x0, 0x08a00009),
960+
{}
961+
};
974962

975963
static void zen2_zenbleed_check(struct cpuinfo_x86 *c)
976964
{
@@ -980,7 +968,7 @@ static void zen2_zenbleed_check(struct cpuinfo_x86 *c)
980968
if (!cpu_has(c, X86_FEATURE_AVX))
981969
return;
982970

983-
if (!cpu_has_zenbleed_microcode()) {
971+
if (!x86_match_min_microcode_rev(amd_zenbleed_microcode)) {
984972
pr_notice_once("Zenbleed: please update your microcode for the most optimal fix\n");
985973
msr_set_bit(MSR_AMD64_DE_CFG, MSR_AMD64_DE_CFG_ZEN2_FP_BACKUP_FIX_BIT);
986974
} else {

0 commit comments

Comments
 (0)