summaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorEric Auger <eric.auger@linaro.org>2015-12-07 10:30:38 -0500
committerChristoffer Dall <christoffer.dall@linaro.org>2016-05-20 09:39:49 -0400
commit90eee56c5f9081686035972dfcddfd6c85cafdf9 (patch)
treeaaab7b44a2246a15b18cbb36da10395baa9ec467 /virt
parent59529f69f5048e50dcde3434661981c01f8208b4 (diff)
KVM: arm/arm64: vgic-new: Implement kvm_vgic_vcpu_pending_irq
Tell KVM whether a particular VCPU has an IRQ that needs handling in the guest. This is used to decide whether a VCPU is runnable. Signed-off-by: Eric Auger <eric.auger@linaro.org> Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org> Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/arm/vgic/vgic.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c
index 0bf0d2060053..7e010087224c 100644
--- a/virt/kvm/arm/vgic/vgic.c
+++ b/virt/kvm/arm/vgic/vgic.c
@@ -520,3 +520,28 @@ void kvm_vgic_flush_hwstate(struct kvm_vcpu *vcpu)
520 vgic_flush_lr_state(vcpu); 520 vgic_flush_lr_state(vcpu);
521 spin_unlock(&vcpu->arch.vgic_cpu.ap_list_lock); 521 spin_unlock(&vcpu->arch.vgic_cpu.ap_list_lock);
522} 522}
523
524int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu)
525{
526 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
527 struct vgic_irq *irq;
528 bool pending = false;
529
530 if (!vcpu->kvm->arch.vgic.enabled)
531 return false;
532
533 spin_lock(&vgic_cpu->ap_list_lock);
534
535 list_for_each_entry(irq, &vgic_cpu->ap_list_head, ap_list) {
536 spin_lock(&irq->irq_lock);
537 pending = irq->pending && irq->enabled;
538 spin_unlock(&irq->irq_lock);
539
540 if (pending)
541 break;
542 }
543
544 spin_unlock(&vgic_cpu->ap_list_lock);
545
546 return pending;
547}