File tree Expand file tree Collapse file tree 3 files changed +20
-8
lines changed Expand file tree Collapse file tree 3 files changed +20
-8
lines changed Original file line number Diff line number Diff line change 322
322
#define X86_FEATURE_VIRT_SSBD (13*32+25) /* Virtualized Speculative Store Bypass Disable */
323
323
#define X86_FEATURE_AMD_SSB_NO (13*32+26) /* "" Speculative Store Bypass is fixed in hardware. */
324
324
#define X86_FEATURE_CPPC (13*32+27) /* Collaborative Processor Performance Control */
325
+ #define X86_FEATURE_BTC_NO (13*32+29) /* "" Not vulnerable to Branch Type Confusion */
325
326
#define X86_FEATURE_BRS (13*32+31) /* Branch Sampling available */
326
327
327
328
/* Thermal and Power Management Leaf, CPUID level 0x00000006 (EAX), word 14 */
Original file line number Diff line number Diff line change @@ -890,12 +890,21 @@ static void init_amd_zn(struct cpuinfo_x86 *c)
890
890
node_reclaim_distance = 32 ;
891
891
#endif
892
892
893
- /*
894
- * Fix erratum 1076: CPB feature bit not being set in CPUID.
895
- * Always set it, except when running under a hypervisor.
896
- */
897
- if (!cpu_has (c , X86_FEATURE_HYPERVISOR ) && !cpu_has (c , X86_FEATURE_CPB ))
898
- set_cpu_cap (c , X86_FEATURE_CPB );
893
+ /* Fix up CPUID bits, but only if not virtualised. */
894
+ if (!cpu_has (c , X86_FEATURE_HYPERVISOR )) {
895
+
896
+ /* Erratum 1076: CPB feature bit not being set in CPUID. */
897
+ if (!cpu_has (c , X86_FEATURE_CPB ))
898
+ set_cpu_cap (c , X86_FEATURE_CPB );
899
+
900
+ /*
901
+ * Zen3 (Fam19 model < 0x10) parts are not susceptible to
902
+ * Branch Type Confusion, but predate the allocation of the
903
+ * BTC_NO bit.
904
+ */
905
+ if (c -> x86 == 0x19 && !cpu_has (c , X86_FEATURE_BTC_NO ))
906
+ set_cpu_cap (c , X86_FEATURE_BTC_NO );
907
+ }
899
908
}
900
909
901
910
static void init_amd (struct cpuinfo_x86 * c )
Original file line number Diff line number Diff line change @@ -1359,8 +1359,10 @@ static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c)
1359
1359
!arch_cap_mmio_immune (ia32_cap ))
1360
1360
setup_force_cpu_bug (X86_BUG_MMIO_STALE_DATA );
1361
1361
1362
- if ((cpu_matches (cpu_vuln_blacklist , RETBLEED ) || (ia32_cap & ARCH_CAP_RSBA )))
1363
- setup_force_cpu_bug (X86_BUG_RETBLEED );
1362
+ if (!cpu_has (c , X86_FEATURE_BTC_NO )) {
1363
+ if (cpu_matches (cpu_vuln_blacklist , RETBLEED ) || (ia32_cap & ARCH_CAP_RSBA ))
1364
+ setup_force_cpu_bug (X86_BUG_RETBLEED );
1365
+ }
1364
1366
1365
1367
if (cpu_matches (cpu_vuln_whitelist , NO_MELTDOWN ))
1366
1368
return ;
You can’t perform that action at this time.
0 commit comments