iommu/amd: Enforce alignment for MSI IRQs
authorJoerg Roedel <jroedel@suse.de>
Fri, 6 Oct 2017 10:22:06 +0000 (12:22 +0200)
committerJoerg Roedel <jroedel@suse.de>
Tue, 10 Oct 2017 14:04:20 +0000 (16:04 +0200)
Make use of the new alignment capability of
alloc_irq_index() to enforce IRQ index alignment
for MSI.

Reported-by: Thomas Gleixner <tglx@linutronix.de>
Fixes: 2b324506341cb ('iommu/amd: Add routines to manage irq remapping tables')
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/amd_iommu.c

index 2d4ee25..cb7c531 100644 (file)
@@ -4102,7 +4102,9 @@ static int irq_remapping_alloc(struct irq_domain *domain, unsigned int virq,
                else
                        ret = -ENOMEM;
        } else {
-               index = alloc_irq_index(devid, nr_irqs, false);
+               bool align = (info->type == X86_IRQ_ALLOC_TYPE_MSI);
+
+               index = alloc_irq_index(devid, nr_irqs, align);
        }
        if (index < 0) {
                pr_warn("Failed to allocate IRTE\n");