Skip to content

Commit

Permalink
KVM: x86: nSVM/nVMX: set nested_run_pending on VM entry which is a re…
Browse files Browse the repository at this point in the history
…sult of RSM

commit 759cbd5 upstream.

While RSM induced VM entries are not full VM entries,
they still need to be followed by actual VM entry to complete it,
unlike setting the nested state.

This patch fixes boot of hyperv and SMM enabled
windows VM running nested on KVM, which fail due
to this issue combined with lack of dirty bit setting.

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Cc: stable@vger.kernel.org
Message-Id: <20220207155447.840194-5-mlevitsk@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Maxim Levitsky authored and gregkh committed Feb 23, 2022
1 parent d3785d3 commit 614b4c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions arch/x86/kvm/svm/svm.c
Expand Up @@ -4445,6 +4445,11 @@ static int svm_leave_smm(struct kvm_vcpu *vcpu, const char *smstate)
nested_load_control_from_vmcb12(svm, &vmcb12->control);
ret = enter_svm_guest_mode(vcpu, vmcb12_gpa, vmcb12, false);

if (ret)
goto unmap_save;

svm->nested.nested_run_pending = 1;

unmap_save:
kvm_vcpu_unmap(vcpu, &map_save, true);
unmap_map:
Expand Down
1 change: 1 addition & 0 deletions arch/x86/kvm/vmx/vmx.c
Expand Up @@ -7534,6 +7534,7 @@ static int vmx_leave_smm(struct kvm_vcpu *vcpu, const char *smstate)
if (ret)
return ret;

vmx->nested.nested_run_pending = 1;
vmx->nested.smm.guest_mode = false;
}
return 0;
Expand Down

0 comments on commit 614b4c6

Please sign in to comment.