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

[Xen-changelog] [xen master] xen/arm: Replace route_guest_dt_irq by route_guest_irq



commit ebb398b771a0d205f5cd2e36e98da83b186265cf
Author:     Julien Grall <julien.grall@xxxxxxxxxx>
AuthorDate: Fri May 16 15:40:29 2014 +0100
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Wed May 21 12:48:01 2014 +0100

    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>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 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 c424793..ddbb88d 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -686,7 +686,7 @@ static int map_device(struct domain *d, 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;
 
@@ -729,20 +729,22 @@ static int map_device(struct domain *d, 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 0808e36..fa35e0d 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..c9dd63c 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_spi_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 bb55390..e567f71 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_spi_type(unsigned int spi, unsigned int type);
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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