Skip to content

Commit d0a5535

Browse files
paliMarc Zyngier
authored andcommitted
irqchip/armada-370-xp: Fix support for Multi-MSI interrupts
irq-armada-370-xp driver already sets MSI_FLAG_MULTI_PCI_MSI flag into msi_domain_info structure. But allocated interrupt numbers for Multi-MSI needs to be properly aligned otherwise devices send MSI interrupt with wrong number. Fix this issue by using function bitmap_find_free_region() instead of bitmap_find_next_zero_area() to allocate aligned interrupt numbers. Signed-off-by: Pali Rohár <[email protected]> Fixes: a71b941 ("irqchip/armada-370-xp: Allow allocation of multiple MSIs") Cc: [email protected] Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent ce20eff commit d0a5535

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

drivers/irqchip/irq-armada-370-xp.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -232,16 +232,12 @@ static int armada_370_xp_msi_alloc(struct irq_domain *domain, unsigned int virq,
232232
int hwirq, i;
233233

234234
mutex_lock(&msi_used_lock);
235+
hwirq = bitmap_find_free_region(msi_used, PCI_MSI_DOORBELL_NR,
236+
order_base_2(nr_irqs));
237+
mutex_unlock(&msi_used_lock);
235238

236-
hwirq = bitmap_find_next_zero_area(msi_used, PCI_MSI_DOORBELL_NR,
237-
0, nr_irqs, 0);
238-
if (hwirq >= PCI_MSI_DOORBELL_NR) {
239-
mutex_unlock(&msi_used_lock);
239+
if (hwirq < 0)
240240
return -ENOSPC;
241-
}
242-
243-
bitmap_set(msi_used, hwirq, nr_irqs);
244-
mutex_unlock(&msi_used_lock);
245241

246242
for (i = 0; i < nr_irqs; i++) {
247243
irq_domain_set_info(domain, virq + i, hwirq + i,
@@ -259,7 +255,7 @@ static void armada_370_xp_msi_free(struct irq_domain *domain,
259255
struct irq_data *d = irq_domain_get_irq_data(domain, virq);
260256

261257
mutex_lock(&msi_used_lock);
262-
bitmap_clear(msi_used, d->hwirq, nr_irqs);
258+
bitmap_release_region(msi_used, d->hwirq, order_base_2(nr_irqs));
263259
mutex_unlock(&msi_used_lock);
264260
}
265261

0 commit comments

Comments
 (0)