amd64: properly recalculate mitigations knobs after resume
Revision r333125 AKA986c4ca387
forced clear cpu_stdext_feature3 on suspend, since at that time microcode update was not reloaded early on resume. Then, revision050f5a8405
started re-reading cpu_stdext_feature3 again. Since modern CPUs do not require mitigations from the Skylake era, this went unnoticed for some time. Keep zeroing cpu_stdext_feature3 on suspend, but re-read it in more controlled way on resume after microcode is reloaded, and recalculate active workarounds based on actual microcode capabilities. Reported and tested by: romain Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D39146
This commit is contained in:
parent
9ee6278b78
commit
02904a06c7
@ -288,6 +288,20 @@ acpi_wakeup_machdep(struct acpi_softc *sc, int state, int sleep_result,
|
||||
if (!CPU_EMPTY(&suspcpus))
|
||||
resume_cpus(suspcpus);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Re-read cpu_stdext_feature3, which was zeroed-out
|
||||
* in acpi_sleep_machdep, after the microcode was
|
||||
* reloaded. Then recalculate the active mitigations
|
||||
* knobs that depend on the microcode and
|
||||
* cpu_stdext_feature3.
|
||||
*/
|
||||
identify_cpu_ext_features();
|
||||
hw_ibrs_recalculate(true);
|
||||
hw_ssb_recalculate(true);
|
||||
amd64_syscall_ret_flush_l1d_recalc();
|
||||
x86_rngds_mitg_recalculate(true);
|
||||
|
||||
mca_resume();
|
||||
if (vmm_resume_p != NULL)
|
||||
vmm_resume_p();
|
||||
|
@ -313,7 +313,7 @@ initializecpu(void)
|
||||
}
|
||||
load_cr4(cr4);
|
||||
/* Reload cpu ext features to reflect cr4 changes */
|
||||
if (IS_BSP())
|
||||
if (IS_BSP() && cold)
|
||||
identify_cpu_ext_features();
|
||||
if (IS_BSP() && (amd_feature & AMDID_NX) != 0) {
|
||||
msr = rdmsr(MSR_EFER) | EFER_NXE;
|
||||
|
Loading…
Reference in New Issue
Block a user