Skip to content

Commit b0be0ef

Browse files
committed
Merge tag 'x86-pti-2020-01-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 pti updates from Thomas Gleixner: "The performance deterioration departement provides a few non-scary fixes and improvements: - Update the cached HLE state when the TSX state is changed via the new control register. This ensures feature bit consistency. - Exclude the new Zhaoxin CPUs from Spectre V2 and SWAPGS vulnerabilities" * tag 'x86-pti-2020-01-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/speculation/swapgs: Exclude Zhaoxin CPUs from SWAPGS vulnerability x86/speculation/spectre_v2: Exclude Zhaoxin CPUs from SPECTRE_V2 x86/cpu: Update cached HLE state on write to TSX_CTRL_CPUID_CLEAR
2 parents 3d3b44a + a84de2f commit b0be0ef

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

arch/x86/kernel/cpu/common.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,7 @@ static void identify_cpu_without_cpuid(struct cpuinfo_x86 *c)
10231023
#define MSBDS_ONLY BIT(5)
10241024
#define NO_SWAPGS BIT(6)
10251025
#define NO_ITLB_MULTIHIT BIT(7)
1026+
#define NO_SPECTRE_V2 BIT(8)
10261027

10271028
#define VULNWL(_vendor, _family, _model, _whitelist) \
10281029
{ X86_VENDOR_##_vendor, _family, _model, X86_FEATURE_ANY, _whitelist }
@@ -1084,6 +1085,10 @@ static const __initconst struct x86_cpu_id cpu_vuln_whitelist[] = {
10841085
/* FAMILY_ANY must be last, otherwise 0x0f - 0x12 matches won't work */
10851086
VULNWL_AMD(X86_FAMILY_ANY, NO_MELTDOWN | NO_L1TF | NO_MDS | NO_SWAPGS | NO_ITLB_MULTIHIT),
10861087
VULNWL_HYGON(X86_FAMILY_ANY, NO_MELTDOWN | NO_L1TF | NO_MDS | NO_SWAPGS | NO_ITLB_MULTIHIT),
1088+
1089+
/* Zhaoxin Family 7 */
1090+
VULNWL(CENTAUR, 7, X86_MODEL_ANY, NO_SPECTRE_V2 | NO_SWAPGS),
1091+
VULNWL(ZHAOXIN, 7, X86_MODEL_ANY, NO_SPECTRE_V2 | NO_SWAPGS),
10871092
{}
10881093
};
10891094

@@ -1116,7 +1121,9 @@ static void __init cpu_set_bug_bits(struct cpuinfo_x86 *c)
11161121
return;
11171122

11181123
setup_force_cpu_bug(X86_BUG_SPECTRE_V1);
1119-
setup_force_cpu_bug(X86_BUG_SPECTRE_V2);
1124+
1125+
if (!cpu_matches(NO_SPECTRE_V2))
1126+
setup_force_cpu_bug(X86_BUG_SPECTRE_V2);
11201127

11211128
if (!cpu_matches(NO_SSB) && !(ia32_cap & ARCH_CAP_SSB_NO) &&
11221129
!cpu_has(c, X86_FEATURE_AMD_SSB_NO))

arch/x86/kernel/cpu/tsx.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,12 @@ void __init tsx_init(void)
115115
tsx_disable();
116116

117117
/*
118-
* tsx_disable() will change the state of the
119-
* RTM CPUID bit. Clear it here since it is now
120-
* expected to be not set.
118+
* tsx_disable() will change the state of the RTM and HLE CPUID
119+
* bits. Clear them here since they are now expected to be not
120+
* set.
121121
*/
122122
setup_clear_cpu_cap(X86_FEATURE_RTM);
123+
setup_clear_cpu_cap(X86_FEATURE_HLE);
123124
} else if (tsx_ctrl_state == TSX_CTRL_ENABLE) {
124125

125126
/*
@@ -131,10 +132,10 @@ void __init tsx_init(void)
131132
tsx_enable();
132133

133134
/*
134-
* tsx_enable() will change the state of the
135-
* RTM CPUID bit. Force it here since it is now
136-
* expected to be set.
135+
* tsx_enable() will change the state of the RTM and HLE CPUID
136+
* bits. Force them here since they are now expected to be set.
137137
*/
138138
setup_force_cpu_cap(X86_FEATURE_RTM);
139+
setup_force_cpu_cap(X86_FEATURE_HLE);
139140
}
140141
}

0 commit comments

Comments
 (0)