Skip to content

Commit e2a1256

Browse files
pa1guptatorvalds
authored andcommitted
x86/speculation: Restore speculation related MSRs during S3 resume
After resuming from suspend-to-RAM, the MSRs that control CPU's speculative execution behavior are not being restored on the boot CPU. These MSRs are used to mitigate speculative execution vulnerabilities. Not restoring them correctly may leave the CPU vulnerable. Secondary CPU's MSRs are correctly being restored at S3 resume by identify_secondary_cpu(). During S3 resume, restore these MSRs for boot CPU when restoring its processor state. Fixes: 7724397 ("x86/bugs/intel: Set proper CPU features and setup RDS") Reported-by: Neelima Krishnan <[email protected]> Signed-off-by: Pawan Gupta <[email protected]> Tested-by: Neelima Krishnan <[email protected]> Acked-by: Borislav Petkov <[email protected]> Reviewed-by: Dave Hansen <[email protected]> Cc: [email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent 73924ec commit e2a1256

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

arch/x86/power/cpu.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,10 +503,24 @@ static int pm_cpu_check(const struct x86_cpu_id *c)
503503
return ret;
504504
}
505505

506+
static void pm_save_spec_msr(void)
507+
{
508+
u32 spec_msr_id[] = {
509+
MSR_IA32_SPEC_CTRL,
510+
MSR_IA32_TSX_CTRL,
511+
MSR_TSX_FORCE_ABORT,
512+
MSR_IA32_MCU_OPT_CTRL,
513+
MSR_AMD64_LS_CFG,
514+
};
515+
516+
msr_build_context(spec_msr_id, ARRAY_SIZE(spec_msr_id));
517+
}
518+
506519
static int pm_check_save_msr(void)
507520
{
508521
dmi_check_system(msr_save_dmi_table);
509522
pm_cpu_check(msr_save_cpu_table);
523+
pm_save_spec_msr();
510524

511525
return 0;
512526
}

0 commit comments

Comments
 (0)