Skip to content

Commit f5bc3ae

Browse files
prnangiagregkh
authored andcommitted
x86/CPU/AMD: Prevent improper isolation of shared resources in Zen2's op cache
commit c21b90f upstream. Make sure resources are not improperly shared in the op cache and cause instruction corruption this way. Signed-off-by: Prathyushi Nangia <prathyushi.nangia@amd.com> Co-developed-by: Borislav Petkov (AMD) <bp@alien8.de> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 48b4a4c commit f5bc3ae

3 files changed

Lines changed: 7 additions & 0 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,7 @@
580580
/* Zen4 */
581581
#define MSR_ZEN4_BP_CFG 0xc001102e
582582
#define MSR_ZEN4_BP_CFG_SHARED_BTB_FIX_BIT 5
583+
#define MSR_ZEN2_BP_CFG_BUG_FIX_BIT 33
583584

584585
/* Zen 2 */
585586
#define MSR_ZEN2_SPECTRAL_CHICKEN 0xc00110e3

arch/x86/kernel/cpu/amd.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,6 +1170,9 @@ static void init_amd_zen2(struct cpuinfo_x86 *c)
11701170
{
11711171
init_amd_zen_common();
11721172
init_spectral_chicken(c);
1173+
1174+
if (!cpu_has(c, X86_FEATURE_HYPERVISOR))
1175+
msr_set_bit(MSR_ZEN4_BP_CFG, MSR_ZEN2_BP_CFG_BUG_FIX_BIT);
11731176
}
11741177

11751178
static void init_amd_zen3(struct cpuinfo_x86 *c)

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,9 @@
530530

531531
#define MSR_AMD64_VIRT_SPEC_CTRL 0xc001011f
532532

533+
#define MSR_ZEN4_BP_CFG 0xc001102e
534+
#define MSR_ZEN2_BP_CFG_BUG_FIX_BIT 33
535+
533536
/* Fam 17h MSRs */
534537
#define MSR_F17H_IRPERF 0xc00000e9
535538

0 commit comments

Comments
 (0)