diff options
| author | Yosry Ahmed <yosry@kernel.org> | 2026-02-25 01:50:17 +0300 |
|---|---|---|
| committer | Sean Christopherson <seanjc@google.com> | 2026-03-03 02:58:19 +0300 |
| commit | 24f7d36b824b65cf1a2db3db478059187b2a37b0 (patch) | |
| tree | c1088dd5f0d02b462ee8d63ea753771281e9e7d4 | |
| parent | e63fb1379f4b9300a44739964e69549bebbcdca4 (diff) | |
| download | linux-24f7d36b824b65cf1a2db3db478059187b2a37b0.tar.xz | |
KVM: nSVM: Ensure AVIC is inhibited when restoring a vCPU to guest mode
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: f44509f849fe ("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>
| -rw-r--r-- | arch/x86/kvm/svm/nested.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index d5a8f5608f2d..3667f8ba5268 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -1928,6 +1928,9 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu, svm->nested.force_msr_bitmap_recalc = true; + if (kvm_vcpu_apicv_active(vcpu)) + kvm_make_request(KVM_REQ_APICV_UPDATE, vcpu); + kvm_make_request(KVM_REQ_GET_NESTED_STATE_PAGES, vcpu); ret = 0; out_free: |
