diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2010-12-13 15:56:08 +1100 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2010-12-13 15:56:08 +1100 |
commit | 9a7036f4bd72083687dad13003889a178cac67f7 (patch) | |
tree | d5a37119ec4364e9f12a647123d6eb96a158f75d /drivers | |
parent | 5168335a5ac0e36fa2d27ee204a3818046854f9e (diff) | |
parent | 055c5e151501d1c48e61690a2713fd3207f00994 (diff) |
Merge commit 'refs/next/20101210/swiotlb-xen'
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/xen/events.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 31af0ac31a98..11687ddf6426 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c @@ -405,15 +405,22 @@ static int find_unbound_irq(void) { struct irq_data *data; int irq, res; - int start = get_nr_hw_irqs(); + int bottom = get_nr_hw_irqs(); + int top = nr_irqs-1; - if (start == nr_irqs) + if (bottom == nr_irqs) goto no_irqs; - /* nr_irqs is a magic value. Must not use it.*/ - for (irq = nr_irqs-1; irq > start; irq--) { +retry: + /* This loop starts from the top of IRQ space and goes down. + * We need this b/c if we have a PCI device in a Xen PV guest + * we do not have an IO-APIC (though the backend might have them) + * mapped in. To not have a collision of physical IRQs with the Xen + * event channels start at the top of the IRQ space for virtual IRQs. + */ + for (irq = top; irq > bottom; irq--) { data = irq_get_irq_data(irq); - /* only 0->15 have init'd desc; handle irq > 16 */ + /* only 15->0 have init'd desc; handle irq > 16 */ if (!data) break; if (data->chip == &no_irq_chip) @@ -424,10 +431,18 @@ static int find_unbound_irq(void) return irq; } - if (irq == start) + if (irq == bottom) goto no_irqs; res = irq_alloc_desc_at(irq, -1); + if (res == -EEXIST) { + top--; + if (bottom > top) + printk(KERN_ERR "Eating in GSI/MSI space (%ld)!" \ + " Your PCI device might not work!\n", top); + if (top > NR_IRQS_LEGACY) + goto retry; + } if (WARN_ON(res != irq)) return -1; |