Skip to content

Commit 607b9fb

Browse files
Gregory Pricebp3tk0v
authored andcommitted
x86/CPU/AMD: Add RDSEED fix for Zen5
There's an issue with RDSEED's 16-bit and 32-bit register output variants on Zen5 which return a random value of 0 "at a rate inconsistent with randomness while incorrectly signaling success (CF=1)". Search the web for AMD-SB-7055 for more detail. Add a fix glue which checks microcode revisions. [ bp: Add microcode revisions checking, rewrite. ] Cc: [email protected] Signed-off-by: Gregory Price <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 8a9fb51 commit 607b9fb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

arch/x86/kernel/cpu/amd.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,8 +1035,18 @@ static void init_amd_zen4(struct cpuinfo_x86 *c)
10351035
}
10361036
}
10371037

1038+
static const struct x86_cpu_id zen5_rdseed_microcode[] = {
1039+
ZEN_MODEL_STEP_UCODE(0x1a, 0x02, 0x1, 0x0b00215a),
1040+
ZEN_MODEL_STEP_UCODE(0x1a, 0x11, 0x0, 0x0b101054),
1041+
};
1042+
10381043
static void init_amd_zen5(struct cpuinfo_x86 *c)
10391044
{
1045+
if (!x86_match_min_microcode_rev(zen5_rdseed_microcode)) {
1046+
clear_cpu_cap(c, X86_FEATURE_RDSEED);
1047+
msr_clear_bit(MSR_AMD64_CPUID_FN_7, 18);
1048+
pr_emerg_once("RDSEED32 is broken. Disabling the corresponding CPUID bit.\n");
1049+
}
10401050
}
10411051

10421052
static void init_amd(struct cpuinfo_x86 *c)

0 commit comments

Comments
 (0)