From: Andrew Cooper Date: Tue, 17 Apr 2018 17:43:49 +0000 (+0100) Subject: x86: Use spec_ctrl_{enter,exit}_idle() in the S3/S5 path X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~173 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ef3ab46493f650b7e5cca2b2578a99ca0cbff195;p=xen.git x86: Use spec_ctrl_{enter,exit}_idle() in the S3/S5 path The main purpose of this patch is to avoid opencoding the recovery logic at the end, but also has the positive side effect of relaxing the SPEC_CTRL mitigations when working to shut the final CPU down. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich Release-acked-by: Juergen Gross --- diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c index 0763846548..bb0d09552c 100644 --- a/xen/arch/x86/acpi/power.c +++ b/xen/arch/x86/acpi/power.c @@ -213,7 +213,8 @@ static int enter_state(u32 state) error = 0; ci = get_cpu_info(); - ci->use_shadow_spec_ctrl = 0; + spec_ctrl_enter_idle(ci); + /* Avoid NMI/#MC using MSR_SPEC_CTRL until we've reloaded microcode. */ ci->bti_ist_info = 0; ACPI_FLUSH_CPU_CACHE(); @@ -257,10 +258,9 @@ static int enter_state(u32 state) if ( !recheck_cpu_features(0) ) panic("Missing previously available feature(s)."); + /* Re-enabled default NMI/#MC use of MSR_SPEC_CTRL. */ ci->bti_ist_info = default_bti_ist_info; - asm volatile (ALTERNATIVE("", "wrmsr", X86_FEATURE_XEN_IBRS_SET) - :: "a" (SPEC_CTRL_IBRS), "c" (MSR_SPEC_CTRL), "d" (0) - : "memory"); + spec_ctrl_exit_idle(ci); done: spin_debug_enable();