[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v6 3/6] xen/arm: Replace route_guest_dt_irq by route_guest_irq



We can use platform_get_irq to get the IRQ which will be route to the guest.

platform_get_irq will store the type of IRQ (e.g level/edge...) directly in
the irq_desc.

This will avoid to have device tree specific routing function.

Signed-off-by: Julien Grall <julien.grall@xxxxxxxxxx>

---
    Changes in v6:
        - Patch added
---
 xen/arch/arm/domain_build.c          |   16 +++++++++-------
 xen/arch/arm/irq.c                   |   12 +++++-------
 xen/arch/arm/platforms/xgene-storm.c |   15 ++++++++++-----
 xen/include/asm-arm/irq.h            |    4 ++--
 4 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index af5cd6c..fd35223 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -685,7 +685,7 @@ static int map_device(struct domain *d, const struct 
dt_device_node *dev)
     unsigned int naddr;
     unsigned int i;
     int res;
-    struct dt_irq irq;
+    unsigned int irq;
     struct dt_raw_irq rirq;
     u64 addr, size;
 
@@ -716,20 +716,22 @@ static int map_device(struct domain *d, const struct 
dt_device_node *dev)
             continue;
         }
 
-        res = dt_irq_translate(&rirq, &irq);
-        if ( res )
+        res = platform_get_irq(dev, i);
+        if ( res < 0 )
         {
-            printk(XENLOG_ERR "Unable to translate irq %u for %s\n",
+            printk(XENLOG_ERR "Unable to get irq %u for %s\n",
                    i, dt_node_full_name(dev));
             return res;
         }
 
-        DPRINT("irq %u = %u type = 0x%x\n", i, irq.irq, irq.type);
-        res = route_dt_irq_to_guest(d, &irq, dt_node_name(dev));
+        irq = res;
+
+        DPRINT("irq %u = %u\n", i, irq);
+        res = route_irq_to_guest(d, irq, dt_node_name(dev));
         if ( res )
         {
             printk(XENLOG_ERR "Unable to route IRQ %u to domain %u\n",
-                   irq.irq, d->domain_id);
+                   irq, d->domain_id);
             return res;
         }
     }
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 34238a1..4b0d534 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -316,11 +316,11 @@ err:
     return rc;
 }
 
-int route_dt_irq_to_guest(struct domain *d, const struct dt_irq *irq,
-                          const char * devname)
+int route_irq_to_guest(struct domain *d, unsigned int irq,
+                       const char * devname)
 {
     struct irqaction *action;
-    struct irq_desc *desc = irq_to_desc(irq->irq);
+    struct irq_desc *desc = irq_to_desc(irq);
     unsigned long flags;
     int retval = 0;
 
@@ -348,10 +348,9 @@ int route_dt_irq_to_guest(struct domain *d, const struct 
dt_irq *irq,
 
         if ( desc->status & IRQ_GUEST )
             printk(XENLOG_ERR "ERROR: IRQ %u is already used by domain %u\n",
-                   irq->irq, ad->domain_id);
+                   irq, ad->domain_id);
         else
-            printk(XENLOG_ERR "ERROR: IRQ %u is already used by Xen\n",
-                   irq->irq);
+            printk(XENLOG_ERR "ERROR: IRQ %u is already used by Xen\n", irq);
         retval = -EBUSY;
         goto out;
     }
@@ -360,7 +359,6 @@ int route_dt_irq_to_guest(struct domain *d, const struct 
dt_irq *irq,
     if ( retval )
         goto out;
 
-    desc->arch.type = irq->type;
     gic_route_irq_to_guest(d, desc, cpumask_of(smp_processor_id()),
                            GIC_PRI_IRQ);
     spin_unlock_irqrestore(&desc->lock, flags);
diff --git a/xen/arch/arm/platforms/xgene-storm.c 
b/xen/arch/arm/platforms/xgene-storm.c
index 70aab73..37a0bf1 100644
--- a/xen/arch/arm/platforms/xgene-storm.c
+++ b/xen/arch/arm/platforms/xgene-storm.c
@@ -57,16 +57,21 @@ static int map_one_mmio(struct domain *d, const char *what,
 static int map_one_spi(struct domain *d, const char *what,
                        unsigned int spi, unsigned int type)
 {
-    struct dt_irq irq;
+    unsigned int irq;
     int ret;
 
-    irq.type = type;
+    irq = spi + 32; /* SPIs start at IRQ 32 */
 
-    irq.irq = spi + 32; /* SPIs start at IRQ 32 */
+    ret = irq_set_type(irq, type);
+    if ( ret )
+    {
+        printk("Failed to set the type for IRQ%u\n", irq);
+        return ret;
+    }
 
-    printk("Additional IRQ %u (%s)\n", irq.irq, what);
+    printk("Additional IRQ %u (%s)\n", irq, what);
 
-    ret = route_dt_irq_to_guest(d, &irq, what);
+    ret = route_irq_to_guest(d, irq, what);
     if ( ret )
         printk("Failed to route %s to dom%d\n", what, d->domain_id);
 
diff --git a/xen/include/asm-arm/irq.h b/xen/include/asm-arm/irq.h
index c23faa4..3bf0363 100644
--- a/xen/include/asm-arm/irq.h
+++ b/xen/include/asm-arm/irq.h
@@ -40,8 +40,8 @@ void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int 
is_fiq);
 void init_IRQ(void);
 void init_secondary_IRQ(void);
 
-int route_dt_irq_to_guest(struct domain *d, const struct dt_irq *irq,
-                          const char *devname);
+int route_irq_to_guest(struct domain *d, unsigned int irq,
+                       const char *devname);
 
 /* Set IRQ type for an SPI */
 int irq_set_type(unsigned int spi, unsigned int type);
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.