KVM: Fix host oops due to guest changing efer

If the guest changes efer from long mode with sce disabled to legacy mode,
then load_transition_efer() zeros vmx->host_state.guest_efer_loaded, but
the SCE-disabled efer remains in effect. So when we return to the host,
we disable SCE and syscalls no longer work.

Fix by (a) not touching vmx->host_state.guest_efer_loaded if we're not
setting it, and instead (b) clearing it explicitly when we switch back.
Also switch back when the guest writes to efer so we start from a clean

Signed-off-by: Avi Kivity <avi@qumranet.com>
1 file changed