KVM: x86: allow KVM_REQ_GET_NESTED_STATE_PAGES outside guest mode for VMX
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 8 Jan 2021 16:43:08 +0000 (11:43 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 25 Jan 2021 23:54:09 +0000 (18:54 -0500)
commit9a78e15802a87de2b08dfd1bd88e855201d2c8fa
treeeee9add1851235c455614a8dc36ea19a95de4828
parentaed89418de9a881419516fa0a5643577f521efc9
KVM: x86: allow KVM_REQ_GET_NESTED_STATE_PAGES outside guest mode for VMX

VMX also uses KVM_REQ_GET_NESTED_STATE_PAGES for the Hyper-V eVMCS,
which may need to be loaded outside guest mode.  Therefore we cannot
WARN in that case.

However, that part of nested_get_vmcs12_pages is _not_ needed at
vmentry time.  Split it out of KVM_REQ_GET_NESTED_STATE_PAGES handling,
so that both vmentry and migration (and in the latter case, independent
of is_guest_mode) do the parts that are needed.

Cc: <stable@vger.kernel.org> # 5.10.x: f2c7ef3ba: KVM: nSVM: cancel KVM_REQ_GET_NESTED_STATE_PAGES
Cc: <stable@vger.kernel.org> # 5.10.x
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/nested.c
arch/x86/kvm/vmx/nested.c
arch/x86/kvm/x86.c