Skip to content

Commit 8e88f24

Browse files
bp3tk0vgregkh
authored andcommitted
x86/CPU/AMD: Call the spectral chicken in the Zen2 init function
Commit cfbf4f9 upstream. No functional change. Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Nikolay Borisov <nik.borisov@suse.com> Link: http://lore.kernel.org/r/20231120104152.13740-6-bp@alien8.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c4994f1 commit 8e88f24

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

arch/x86/kernel/cpu/amd.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,10 +1050,8 @@ void init_spectral_chicken(struct cpuinfo_x86 *c)
10501050
*
10511051
* This suppresses speculation from the middle of a basic block, i.e. it
10521052
* suppresses non-branch predictions.
1053-
*
1054-
* We use STIBP as a heuristic to filter out Zen2 from the rest of F17H
10551053
*/
1056-
if (!cpu_has(c, X86_FEATURE_HYPERVISOR) && cpu_has(c, X86_FEATURE_AMD_STIBP)) {
1054+
if (!cpu_has(c, X86_FEATURE_HYPERVISOR)) {
10571055
if (!rdmsrl_safe(MSR_ZEN2_SPECTRAL_CHICKEN, &value)) {
10581056
value |= MSR_ZEN2_SPECTRAL_CHICKEN_BIT;
10591057
wrmsrl_safe(MSR_ZEN2_SPECTRAL_CHICKEN, value);
@@ -1144,6 +1142,7 @@ static void init_amd_zen(struct cpuinfo_x86 *c)
11441142

11451143
static void init_amd_zen2(struct cpuinfo_x86 *c)
11461144
{
1145+
init_spectral_chicken(c);
11471146
}
11481147

11491148
static void init_amd_zen3(struct cpuinfo_x86 *c)
@@ -1183,7 +1182,7 @@ static void init_amd(struct cpuinfo_x86 *c)
11831182
case 0x12: init_amd_ln(c); break;
11841183
case 0x15: init_amd_bd(c); break;
11851184
case 0x16: init_amd_jg(c); break;
1186-
case 0x17: init_spectral_chicken(c);
1185+
case 0x17:
11871186
fallthrough;
11881187
case 0x19: init_amd_zn(c); break;
11891188
}

0 commit comments

Comments
 (0)