Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Stefano Stabellini and committed by
Jeremy Fitzhardinge
99ad198c 016b6f5f

+11 -2
+11 -2
drivers/xen/events.c
··· 340 340 int irq; 341 341 struct irq_desc *desc; 342 342 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; 344 352 if (irq_info[irq].type == IRQT_UNBOUND) 345 353 break; 354 + } 346 355 347 356 if (irq == nr_irqs) 348 357 panic("No available IRQ to bind to: increase nr_irqs!\n"); ··· 360 351 if (WARN_ON(desc == NULL)) 361 352 return -1; 362 353 363 - dynamic_irq_init(irq); 354 + dynamic_irq_init_keep_chip_data(irq); 364 355 365 356 return irq; 366 357 }