x86/S3: Restore CR4 earlier during resume
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 20 Oct 2020 12:43:40 +0000 (14:43 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 20 Oct 2020 12:43:40 +0000 (14:43 +0200)
commit9c1cc643ac3651950ec054a41c970e3fc6ee6da6
tree7b9cb017da4ef59c830069d4b4b4448f947b6dbe
parent829dbe2cfb84b05f278de93d83dff2473f543789
x86/S3: Restore CR4 earlier during resume

c/s 4304ff420e5 "x86/S3: Drop {save,restore}_rest_processor_state()
completely" moved CR4 restoration up into C, to account for the fact that MCE
was explicitly handled later.

However, time_resume() ends up making an EFI Runtime Service call, and EFI
explodes without OSFXSR, presumably when trying to spill %xmm registers onto
the stack.

Given this codepath, and the potential for other issues of a similar kind (TLB
flushing vs INVPCID, HVM logic vs VMXE, etc), restore CR4 in asm before
entering C.

Ignore the previous MCE special case, because its not actually necessary.  The
handler is already suitably configured from before suspend.

Fixes: 4304ff420e5 ("x86/S3: Drop {save,restore}_rest_processor_state() completely")
Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
master commit: 7f66c0dc41ae5f770c614e516810eb1f336e2470
master date: 2020-10-06 12:28:37 +0100
xen/arch/x86/acpi/power.c
xen/arch/x86/acpi/wakeup_prot.S