[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251217151609.3162665-11-den@valinux.co.jp>
Date: Thu, 18 Dec 2025 00:15:44 +0900
From: Koichiro Den <den@...inux.co.jp>
To: Frank.Li@....com,
dave.jiang@...el.com,
ntb@...ts.linux.dev,
linux-pci@...r.kernel.org,
dmaengine@...r.kernel.org,
linux-renesas-soc@...r.kernel.org,
netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: mani@...nel.org,
kwilczynski@...nel.org,
kishon@...nel.org,
bhelgaas@...gle.com,
corbet@....net,
geert+renesas@...der.be,
magnus.damm@...il.com,
robh@...nel.org,
krzk+dt@...nel.org,
conor+dt@...nel.org,
vkoul@...nel.org,
joro@...tes.org,
will@...nel.org,
robin.murphy@....com,
jdmason@...zu.us,
allenbh@...il.com,
andrew+netdev@...n.ch,
davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
Basavaraj.Natikar@....com,
Shyam-sundar.S-k@....com,
kurt.schwemmer@...rosemi.com,
logang@...tatee.com,
jingoohan1@...il.com,
lpieralisi@...nel.org,
utkarsh02t@...il.com,
jbrunet@...libre.com,
dlemoal@...nel.org,
arnd@...db.de,
elfring@...rs.sourceforge.net,
den@...inux.co.jp
Subject: [RFC PATCH v3 10/35] dmaengine: dw-edma: Fix MSI data values for multi-vector IMWr interrupts
When multiple MSI vectors are allocated for the DesignWare eDMA, the
driver currently records the same MSI message for all IRQs by calling
get_cached_msi_msg() per vector. For multi-vector MSI (as opposed to
MSI-X), the cached message corresponds to vector 0 and msg.data is
supposed to be adjusted by the vector index.
As a result, all eDMA interrupts share the same MSI data value and the
interrupt controller cannot distinguish between them.
Introduce dw_edma_compose_msi() to construct the correct MSI message for
each vector. For MSI-X nothing changes. For multi-vector MSI, derive the
base IRQ with msi_get_virq(dev, 0) and apply the per-vector offset to
msg.data before storing it in dw->irq[i].msi.
This makes each IMWr MSI vector use a unique MSI data value.
Signed-off-by: Koichiro Den <den@...inux.co.jp>
---
drivers/dma/dw-edma/dw-edma-core.c | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c
index 744c60ec9641..1b935da65d05 100644
--- a/drivers/dma/dw-edma/dw-edma-core.c
+++ b/drivers/dma/dw-edma/dw-edma-core.c
@@ -855,6 +855,28 @@ static inline void dw_edma_add_irq_mask(u32 *mask, u32 alloc, u16 cnt)
(*mask)++;
}
+static void dw_edma_compose_msi(struct device *dev, int irq, struct msi_msg *out)
+{
+ struct msi_desc *desc = irq_get_msi_desc(irq);
+ struct msi_msg msg;
+ unsigned int base;
+
+ if (!desc)
+ return;
+
+ get_cached_msi_msg(irq, &msg);
+ if (!desc->pci.msi_attrib.is_msix) {
+ /*
+ * For multi-vector MSI, the cached message corresponds to
+ * vector 0. Adjust msg.data by the IRQ index so that each
+ * vector gets a unique MSI data value for IMWr Data Register.
+ */
+ base = msi_get_virq(dev, 0);
+ msg.data |= (irq - base);
+ }
+ *out = msg;
+}
+
static int dw_edma_irq_request(struct dw_edma *dw,
u32 *wr_alloc, u32 *rd_alloc)
{
@@ -885,8 +907,7 @@ static int dw_edma_irq_request(struct dw_edma *dw,
return err;
}
- if (irq_get_msi_desc(irq))
- get_cached_msi_msg(irq, &dw->irq[0].msi);
+ dw_edma_compose_msi(dev, irq, &dw->irq[0].msi);
dw->nr_irqs = 1;
} else {
@@ -912,8 +933,7 @@ static int dw_edma_irq_request(struct dw_edma *dw,
if (err)
goto err_irq_free;
- if (irq_get_msi_desc(irq))
- get_cached_msi_msg(irq, &dw->irq[i].msi);
+ dw_edma_compose_msi(dev, irq, &dw->irq[i].msi);
}
dw->nr_irqs = i;
--
2.51.0
Powered by blists - more mailing lists