]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
KVM: nVMX: reorganize initial steps of vmx_set_nested_state
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 19 Jun 2019 14:52:27 +0000 (16:52 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 20 Jun 2019 16:05:13 +0000 (18:05 +0200)
commit9fd588772636bcbe48669d880efa2e1cc0575ebd
treead7608c51d76f37b0aa53277a38aefb80f3ee172
parent9dba988edb31d013003b7f00e82dd56f01db70c3
KVM: nVMX: reorganize initial steps of vmx_set_nested_state

Commit 332d079735f5 ("KVM: nVMX: KVM_SET_NESTED_STATE - Tear down old EVMCS
state before setting new state", 2019-05-02) broke evmcs_test because the
eVMCS setup must be performed even if there is no VMXON region defined,
as long as the eVMCS bit is set in the assist page.

While the simplest possible fix would be to add a check on
kvm_state->flags & KVM_STATE_NESTED_EVMCS in the initial "if" that
covers kvm_state->hdr.vmx.vmxon_pa == -1ull, that is quite ugly.

Instead, this patch moves checks earlier in the function and
conditionalizes them on kvm_state->hdr.vmx.vmxon_pa, so that
vmx_set_nested_state always goes through vmx_leave_nested
and nested_enable_evmcs.

Fixes: 332d079735f5 ("KVM: nVMX: KVM_SET_NESTED_STATE - Tear down old EVMCS state before setting new state")
Cc: Aaron Lewis <aaronlewis@google.com>
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/nested.c
tools/testing/selftests/kvm/x86_64/vmx_set_nested_state_test.c