mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] dmaengine: axi-dmac: change IRQ to threaded mode
@ 2026-11-17  6:01 Sergey Matsievskiy
  0 siblings, 0 replies; only message in thread
From: Sergey Matsievskiy @ 2026-11-17  6:01 UTC (permalink / raw)
  To: dmaengine; +Cc: lars, vkoul, Frank.Li, linux-kernel, Sergey Matsievskiy

Threaded IRQ handlers run in a less critical context compared to normal
IRQs, so they can perform more complex and time-consuming operations
without causing significant delays in other parts of the kernel.
Additionally, regmap-irqchip requires child devices to handle IRQs in
threaded mode.

In this patch change IRQ to threaded mode for compatibility with
regmap-irqchip.
Switch spin_lock() to spin_lock_irqsave() in IRQ handler as it may be
interrupted in threaded mode. spin_lock_irqsave() prevents recursive
spinlock deadlock.

Signed-off-by: Sergey Matsievskiy <matsievskiysv@gmail.com>
---
 drivers/dma/dma-axi-dmac.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c
index 98aaccd26a26..4a340e382e44 100644
--- a/drivers/dma/dma-axi-dmac.c
+++ b/drivers/dma/dma-axi-dmac.c
@@ -583,6 +583,7 @@ static irqreturn_t axi_dmac_interrupt_handler(int irq, void *devid)
 {
 	struct axi_dmac *dmac = devid;
 	unsigned int pending;
+	unsigned long flags;
 	bool start_next = false;
 
 	pending = axi_dmac_read(dmac, AXI_DMAC_REG_IRQ_PENDING);
@@ -591,7 +592,7 @@ static irqreturn_t axi_dmac_interrupt_handler(int irq, void *devid)
 
 	axi_dmac_write(dmac, AXI_DMAC_REG_IRQ_PENDING, pending);
 
-	spin_lock(&dmac->chan.vchan.lock);
+	spin_lock_irqsave(&dmac->chan.vchan.lock, flags);
 	/* One or more transfers have finished */
 	if (pending & AXI_DMAC_IRQ_EOT) {
 		unsigned int completed;
@@ -602,7 +603,7 @@ static irqreturn_t axi_dmac_interrupt_handler(int irq, void *devid)
 	/* Space has become available in the descriptor queue */
 	if ((pending & AXI_DMAC_IRQ_SOT) || start_next)
 		axi_dmac_start_transfer(&dmac->chan);
-	spin_unlock(&dmac->chan.vchan.lock);
+	spin_unlock_irqrestore(&dmac->chan.vchan.lock, flags);
 
 	return IRQ_HANDLED;
 }
@@ -1324,8 +1325,10 @@ static int axi_dmac_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	ret = devm_request_irq(&pdev->dev, dmac->irq, axi_dmac_interrupt_handler,
-			       IRQF_SHARED, dev_name(&pdev->dev), dmac);
+	ret = devm_request_threaded_irq(&pdev->dev, dmac->irq, NULL,
+					axi_dmac_interrupt_handler,
+					IRQF_SHARED | IRQF_ONESHOT,
+					dev_name(&pdev->dev), dmac);
 	if (ret)
 		return ret;
 
-- 
2.47.3


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-17  6:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-17  6:01 [PATCH] dmaengine: axi-dmac: change IRQ to threaded mode Sergey Matsievskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®