]> xenbits.xensource.com Git - people/dariof/xen.git/commitdiff
ARM: VGIC: factor out vgic_get_hw_irq_desc()
authorAndre Przywara <andre.przywara@linaro.org>
Tue, 6 Feb 2018 17:09:01 +0000 (17:09 +0000)
committerStefano Stabellini <sstabellini@kernel.org>
Thu, 8 Feb 2018 21:18:11 +0000 (13:18 -0800)
At the moment we happily access the VGIC internal struct pending_irq
(which describes a virtual IRQ) in irq.c.
Factor out the actually needed functionality to learn the associated
hardware IRQ and move that into gic-vgic.c to improve abstraction.

Signed-off-by: Andre Przywara <andre.przywara@linaro.org>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Julien Grall <julien.grall@arm.com>
xen/arch/arm/gic-vgic.c
xen/arch/arm/irq.c
xen/include/asm-arm/vgic.h

index 820e464fc0879daa74e7b434d11bee57f1569553..72a904bbeb67ba710410421855a6121b8693e98e 100644 (file)
@@ -397,6 +397,23 @@ void gic_dump_vgic_info(struct vcpu *v)
         printk("Pending irq=%d\n", p->irq);
 }
 
+struct irq_desc *vgic_get_hw_irq_desc(struct domain *d, struct vcpu *v,
+                                      unsigned int virq)
+{
+    struct pending_irq *p;
+
+    ASSERT(!v && virq >= 32);
+
+    if ( !v )
+        v = d->vcpu[0];
+
+    p = irq_to_pending(v, virq);
+    if ( !p )
+        return NULL;
+
+    return p->desc;
+}
+
 int vgic_connect_hw_irq(struct domain *d, struct vcpu *v, unsigned int virq,
                         struct irq_desc *desc, bool connect)
 {
index 7f133de54907b323a68d4791c1ceab5986713a82..62103a20e3035c90347f9ad27a1801e739f524cf 100644 (file)
@@ -534,19 +534,16 @@ int release_guest_irq(struct domain *d, unsigned int virq)
     struct irq_desc *desc;
     struct irq_guest *info;
     unsigned long flags;
-    struct pending_irq *p;
     int ret;
 
     /* Only SPIs are supported */
     if ( virq < NR_LOCAL_IRQS || virq >= vgic_num_irqs(d) )
         return -EINVAL;
 
-    p = spi_to_pending(d, virq);
-    if ( !p->desc )
+    desc = vgic_get_hw_irq_desc(d, NULL, virq);
+    if ( !desc )
         return -EINVAL;
 
-    desc = p->desc;
-
     spin_lock_irqsave(&desc->lock, flags);
 
     ret = -EINVAL;
index fda082395b5f9dba4f7e1ad368421f7a51280452..6ea9f140a7b0266d26ec38cdf7af280244031c8f 100644 (file)
@@ -219,6 +219,8 @@ int vgic_v2_init(struct domain *d, int *mmio_count);
 int vgic_v3_init(struct domain *d, int *mmio_count);
 
 bool vgic_evtchn_irq_pending(struct vcpu *v);
+struct irq_desc *vgic_get_hw_irq_desc(struct domain *d, struct vcpu *v,
+                                      unsigned int virq);
 int vgic_connect_hw_irq(struct domain *d, struct vcpu *v, unsigned int virq,
                         struct irq_desc *desc, bool connect);