summaryrefslogtreecommitdiff
path: root/virt/kvm/arm/vgic/vgic.h
diff options
context:
space:
mode:
authorRadim Krčmář <rkrcmar@redhat.com>2018-05-05 23:05:31 +0200
committerRadim Krčmář <rkrcmar@redhat.com>2018-05-05 23:05:31 +0200
commitf3351c609bbdcf3c519ff5c5451103aa48a5b804 (patch)
tree5ec6d02df85f89340139d37307c321db39fe72bb /virt/kvm/arm/vgic/vgic.h
parent6da6c0db5316275015e8cc2959f12a17584aeb64 (diff)
parentb220244d41798c6592e7d17843256eb0bae456a0 (diff)
Merge tag 'kvmarm-fixes-for-4.17-2' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm
KVM/arm fixes for 4.17, take #2 - Fix proxying of GICv2 CPU interface accesses - Fix crash when switching to BE - Track source vcpu git GICv2 SGIs - Fix an outdated bit of documentation
Diffstat (limited to 'virt/kvm/arm/vgic/vgic.h')
-rw-r--r--virt/kvm/arm/vgic/vgic.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/virt/kvm/arm/vgic/vgic.h b/virt/kvm/arm/vgic/vgic.h
index 830e815748a0..32c25d42c93f 100644
--- a/virt/kvm/arm/vgic/vgic.h
+++ b/virt/kvm/arm/vgic/vgic.h
@@ -110,6 +110,20 @@ static inline bool vgic_irq_is_mapped_level(struct vgic_irq *irq)
return irq->config == VGIC_CONFIG_LEVEL && irq->hw;
}
+static inline int vgic_irq_get_lr_count(struct vgic_irq *irq)
+{
+ /* Account for the active state as an interrupt */
+ if (vgic_irq_is_sgi(irq->intid) && irq->source)
+ return hweight8(irq->source) + irq->active;
+
+ return irq_is_pending(irq) || irq->active;
+}
+
+static inline bool vgic_irq_is_multi_sgi(struct vgic_irq *irq)
+{
+ return vgic_irq_get_lr_count(irq) > 1;
+}
+
/*
* This struct provides an intermediate representation of the fields contained
* in the GICH_VMCR and ICH_VMCR registers, such that code exporting the GIC