Skip to content

Commit b2096a5

Browse files
committed
Merge branch 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 store buffer fixes from Thomas Gleixner: "Two fixes for the SSBD mitigation code: - expose SSBD properly to guests. This got broken when the CPU feature flags got reshuffled. - simplify the CPU detection logic to avoid duplicate entries in the tables" * 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/speculation: Simplify the CPU bug detection logic KVM/VMX: Expose SSBD properly to guests
2 parents cc71efd + 8ecc497 commit b2096a5

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

arch/x86/kernel/cpu/common.c

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -942,47 +942,39 @@ static const __initconst struct x86_cpu_id cpu_no_meltdown[] = {
942942
{}
943943
};
944944

945+
/* Only list CPUs which speculate but are non susceptible to SSB */
945946
static const __initconst struct x86_cpu_id cpu_no_spec_store_bypass[] = {
946-
{ X86_VENDOR_INTEL, 6, INTEL_FAM6_ATOM_PINEVIEW },
947-
{ X86_VENDOR_INTEL, 6, INTEL_FAM6_ATOM_LINCROFT },
948-
{ X86_VENDOR_INTEL, 6, INTEL_FAM6_ATOM_PENWELL },
949-
{ X86_VENDOR_INTEL, 6, INTEL_FAM6_ATOM_CLOVERVIEW },
950-
{ X86_VENDOR_INTEL, 6, INTEL_FAM6_ATOM_CEDARVIEW },
951947
{ X86_VENDOR_INTEL, 6, INTEL_FAM6_ATOM_SILVERMONT1 },
952948
{ X86_VENDOR_INTEL, 6, INTEL_FAM6_ATOM_AIRMONT },
953949
{ X86_VENDOR_INTEL, 6, INTEL_FAM6_ATOM_SILVERMONT2 },
954950
{ X86_VENDOR_INTEL, 6, INTEL_FAM6_ATOM_MERRIFIELD },
955951
{ X86_VENDOR_INTEL, 6, INTEL_FAM6_CORE_YONAH },
956952
{ X86_VENDOR_INTEL, 6, INTEL_FAM6_XEON_PHI_KNL },
957953
{ X86_VENDOR_INTEL, 6, INTEL_FAM6_XEON_PHI_KNM },
958-
{ X86_VENDOR_CENTAUR, 5, },
959-
{ X86_VENDOR_INTEL, 5, },
960-
{ X86_VENDOR_NSC, 5, },
961954
{ X86_VENDOR_AMD, 0x12, },
962955
{ X86_VENDOR_AMD, 0x11, },
963956
{ X86_VENDOR_AMD, 0x10, },
964957
{ X86_VENDOR_AMD, 0xf, },
965-
{ X86_VENDOR_ANY, 4, },
966958
{}
967959
};
968960

969961
static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c)
970962
{
971963
u64 ia32_cap = 0;
972964

965+
if (x86_match_cpu(cpu_no_speculation))
966+
return;
967+
968+
setup_force_cpu_bug(X86_BUG_SPECTRE_V1);
969+
setup_force_cpu_bug(X86_BUG_SPECTRE_V2);
970+
973971
if (cpu_has(c, X86_FEATURE_ARCH_CAPABILITIES))
974972
rdmsrl(MSR_IA32_ARCH_CAPABILITIES, ia32_cap);
975973

976974
if (!x86_match_cpu(cpu_no_spec_store_bypass) &&
977975
!(ia32_cap & ARCH_CAP_SSB_NO))
978976
setup_force_cpu_bug(X86_BUG_SPEC_STORE_BYPASS);
979977

980-
if (x86_match_cpu(cpu_no_speculation))
981-
return;
982-
983-
setup_force_cpu_bug(X86_BUG_SPECTRE_V1);
984-
setup_force_cpu_bug(X86_BUG_SPECTRE_V2);
985-
986978
if (x86_match_cpu(cpu_no_meltdown))
987979
return;
988980

arch/x86/kvm/cpuid.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,8 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
407407

408408
/* cpuid 7.0.edx*/
409409
const u32 kvm_cpuid_7_0_edx_x86_features =
410-
F(AVX512_4VNNIW) | F(AVX512_4FMAPS) | F(SPEC_CTRL) | F(SSBD) |
411-
F(ARCH_CAPABILITIES);
410+
F(AVX512_4VNNIW) | F(AVX512_4FMAPS) | F(SPEC_CTRL) |
411+
F(SPEC_CTRL_SSBD) | F(ARCH_CAPABILITIES);
412412

413413
/* all calls to cpuid_count() should be made on the same cpu */
414414
get_cpu();

0 commit comments

Comments
 (0)