Skip to contentSkip to conversation

dmaengine: dw-edma: fix MSI data programming for multi-IRQ case

PATCH Superseded Shi-Shenghui 3 participants 5 messages Feb 9 – Feb 25

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v6 1/1 dmaengine: dw-edma: fix MSI data programming for multi-IRQ case

From: Shenghui Shi <[email protected]>

When using MSI (not MSI-X) with multiple IRQs, the MSI data value must be unique per vector to ensure correct interrupt delivery. Currently, the driver fails to increment the MSI data per vector, causing interrupts to be misrouted.

Fix this by caching the base MSI data and adjusting each vector's data accordingly during IRQ setup.

Fixes e63d79d1ff04 ("dmaengine: dw-edma: Add Synopsys DesignWare eDMA IP core driver")
---
 drivers/dma/dw-edma/dw-edma-core.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/dma/dw-edma/dw-edma-core.c +8 -1
index 8e5f7defa6b6..dccc686b7a3e 100644
@@ -844,6 +844,7 @@ static int dw_edma_irq_request(struct dw_edma *dw,
 {
 	struct dw_edma_chip *chip = dw->chip;
 	struct device *dev = dw->chip->dev;
+	struct msi_desc *msi_desc;
 	u32 wr_mask = 1;
 	u32 rd_mask = 1;
 	int i, err = 0;
@@ -895,9 +896,15 @@ static int dw_edma_irq_request(struct dw_edma *dw,
 					  &dw->irq[i]);
 			if (err)
 				goto err_irq_free;
+			msi_desc = irq_get_msi_desc(irq);
+			if (msi_desc) {
+				bool is_msi;
 
-			if (irq_get_msi_desc(irq))
 				get_cached_msi_msg(irq, &dw->irq[i].msi);
+				is_msi = msi_desc && !msi_desc->pci.msi_attrib.is_msix;
+				if (is_msi)
+					dw->irq[i].msi.data = dw->irq[0].msi.data + i;
+			}
 		}
 
 		dw->nr_irqs = i;
Signature · 1 line
2.49.0.windows.1
#1 lore raw

PATCH v7 1/1 dmaengine: dw-edma: fix MSI data programming for multi-IRQ case

From: Shenghui Shi <[email protected]>

When using MSI (not MSI-X) with multiple IRQs, the MSI data value must be unique per vector to ensure correct interrupt delivery. Currently, the driver fails to increment the MSI data per vector, causing interrupts to be misrouted.

Fix this by caching the base MSI data and adjusting each vector's data accordingly during IRQ setup.

Fixes e63d79d1ff04 ("dmaengine: dw-edma: Add Synopsys DesignWare eDMA IP core driver")
---
 drivers/dma/dw-edma/dw-edma-core.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/dma/dw-edma/dw-edma-core.c +6 -2
index 8e5f7defa6b6..22d906426d75 100644
@@ -844,6 +844,7 @@ static int dw_edma_irq_request(struct dw_edma *dw,
 {
 	struct dw_edma_chip *chip = dw->chip;
 	struct device *dev = dw->chip->dev;
+	struct msi_desc *msi_desc;
 	u32 wr_mask = 1;
 	u32 rd_mask = 1;
 	int i, err = 0;
@@ -895,9 +896,12 @@ static int dw_edma_irq_request(struct dw_edma *dw,
 					  &dw->irq[i]);
 			if (err)
 				goto err_irq_free;
-
-			if (irq_get_msi_desc(irq))
+			msi_desc = irq_get_msi_desc(irq);
+			if (msi_desc) {
 				get_cached_msi_msg(irq, &dw->irq[i].msi);
+				if (!msi_desc->pci.msi_attrib.is_msix)
+					dw->irq[i].msi.data = dw->irq[0].msi.data + i;
+			}
 		}
 
 		dw->nr_irqs = i;
Signature · 1 line
2.49.0.windows.1
Reviewed-by on v7 1/1
#2 lore raw
Quoted 7 lines · Shi-Shenghui

From: Shenghui Shi <[email protected]>

When using MSI (not MSI-X) with multiple IRQs, the MSI data value must be unique per vector to ensure correct interrupt delivery. Currently, the driver fails to increment the MSI data per vector, causing interrupts to be misrouted.

Quoted 7 lines

Fix this by caching the base MSI data and adjusting each vector's data accordingly during IRQ setup.

Fixes e63d79d1ff04 ("dmaengine: dw-edma: Add Synopsys DesignWare eDMA IP core driver")

---

Quoted 33 lines
 drivers/dma/dw-edma/dw-edma-core.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/dma/dw-edma/dw-edma-core.c +6 -3
index 8e5f7defa6b6..22d906426d75 100644
@@ -844,6 +844,7 @@ static int dw_edma_irq_request(struct dw_edma *dw,
 {
 	struct dw_edma_chip *chip = dw->chip;
 	struct device *dev = dw->chip->dev;
+	struct msi_desc *msi_desc;
 	u32 wr_mask = 1;
 	u32 rd_mask = 1;
 	int i, err = 0;
@@ -895,9 +896,12 @@ static int dw_edma_irq_request(struct dw_edma *dw,
 					  &dw->irq[i]);
 			if (err)
 				goto err_irq_free;
-
-			if (irq_get_msi_desc(irq))
+			msi_desc = irq_get_msi_desc(irq);
+			if (msi_desc) {
 				get_cached_msi_msg(irq, &dw->irq[i].msi);
+				if (!msi_desc->pci.msi_attrib.is_msix)
+					dw->irq[i].msi.data = dw->irq[0].msi.data + i;
+			}
 		}
 
 		dw->nr_irqs = i;
--

2.49.0.windows.1

maintainer
#3 lore raw
In reply to Shi-Shenghui
Quoted 7 lines · Shi-Shenghui

From: Shenghui Shi <[email protected]>

When using MSI (not MSI-X) with multiple IRQs, the MSI data value must be unique per vector to ensure correct interrupt delivery. Currently, the driver fails to increment the MSI data per vector, causing interrupts to be misrouted.

Quoted 6 lines

Fix this by caching the base MSI data and adjusting each vector's data accordingly during IRQ setup.

Fixes e63d79d1ff04 ("dmaengine: dw-edma: Add Synopsys DesignWare eDMA IP core driver")

No blank lines after Fixes tag please. I have fixed it while applying

Signature · 1 line
~Vinod
maintainer Applied
#4 lore raw
In reply to Shi-Shenghui
Quoted 9 lines · Shi-Shenghui

When using MSI (not MSI-X) with multiple IRQs, the MSI data value must be unique per vector to ensure correct interrupt delivery. Currently, the driver fails to increment the MSI data per vector, causing interrupts to be misrouted.

Fix this by caching the base MSI data and adjusting each vector's data accordingly during IRQ setup.

[...]

Applied, thanks!

[1/1] dmaengine: dw-edma: fix MSI data programming for multi-IRQ case

      commit: 77b19d053ac2cce9e873007ad4b09f2323c93576

Best regards,

Signature · 1 line
~Vinod