xen/arm: IRQ Introduce irq_get_domain
authorJulien Grall <julien.grall@linaro.org>
Tue, 22 Apr 2014 12:58:41 +0000 (13:58 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 2 May 2014 12:14:09 +0000 (13:14 +0100)
This function retrieves a domain from an IRQ. It will be used in several
places (such as do_IRQ) to avoid duplicated code when multiple action will be
supported.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
xen/arch/arm/irq.c

index f3a30bdb1bface7978b0356d0feb8df99758b0a2..26574ca348b5649fd2f085bb3470b4df0f1a9a06 100644 (file)
@@ -98,6 +98,18 @@ void __cpuinit init_secondary_IRQ(void)
     BUG_ON(init_local_irq_data() < 0);
 }
 
+static inline struct domain *irq_get_domain(struct irq_desc *desc)
+{
+    ASSERT(spin_is_locked(&desc->lock));
+
+    if ( !(desc->status & IRQ_GUEST) )
+        return dom_xen;
+
+    ASSERT(desc->action != NULL);
+
+    return desc->action->dev_id;
+}
+
 int request_dt_irq(const struct dt_irq *irq,
                    void (*handler)(int, void *, struct cpu_user_regs *),
                    const char *devname, void *dev_id)
@@ -156,7 +168,7 @@ void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq)
 
     if ( desc->status & IRQ_GUEST )
     {
-        struct domain *d = action->dev_id;
+        struct domain *d = irq_get_domain(desc);
 
         desc->handler->end(desc);