x86: Restore IA32_MISC_ENABLE on wakeup
authorMichał Kowalczyk <mkow@invisiblethingslab.com>
Mon, 19 Aug 2019 02:23:33 +0000 (04:23 +0200)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 19 Aug 2019 14:07:34 +0000 (15:07 +0100)
commitc3cfa5b3084d71bccd8360d044bea813688b587c
tree10a7e05ec877b89061c2ff10ea347fe9bae57474
parentf7efd9c792738f579e3c7062d8d3e90b21d8a771
x86: Restore IA32_MISC_ENABLE on wakeup

Code in intel.c:early_init_intel() modifies IA32_MISC_ENABLE MSR. Those
modifications must be restored after resuming from S3 (see e.g. Linux wakeup
code), otherwise bad things may happen (e.g. wakeup code may cause #GP when
trying to set IA32_EFER.NXE [1]).

This bug was noticed on a ThinkPad x230 with NX disabled in the BIOS:
Xen could correctly boot, but crashed when resuming from suspend.
Applying this patch fixed the problem.

[1] Intel SDM vol 3: "If the execute-disable capability is not
available, a write to set IA32_EFER.NXE produces a #GP exception."

Signed-off-by: Michał Kowalczyk <mkow@invisiblethingslab.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/boot/wakeup.S