Skip to content

Commit 99ad198

Browse files
Stefano StabelliniJeremy Fitzhardinge
authored andcommitted
xen: Fix find_unbound_irq in presence of ioapic irqs.
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>
1 parent 016b6f5 commit 99ad198

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

‎drivers/xen/events.c‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,18 @@ static int find_unbound_irq(void)
340340
int irq;
341341
struct irq_desc *desc;
342342

343-
for (irq = 0; irq < nr_irqs; irq++)
343+
for (irq = 0; irq < nr_irqs; irq++) {
344+
desc = irq_to_desc(irq);
345+
/* only 0->15 have init'd desc; handle irq > 16 */
346+
if (desc == NULL)
347+
break;
348+
if (desc->chip == &no_irq_chip)
349+
break;
350+
if (desc->chip != &xen_dynamic_chip)
351+
continue;
344352
if (irq_info[irq].type == IRQT_UNBOUND)
345353
break;
354+
}
346355

347356
if (irq == nr_irqs)
348357
panic("No available IRQ to bind to: increase nr_irqs!\n");
@@ -351,7 +360,7 @@ static int find_unbound_irq(void)
351360
if (WARN_ON(desc == NULL))
352361
return -1;
353362

354-
dynamic_irq_init(irq);
363+
dynamic_irq_init_keep_chip_data(irq);
355364

356365
return irq;
357366
}

0 commit comments

Comments
 (0)