Skip to content

Commit 2636401

Browse files
Yosry Ahmedgregkh
authored andcommitted
KVM: nSVM: Ensure AVIC is inhibited when restoring a vCPU to guest mode
commit 24f7d36 upstream. On nested VMRUN, KVM ensures AVIC is inhibited by requesting KVM_REQ_APICV_UPDATE, triggering a check of inhibit reasons, finding APICV_INHIBIT_REASON_NESTED, and disabling AVIC. However, when KVM_SET_NESTED_STATE is performed on a vCPU not in guest mode with AVIC enabled, KVM_REQ_APICV_UPDATE is not requested, and AVIC is not inhibited. Request KVM_REQ_APICV_UPDATE in the KVM_SET_NESTED_STATE path if AVIC is active, similar to the nested VMRUN path. Fixes: f44509f ("KVM: x86: SVM: allow AVIC to co-exist with a nested guest running") Cc: stable@vger.kernel.org Signed-off-by: Yosry Ahmed <yosry@kernel.org> Link: https://patch.msgid.link/20260224225017.3303870-1-yosry@kernel.org Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 36f36a6 commit 2636401

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

arch/x86/kvm/svm/nested.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,6 +1774,9 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu,
17741774

17751775
svm->nested.force_msr_bitmap_recalc = true;
17761776

1777+
if (kvm_vcpu_apicv_active(vcpu))
1778+
kvm_make_request(KVM_REQ_APICV_UPDATE, vcpu);
1779+
17771780
kvm_make_request(KVM_REQ_GET_NESTED_STATE_PAGES, vcpu);
17781781
ret = 0;
17791782
out_free:

0 commit comments

Comments
 (0)