Commit 596a7a1d authored by John Keeping's avatar John Keeping Committed by Thomas Gleixner

genirq/msi: Fix populating multiple interrupts

On allocating the interrupts routed via a wire-to-MSI bridge, the allocator
iterates over the MSI descriptors to build the hierarchy, but fails to use
the descriptor interrupt number, and instead uses the base number,
generating the wrong IRQ domain mappings.

The fix is to use the MSI descriptor interrupt number when setting up
the interrupt instead of the base interrupt for the allocation range.

The only saving grace is that although the MSI descriptors are allocated
in bulk, the wired interrupts are only allocated one by one (so
desc->irq == virq) and the bug went unnoticed so far.

Fixes: 2145ac93 ("genirq/msi: Add msi_domain_populate_irqs")
Signed-off-by: default avatarJohn Keeping <john@metanate.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/20170906103540.373864a2.john@metanate.com
parent 24e700e2
...@@ -315,11 +315,12 @@ int msi_domain_populate_irqs(struct irq_domain *domain, struct device *dev, ...@@ -315,11 +315,12 @@ int msi_domain_populate_irqs(struct irq_domain *domain, struct device *dev,
ops->set_desc(arg, desc); ops->set_desc(arg, desc);
/* Assumes the domain mutex is held! */ /* Assumes the domain mutex is held! */
ret = irq_domain_alloc_irqs_hierarchy(domain, virq, 1, arg); ret = irq_domain_alloc_irqs_hierarchy(domain, desc->irq, 1,
arg);
if (ret) if (ret)
break; break;
irq_set_msi_desc_off(virq, 0, desc); irq_set_msi_desc_off(desc->irq, 0, desc);
} }
if (ret) { if (ret) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment