Skip to content

Commit 850932b

Browse files
committed
KVM: SVM: Always update local APIC on writes to logical dest register
jira LE-1907 Rebuild_History Non-Buildable kernel-5.14.0-284.30.1.el9_2 commit-author Sean Christopherson <seanjc@google.com> commit 1ba59a4 Update the vCPU's local (virtual) APIC on LDR writes even if the write "fails". The APIC needs to recalc the optimized logical map even if the LDR is invalid or zero, e.g. if the guest clears its LDR, the optimized map will be left as is and the vCPU will receive interrupts using its old LDR. Fixes: 18f40c5 ("svm: Add VMEXIT handlers for AVIC") Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Signed-off-by: Sean Christopherson <seanjc@google.com> Message-Id: <20230106011306.85230-26-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> (cherry picked from commit 1ba59a4) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 87a6c03 commit 850932b

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

arch/x86/kvm/svm/avic.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ static void avic_invalidate_logical_id_entry(struct kvm_vcpu *vcpu)
573573
clear_bit(AVIC_LOGICAL_ID_ENTRY_VALID_BIT, (unsigned long *)entry);
574574
}
575575

576-
static int avic_handle_ldr_update(struct kvm_vcpu *vcpu)
576+
static void avic_handle_ldr_update(struct kvm_vcpu *vcpu)
577577
{
578578
int ret = 0;
579579
struct vcpu_svm *svm = to_svm(vcpu);
@@ -582,10 +582,10 @@ static int avic_handle_ldr_update(struct kvm_vcpu *vcpu)
582582

583583
/* AVIC does not support LDR update for x2APIC */
584584
if (apic_x2apic_mode(vcpu->arch.apic))
585-
return 0;
585+
return;
586586

587587
if (ldr == svm->ldr_reg)
588-
return 0;
588+
return;
589589

590590
avic_invalidate_logical_id_entry(vcpu);
591591

@@ -594,8 +594,6 @@ static int avic_handle_ldr_update(struct kvm_vcpu *vcpu)
594594

595595
if (!ret)
596596
svm->ldr_reg = ldr;
597-
598-
return ret;
599597
}
600598

601599
static void avic_handle_dfr_update(struct kvm_vcpu *vcpu)
@@ -617,8 +615,7 @@ static int avic_unaccel_trap_write(struct kvm_vcpu *vcpu)
617615

618616
switch (offset) {
619617
case APIC_LDR:
620-
if (avic_handle_ldr_update(vcpu))
621-
return 0;
618+
avic_handle_ldr_update(vcpu);
622619
break;
623620
case APIC_DFR:
624621
avic_handle_dfr_update(vcpu);

0 commit comments

Comments
 (0)