Blob Blame History Raw
From: Joerg Roedel <jroedel@suse.de>
Date: Fri, 6 Oct 2017 12:22:06 +0200
Subject: iommu/amd: Enforce alignment for MSI IRQs
Git-commit: 53b9ec3fbb7da97d13951debbd42e3a0c4a7c9f7
Patch-mainline: v4.15-rc1
References: bsc#975772

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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -4305,7 +4305,9 @@ static int irq_remapping_alloc(struct ir
 		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");