]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
xen: Fix find_unbound_irq in presence of ioapic irqs.
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>
Fri, 14 May 2010 11:41:20 +0000 (12:41 +0100)
committerJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Thu, 22 Jul 2010 23:46:30 +0000 (16:46 -0700)
Don't break the assumption that the first 16 irqs are ISA irqs;
make sure that the irq is actually free before using it.

Use dynamic_irq_init_keep_chip_data instead of
dynamic_irq_init so that chip_data is not NULL (a NULL chip_data breaks
setup_vector_irq).

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
drivers/xen/events.c

index 7c64473c9f3f1bb75c2a94538a4c24589ea4f934..b5a254e9aebe093e2492582328dfbcba7cf6ac88 100644 (file)
@@ -340,9 +340,18 @@ static int find_unbound_irq(void)
        int irq;
        struct irq_desc *desc;
 
-       for (irq = 0; irq < nr_irqs; irq++)
+       for (irq = 0; irq < nr_irqs; irq++) {
+               desc = irq_to_desc(irq);
+               /* only 0->15 have init'd desc; handle irq > 16 */
+               if (desc == NULL)
+                       break;
+               if (desc->chip == &no_irq_chip)
+                       break;
+               if (desc->chip != &xen_dynamic_chip)
+                       continue;
                if (irq_info[irq].type == IRQT_UNBOUND)
                        break;
+       }
 
        if (irq == nr_irqs)
                panic("No available IRQ to bind to: increase nr_irqs!\n");
@@ -351,7 +360,7 @@ static int find_unbound_irq(void)
        if (WARN_ON(desc == NULL))
                return -1;
 
-       dynamic_irq_init(irq);
+       dynamic_irq_init_keep_chip_data(irq);
 
        return irq;
 }