* [PATCH] dmaengine: dw-edma: Mark emulated IRQ as level-triggered
@ 2026-07-30 16:07 Koichiro Den
2026-07-30 16:14 ` Koichiro Den
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Koichiro Den @ 2026-07-30 16:07 UTC (permalink / raw)
To: Manivannan Sadhasivam, Vinod Koul, Frank Li; +Cc: dmaengine, linux-kernel
The interrupt-emulation virtual IRQ uses handle_level_irq(), but the IRQ
descriptor has not been marked with IRQ_LEVEL.
The interrupt emulation is somewhat unusual: the eDMA interrupt handlers
dispatch the virtual IRQ for every edma_int[] interrupt because software
cannot reliably tell an interrupt-emulation event from one caused solely
by DONE/ABORT status. If an interrupt arrives before the doorbell
handler is registered for the virtual IRQ, the IRQ core marks it
pending. When the IRQ is later started, check_irq_resend() treats it as
non-level and replays the pending interrupt, causing the newly
registered handler to run for a stale event.
Mark the virtual IRQ with IRQ_LEVEL so the stale pending state is
cleared without being replayed. This was observed in pci_endpoint_test
as two doorbell handler calls when the DMA-variant test ran before
DOORBELL_TEST.
Fixes: d9d5e1bdd180 ("dmaengine: dw-edma: Add virtual IRQ for interrupt-emulation doorbells")
Cc: stable@vger.kernel.org
Reported-by: Niklas Cassel <cassel@kernel.org>
Closes: https://lore.kernel.org/r/ampndLtU32ODmncX@ryzen
Tested-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Koichiro Den <den@valinux.co.jp>
---
drivers/dma/dw-edma/dw-edma-core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c
index 89a4c498a17b..ec097c68cf5f 100644
--- a/drivers/dma/dw-edma/dw-edma-core.c
+++ b/drivers/dma/dw-edma/dw-edma-core.c
@@ -755,6 +755,7 @@ static int dw_edma_emul_irq_alloc(struct dw_edma *dw)
return virq;
irq_set_chip_and_handler(virq, &dw_edma_emul_irqchip, handle_level_irq);
+ irq_set_status_flags(virq, IRQ_LEVEL);
irq_set_chip_data(virq, dw);
irq_set_noprobe(virq);
base-commit: f5098b6bae761e346ebcd9da7f95622c04733cff
--
2.51.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] dmaengine: dw-edma: Mark emulated IRQ as level-triggered
2026-07-30 16:07 [PATCH] dmaengine: dw-edma: Mark emulated IRQ as level-triggered Koichiro Den
@ 2026-07-30 16:14 ` Koichiro Den
2026-07-30 16:39 ` Manivannan Sadhasivam
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Koichiro Den @ 2026-07-30 16:14 UTC (permalink / raw)
To: Niklas Cassel, Manivannan Sadhasivam, Vinod Koul, Frank Li
Cc: Niklas Cassel, dmaengine, linux-kernel
On Fri, Jul 31, 2026 at 01:07:01AM +0900, Koichiro Den wrote:
> The interrupt-emulation virtual IRQ uses handle_level_irq(), but the IRQ
> descriptor has not been marked with IRQ_LEVEL.
>
> The interrupt emulation is somewhat unusual: the eDMA interrupt handlers
> dispatch the virtual IRQ for every edma_int[] interrupt because software
> cannot reliably tell an interrupt-emulation event from one caused solely
> by DONE/ABORT status. If an interrupt arrives before the doorbell
> handler is registered for the virtual IRQ, the IRQ core marks it
> pending. When the IRQ is later started, check_irq_resend() treats it as
> non-level and replays the pending interrupt, causing the newly
> registered handler to run for a stale event.
>
> Mark the virtual IRQ with IRQ_LEVEL so the stale pending state is
> cleared without being replayed. This was observed in pci_endpoint_test
> as two doorbell handler calls when the DMA-variant test ran before
> DOORBELL_TEST.
>
> Fixes: d9d5e1bdd180 ("dmaengine: dw-edma: Add virtual IRQ for interrupt-emulation doorbells")
> Cc: stable@vger.kernel.org
> Reported-by: Niklas Cassel <cassel@kernel.org>
> Closes: https://lore.kernel.org/r/ampndLtU32ODmncX@ryzen
> Tested-by: Niklas Cassel <cassel@kernel.org>
> Signed-off-by: Koichiro Den <den@valinux.co.jp>
[+Cc Niklas]
Sorry, I forgot to Cc Niklas.
I relied too much on the get_maintainer.pl (again..)
Niklas, thanks for reporting, discussing and testing.
Best regards,
Koichiro
> ---
> drivers/dma/dw-edma/dw-edma-core.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c
> index 89a4c498a17b..ec097c68cf5f 100644
> --- a/drivers/dma/dw-edma/dw-edma-core.c
> +++ b/drivers/dma/dw-edma/dw-edma-core.c
> @@ -755,6 +755,7 @@ static int dw_edma_emul_irq_alloc(struct dw_edma *dw)
> return virq;
>
> irq_set_chip_and_handler(virq, &dw_edma_emul_irqchip, handle_level_irq);
> + irq_set_status_flags(virq, IRQ_LEVEL);
> irq_set_chip_data(virq, dw);
> irq_set_noprobe(virq);
>
>
> base-commit: f5098b6bae761e346ebcd9da7f95622c04733cff
> --
> 2.51.0
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dmaengine: dw-edma: Mark emulated IRQ as level-triggered
2026-07-30 16:07 [PATCH] dmaengine: dw-edma: Mark emulated IRQ as level-triggered Koichiro Den
2026-07-30 16:14 ` Koichiro Den
@ 2026-07-30 16:39 ` Manivannan Sadhasivam
2026-07-30 16:50 ` Frank Li
2026-07-30 19:03 ` Frank Li
3 siblings, 0 replies; 5+ messages in thread
From: Manivannan Sadhasivam @ 2026-07-30 16:39 UTC (permalink / raw)
To: Koichiro Den; +Cc: Vinod Koul, Frank Li, dmaengine, linux-kernel
On Fri, Jul 31, 2026 at 01:07:01AM +0900, Koichiro Den wrote:
> The interrupt-emulation virtual IRQ uses handle_level_irq(), but the IRQ
> descriptor has not been marked with IRQ_LEVEL.
>
> The interrupt emulation is somewhat unusual: the eDMA interrupt handlers
> dispatch the virtual IRQ for every edma_int[] interrupt because software
> cannot reliably tell an interrupt-emulation event from one caused solely
> by DONE/ABORT status. If an interrupt arrives before the doorbell
> handler is registered for the virtual IRQ, the IRQ core marks it
> pending. When the IRQ is later started, check_irq_resend() treats it as
> non-level and replays the pending interrupt, causing the newly
> registered handler to run for a stale event.
>
> Mark the virtual IRQ with IRQ_LEVEL so the stale pending state is
> cleared without being replayed. This was observed in pci_endpoint_test
> as two doorbell handler calls when the DMA-variant test ran before
> DOORBELL_TEST.
>
> Fixes: d9d5e1bdd180 ("dmaengine: dw-edma: Add virtual IRQ for interrupt-emulation doorbells")
> Cc: stable@vger.kernel.org
> Reported-by: Niklas Cassel <cassel@kernel.org>
> Closes: https://lore.kernel.org/r/ampndLtU32ODmncX@ryzen
> Tested-by: Niklas Cassel <cassel@kernel.org>
> Signed-off-by: Koichiro Den <den@valinux.co.jp>
MSI handling by DWC cores is a mess. Thanks for fixing this issue:
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
- Mani
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dmaengine: dw-edma: Mark emulated IRQ as level-triggered
2026-07-30 16:07 [PATCH] dmaengine: dw-edma: Mark emulated IRQ as level-triggered Koichiro Den
2026-07-30 16:14 ` Koichiro Den
2026-07-30 16:39 ` Manivannan Sadhasivam
@ 2026-07-30 16:50 ` Frank Li
2026-07-30 19:03 ` Frank Li
3 siblings, 0 replies; 5+ messages in thread
From: Frank Li @ 2026-07-30 16:50 UTC (permalink / raw)
To: Koichiro Den
Cc: Manivannan Sadhasivam, Vinod Koul, Frank Li, dmaengine,
linux-kernel
On Fri, Jul 31, 2026 at 01:07:01AM +0900, Koichiro Den wrote:
> The interrupt-emulation virtual IRQ uses handle_level_irq(), but the IRQ
> descriptor has not been marked with IRQ_LEVEL.
>
> The interrupt emulation is somewhat unusual: the eDMA interrupt handlers
> dispatch the virtual IRQ for every edma_int[] interrupt because software
> cannot reliably tell an interrupt-emulation event from one caused solely
> by DONE/ABORT status. If an interrupt arrives before the doorbell
> handler is registered for the virtual IRQ, the IRQ core marks it
> pending. When the IRQ is later started, check_irq_resend() treats it as
> non-level and replays the pending interrupt, causing the newly
> registered handler to run for a stale event.
>
> Mark the virtual IRQ with IRQ_LEVEL so the stale pending state is
> cleared without being replayed. This was observed in pci_endpoint_test
> as two doorbell handler calls when the DMA-variant test ran before
> DOORBELL_TEST.
>
> Fixes: d9d5e1bdd180 ("dmaengine: dw-edma: Add virtual IRQ for interrupt-emulation doorbells")
> Cc: stable@vger.kernel.org
> Reported-by: Niklas Cassel <cassel@kernel.org>
> Closes: https://lore.kernel.org/r/ampndLtU32ODmncX@ryzen
> Tested-by: Niklas Cassel <cassel@kernel.org>
> Signed-off-by: Koichiro Den <den@valinux.co.jp>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> drivers/dma/dw-edma/dw-edma-core.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c
> index 89a4c498a17b..ec097c68cf5f 100644
> --- a/drivers/dma/dw-edma/dw-edma-core.c
> +++ b/drivers/dma/dw-edma/dw-edma-core.c
> @@ -755,6 +755,7 @@ static int dw_edma_emul_irq_alloc(struct dw_edma *dw)
> return virq;
>
> irq_set_chip_and_handler(virq, &dw_edma_emul_irqchip, handle_level_irq);
> + irq_set_status_flags(virq, IRQ_LEVEL);
> irq_set_chip_data(virq, dw);
> irq_set_noprobe(virq);
>
>
> base-commit: f5098b6bae761e346ebcd9da7f95622c04733cff
> --
> 2.51.0
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dmaengine: dw-edma: Mark emulated IRQ as level-triggered
2026-07-30 16:07 [PATCH] dmaengine: dw-edma: Mark emulated IRQ as level-triggered Koichiro Den
` (2 preceding siblings ...)
2026-07-30 16:50 ` Frank Li
@ 2026-07-30 19:03 ` Frank Li
3 siblings, 0 replies; 5+ messages in thread
From: Frank Li @ 2026-07-30 19:03 UTC (permalink / raw)
To: Koichiro Den
Cc: Manivannan Sadhasivam, Vinod Koul, Frank Li, dmaengine,
linux-kernel
On Fri, Jul 31, 2026 at 01:07:01AM +0900, Koichiro Den wrote:
> The interrupt-emulation virtual IRQ uses handle_level_irq(), but the IRQ
> descriptor has not been marked with IRQ_LEVEL.
>
> The interrupt emulation is somewhat unusual: the eDMA interrupt handlers
> dispatch the virtual IRQ for every edma_int[] interrupt because software
> cannot reliably tell an interrupt-emulation event from one caused solely
> by DONE/ABORT status. If an interrupt arrives before the doorbell
> handler is registered for the virtual IRQ, the IRQ core marks it
> pending. When the IRQ is later started, check_irq_resend() treats it as
> non-level and replays the pending interrupt, causing the newly
> registered handler to run for a stale event.
>
> Mark the virtual IRQ with IRQ_LEVEL so the stale pending state is
> cleared without being replayed. This was observed in pci_endpoint_test
> as two doorbell handler calls when the DMA-variant test ran before
> DOORBELL_TEST.
>
> Fixes: d9d5e1bdd180 ("dmaengine: dw-edma: Add virtual IRQ for interrupt-emulation doorbells")
> Cc: stable@vger.kernel.org
> Reported-by: Niklas Cassel <cassel@kernel.org>
> Closes: https://lore.kernel.org/r/ampndLtU32ODmncX@ryzen
> Tested-by: Niklas Cassel <cassel@kernel.org>
> Signed-off-by: Koichiro Den <den@valinux.co.jp>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> drivers/dma/dw-edma/dw-edma-core.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c
> index 89a4c498a17b..ec097c68cf5f 100644
> --- a/drivers/dma/dw-edma/dw-edma-core.c
> +++ b/drivers/dma/dw-edma/dw-edma-core.c
> @@ -755,6 +755,7 @@ static int dw_edma_emul_irq_alloc(struct dw_edma *dw)
> return virq;
>
> irq_set_chip_and_handler(virq, &dw_edma_emul_irqchip, handle_level_irq);
> + irq_set_status_flags(virq, IRQ_LEVEL);
> irq_set_chip_data(virq, dw);
> irq_set_noprobe(virq);
>
>
> base-commit: f5098b6bae761e346ebcd9da7f95622c04733cff
> --
> 2.51.0
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-07-30 19:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-30 16:07 [PATCH] dmaengine: dw-edma: Mark emulated IRQ as level-triggered Koichiro Den
2026-07-30 16:14 ` Koichiro Den
2026-07-30 16:39 ` Manivannan Sadhasivam
2026-07-30 16:50 ` Frank Li
2026-07-30 19:03 ` Frank Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox