Skip to content

Commit 5b937a1

Browse files
Mixaillbp3tk0v
authored andcommitted
x86/rdrand: Disable RDSEED on AMD Cyan Skillfish
AMD Cyan Skillfish (Family 17h, Model 47h, Stepping 0h) has an error that causes RDSEED to always return 0xffffffff, while RDRAND works correctly. Mask the RDSEED cap for this CPU so that both /proc/cpuinfo and direct CPUID read report RDSEED as unavailable. [ bp: Move to amd.c, massage. ] Signed-off-by: Mikhail Paulyshka <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Cc: <[email protected]> Link: https://lore.kernel.org/[email protected]
1 parent d7b8f8e commit 5b937a1

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

arch/x86/include/asm/msr-index.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,7 @@
628628
#define MSR_AMD64_OSVW_STATUS 0xc0010141
629629
#define MSR_AMD_PPIN_CTL 0xc00102f0
630630
#define MSR_AMD_PPIN 0xc00102f1
631+
#define MSR_AMD64_CPUID_FN_7 0xc0011002
631632
#define MSR_AMD64_CPUID_FN_1 0xc0011004
632633
#define MSR_AMD64_LS_CFG 0xc0011020
633634
#define MSR_AMD64_DC_CFG 0xc0011022

arch/x86/kernel/cpu/amd.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,13 @@ static void init_amd_zen2(struct cpuinfo_x86 *c)
930930
init_spectral_chicken(c);
931931
fix_erratum_1386(c);
932932
zen2_zenbleed_check(c);
933+
934+
/* Disable RDSEED on AMD Cyan Skillfish because of an error. */
935+
if (c->x86_model == 0x47 && c->x86_stepping == 0x0) {
936+
clear_cpu_cap(c, X86_FEATURE_RDSEED);
937+
msr_clear_bit(MSR_AMD64_CPUID_FN_7, 18);
938+
pr_emerg("RDSEED is not reliable on this platform; disabling.\n");
939+
}
933940
}
934941

935942
static void init_amd_zen3(struct cpuinfo_x86 *c)

tools/arch/x86/include/asm/msr-index.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,7 @@
628628
#define MSR_AMD64_OSVW_STATUS 0xc0010141
629629
#define MSR_AMD_PPIN_CTL 0xc00102f0
630630
#define MSR_AMD_PPIN 0xc00102f1
631+
#define MSR_AMD64_CPUID_FN_7 0xc0011002
631632
#define MSR_AMD64_CPUID_FN_1 0xc0011004
632633
#define MSR_AMD64_LS_CFG 0xc0011020
633634
#define MSR_AMD64_DC_CFG 0xc0011022

0 commit comments

Comments
 (0)