Skip to content

Commit 759cbd5

Browse files
Maxim Levitskybonzini
authored andcommitted
KVM: x86: nSVM/nVMX: set nested_run_pending on VM entry which is a result of RSM
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>
1 parent e8efa4f commit 759cbd5

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

arch/x86/kvm/svm/svm.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4263,6 +4263,11 @@ static int svm_leave_smm(struct kvm_vcpu *vcpu, const char *smstate)
42634263
nested_copy_vmcb_save_to_cache(svm, &vmcb12->save);
42644264
ret = enter_svm_guest_mode(vcpu, vmcb12_gpa, vmcb12, false);
42654265

4266+
if (ret)
4267+
goto unmap_save;
4268+
4269+
svm->nested.nested_run_pending = 1;
4270+
42664271
unmap_save:
42674272
kvm_vcpu_unmap(vcpu, &map_save, true);
42684273
unmap_map:

arch/x86/kvm/vmx/vmx.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7659,6 +7659,7 @@ static int vmx_leave_smm(struct kvm_vcpu *vcpu, const char *smstate)
76597659
if (ret)
76607660
return ret;
76617661

7662+
vmx->nested.nested_run_pending = 1;
76627663
vmx->nested.smm.guest_mode = false;
76637664
}
76647665
return 0;

0 commit comments

Comments
 (0)