Skip to content

Commit 9009782

Browse files
christofferdall-armMarc Zyngier
authored andcommitted
KVM: arm/arm64: vgic: Consider priority and active state for pending irq
When checking if there are any pending IRQs for the VM, consider the active state and priority of the IRQs as well. Otherwise we could be continuously scheduling a guest hypervisor without it seeing an IRQ. Signed-off-by: Christoffer Dall <christoffer.dall@arm.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
1 parent c23b2e6 commit 9009782

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎virt/kvm/arm/vgic/vgic.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -908,18 +908,23 @@ int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu)
908908
struct vgic_irq *irq;
909909
bool pending = false;
910910
unsigned long flags;
911+
struct vgic_vmcr vmcr;
911912

912913
if (!vcpu->kvm->arch.vgic.enabled)
913914
return false;
914915

915916
if (vcpu->arch.vgic_cpu.vgic_v3.its_vpe.pending_last)
916917
return true;
917918

919+
vgic_get_vmcr(vcpu, &vmcr);
920+
918921
spin_lock_irqsave(&vgic_cpu->ap_list_lock, flags);
919922

920923
list_for_each_entry(irq, &vgic_cpu->ap_list_head, ap_list) {
921924
spin_lock(&irq->irq_lock);
922-
pending = irq_is_pending(irq) && irq->enabled;
925+
pending = irq_is_pending(irq) && irq->enabled &&
926+
!irq->active &&
927+
irq->priority < vmcr.pmr;
923928
spin_unlock(&irq->irq_lock);
924929

925930
if (pending)

0 commit comments

Comments
 (0)