Skip to contentSkip to conversation

dmaengine: arm-dma350: handle shared channel IRQ wiring on sky1

PATCH Applied Jun Guo 5 participants 8 messages May 21 – Jul 20

Subsystems (4)
lore
Share & tools
lore

Jun Guo

author
#0 lore raw

v7 cover dmaengine: arm-dma350: handle shared channel IRQ wiring on sky1

This series updates DMA-350 support for the SKY1 integration where all DMA
channel interrupt outputs are wired to the same GIC SPI.

Patch 1 enables DMANSECCTRL.INTREN_ANYCHINTR in the driver so per-channel
interrupt status is propagated even when channels share one parent IRQ line.

Patch 2 adds the SKY1 DMA-350 DT node and describes the channel interrupt
sources using 8 channel entries, while all entries map to the same SPI.

Tested on CIX SKY1 with dmatest:
% echo 2000 > /sys/module/dmatest/parameters/timeout % echo 1 > /sys/module/dmatest/parameters/iterations % echo "" > /sys/module/dmatest/parameters/channel % echo 1 > /sys/module/dmatest/parameters/run

Changes in v7:
- Modify the commit log format for the driver patch.

Changes in v6:
- Drop the dt-binding update and keep the existing 8-channel interrupt schema.
- Simplify driver change to a minimal fix:
enable DMANSECCTRL.INTREN_ANYCHINTR.
- Update SKY1 DT node to describe 8 channel interrupt entries mapped to one SPI.

Changes in v5:
- Fix the formatting issue in the AI tag.
- Remove the unnecessary "cix,sky1-dma-350".

Changes in v4:
- Reword binding text to align with kernel style.
- Revise the AI attribution to the standard format.
- Remove redundant links from the commit log.

Changes in v3:
- Rework binding compatible description to match generic-first model.
- Keep interrupts schema support for both 1-IRQ and 8-IRQ topologies.
- Drop SoC match-data dependency for IRQ mode selection.
- Detect IRQ topology via platform_irq_count() in probe path.
- Refactor IRQ handling into a shared channel handler.
- Enable DMANSECCTRL.INTREN_ANYCHINTR only in combined IRQ mode.

Changes in v2:
- Update to kernel standards, enhance patch description, and refactor driver to use match data for hardware differentiation instead of compatible strings.

Jun Guo (2):
dmaengine: arm-dma350: enable ANYCH interrupt for shared IRQ wiring
arm64: dts: cix: add sky1 DMA-350 node with channel IRQ entries

 arch/arm64/boot/dts/cix/sky1.dtsi | 14 ++++++++++++++
 drivers/dma/arm-dma350.c          |  9 +++++++++
 2 files changed, 23 insertions(+)
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v7 1/2 dmaengine: arm-dma350: enable ANYCH interrupt for shared IRQ wiring

Enable DMANSECCTRL.INTREN_ANYCHINTR during probe so channel interrupts are propagated when integrators wire DMA-350 channels onto a shared IRQ line.

---
 drivers/dma/arm-dma350.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/dma/arm-dma350.c +9 -0
index 84220fa83029..09403aca8bb0 100644
@@ -13,6 +13,11 @@
 #include "dmaengine.h"
 #include "virt-dma.h"
 
+#define DMANSECCTRL		0x200
+
+#define NSEC_CTRL		0x0c
+#define INTREN_ANYCHINTR_EN	BIT(0)
+
 #define DMAINFO			0x0f00
 
 #define DMA_BUILDCFG0		0xb0
@@ -582,6 +587,10 @@ static int d350_probe(struct platform_device *pdev)
 	dmac->dma.device_issue_pending = d350_issue_pending;
 	INIT_LIST_HEAD(&dmac->dma.channels);
 
+	reg = readl_relaxed(base + DMANSECCTRL + NSEC_CTRL);
+	writel_relaxed(reg | INTREN_ANYCHINTR_EN,
+		       base + DMANSECCTRL + NSEC_CTRL);
+
 	/* Would be nice to have per-channel caps for this... */
 	memset = true;
 	for (int i = 0; i < nchan; i++) {
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v7 1/2] dmaengine: arm-dma350: enable ANYCH interrupt for shared IRQ wiring

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] Enabling the global ANYCH interrupt before clearing channel states and handling error paths can…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Enabling the global ANYCH interrupt before clearing channel states and handling error paths can cause spurious interrupt storms and break shared IRQ lines. --

commit 0bf9d17ebbd8be17166134ed8865c553f2b5eec7
Author: Jun Guo <[email protected]>

dmaengine: arm-dma350: enable ANYCH interrupt for shared IRQ wiring

This commit enables DMANSECCTRL.INTREN_ANYCHINTR during probe so that channel interrupts are propagated when integrators wire DMA-350 channels onto a shared IRQ line.

Quoted 4 lines
drivers/dma/arm-dma350.c +0 -0
index 84220fa83029d..09403aca8bb06 100644

[ ... ]

drivers/dma/arm-dma350.c static int d350_probe(struct platform_device *pdev) · line 593

Quoted 8 lines
drivers/dma/arm-dma350.c +4 -0
@@ -582,6 +587,10 @@ static int d350_probe(struct platform_device *pdev)
 	dmac->dma.device_issue_pending = d350_issue_pending;
 	INIT_LIST_HEAD(&dmac->dma.channels);
 
+	reg = readl_relaxed(base + DMANSECCTRL + NSEC_CTRL);
+	writel_relaxed(reg | INTREN_ANYCHINTR_EN,
+		       base + DMANSECCTRL + NSEC_CTRL);
+

[Severity: High]
Will enabling INTREN_ANYCHINTR_EN here, before clearing the individual channel states, potentially cause an interrupt storm on shared IRQ lines?

If a bootloader left a channel with a pending interrupt, this will immediately assert the shared interrupt line before the DMA driver has registered its IRQ handler or cleared the channel state in the loop below.

Additionally, if the probe fails midway (for instance, if platform_get_irq returns an error for a channel):

drivers/dma/arm-dma350.c:d350_probe() {
        ...
        dch->irq = platform_get_irq(pdev, i);
        if (dch->irq < 0)
            return dev_err_probe(dev, dch->irq, ...);
}

Does this error path leave the global ANYCH interrupt enabled without sending CH_CMD_CLEAR to the remaining channels? Any uncleared pending interrupt on those remaining channels could permanently assert the shared IRQ line, eventually causing the kernel to disable the shared IRQ entirely.

Quoted 3 lines
drivers/dma/arm-dma350.c +0 -0
 	/* Would be nice to have per-channel caps for this... */
 	memset = true;
 	for (int i = 0; i < nchan; i++) {
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Reviewed-by on v7 1/2
#3 lore raw

Re: [PATCH v7 1/2] dmaengine: arm-dma350: enable ANYCH interrupt for shared IRQ wiring

In reply to Jun Guo
Quoted 3 lines · Jun Guo

Enable DMANSECCTRL.INTREN_ANYCHINTR during probe so channel interrupts are propagated when integrators wire DMA-350 channels onto a shared IRQ line.

Quoted 32 lines
---
  drivers/dma/arm-dma350.c | 9 +++++++++
  1 file changed, 9 insertions(+)
drivers/dma/arm-dma350.c +9 -0
index 84220fa83029..09403aca8bb0 100644
@@ -13,6 +13,11 @@
  #include "dmaengine.h"
  #include "virt-dma.h"
 
+#define DMANSECCTRL		0x200
+
+#define NSEC_CTRL		0x0c
+#define INTREN_ANYCHINTR_EN	BIT(0)
+
  #define DMAINFO			0x0f00
 
  #define DMA_BUILDCFG0		0xb0
@@ -582,6 +587,10 @@ static int d350_probe(struct platform_device *pdev)
  	dmac->dma.device_issue_pending = d350_issue_pending;
  	INIT_LIST_HEAD(&dmac->dma.channels);
 
+	reg = readl_relaxed(base + DMANSECCTRL + NSEC_CTRL);
+	writel_relaxed(reg | INTREN_ANYCHINTR_EN,
+		       base + DMANSECCTRL + NSEC_CTRL);
+
  	/* Would be nice to have per-channel caps for this... */
  	memset = true;
  	for (int i = 0; i < nchan; i++) {
author
#4 lore raw

PATCH v7 2/2 arm64: dts: cix: add sky1 DMA-350 node with channel IRQ entries

In reply to Jun Guo

Describe the DMA-350 channel interrupt sources in DT using 8 interrupt entries, while all entries map to the same GIC SPI as wired on this platform.

---
 arch/arm64/boot/dts/cix/sky1.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm64/boot/dts/cix/sky1.dtsi +14 -0
index bb5cfb1f2113..823adeef51f1 100644
@@ -444,6 +444,20 @@ iomuxc: pinctrl@4170000 {
 			reg = <0x0 0x04170000 0x0 0x1000>;
 		};
 
+		fch_dmac: dma-controller@4190000 {
+			compatible = "arm,dma-350";
+			reg = <0x0 0x4190000 0x0 0x10000>;
+			interrupts = <GIC_SPI 303 IRQ_TYPE_LEVEL_HIGH 0>,
+				     <GIC_SPI 303 IRQ_TYPE_LEVEL_HIGH 0>,
+				     <GIC_SPI 303 IRQ_TYPE_LEVEL_HIGH 0>,
+				     <GIC_SPI 303 IRQ_TYPE_LEVEL_HIGH 0>,
+				     <GIC_SPI 303 IRQ_TYPE_LEVEL_HIGH 0>,
+				     <GIC_SPI 303 IRQ_TYPE_LEVEL_HIGH 0>,
+				     <GIC_SPI 303 IRQ_TYPE_LEVEL_HIGH 0>,
+				     <GIC_SPI 303 IRQ_TYPE_LEVEL_HIGH 0>;
+			#dma-cells = <1>;
+		};
+
 		mbox_ap2se: mailbox@5060000 {
 			compatible = "cix,sky1-mbox";
 			reg = <0x0 0x05060000 0x0 0x10000>;
Signature · 1 line
2.34.1
maintainer Applied
#5 lore raw

Re: [PATCH v7 2/2] arm64: dts: cix: add sky1 DMA-350 node with channel IRQ entries

Quoted 5 lines · Jun Guo

Describe the DMA-350 channel interrupt sources in DT using 8 interrupt entries, while all entries map to the same GIC SPI as wired on this platform.

Applied, thanks!

Gary

Quoted 32 lines
---
 arch/arm64/boot/dts/cix/sky1.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm64/boot/dts/cix/sky1.dtsi +14 -0
index bb5cfb1f2113..823adeef51f1 100644
@@ -444,6 +444,20 @@ iomuxc: pinctrl@4170000 {
 			reg = <0x0 0x04170000 0x0 0x1000>;
 		};
 
+		fch_dmac: dma-controller@4190000 {
+			compatible = "arm,dma-350";
+			reg = <0x0 0x4190000 0x0 0x10000>;
+			interrupts = <GIC_SPI 303 IRQ_TYPE_LEVEL_HIGH 0>,
+				     <GIC_SPI 303 IRQ_TYPE_LEVEL_HIGH 0>,
+				     <GIC_SPI 303 IRQ_TYPE_LEVEL_HIGH 0>,
+				     <GIC_SPI 303 IRQ_TYPE_LEVEL_HIGH 0>,
+				     <GIC_SPI 303 IRQ_TYPE_LEVEL_HIGH 0>,
+				     <GIC_SPI 303 IRQ_TYPE_LEVEL_HIGH 0>,
+				     <GIC_SPI 303 IRQ_TYPE_LEVEL_HIGH 0>,
+				     <GIC_SPI 303 IRQ_TYPE_LEVEL_HIGH 0>;
+			#dma-cells = <1>;
+		};
+
 		mbox_ap2se: mailbox@5060000 {
 			compatible = "cix,sky1-mbox";
 			reg = <0x0 0x05060000 0x0 0x10000>;
Signature · 1 line
2.34.1
author
#6 lore raw
In reply to Jun Guo

Hi all,

Gentle ping on this patch series.

I understand everyone is busy, but would appreciate any feedback or review comments when you have a moment.

Quoted 60 lines · Jun Guo

This series updates DMA-350 support for the SKY1 integration where all DMA
channel interrupt outputs are wired to the same GIC SPI.

Patch 1 enables DMANSECCTRL.INTREN_ANYCHINTR in the driver so per-channel
interrupt status is propagated even when channels share one parent IRQ line.

Patch 2 adds the SKY1 DMA-350 DT node and describes the channel interrupt
sources using 8 channel entries, while all entries map to the same SPI.

Tested on CIX SKY1 with dmatest:
% echo 2000 > /sys/module/dmatest/parameters/timeout % echo 1 > /sys/module/dmatest/parameters/iterations % echo "" > /sys/module/dmatest/parameters/channel % echo 1 > /sys/module/dmatest/parameters/run

Changes in v7:
- Modify the commit log format for the driver patch.

Changes in v6:
- Drop the dt-binding update and keep the existing 8-channel interrupt schema.
- Simplify driver change to a minimal fix:
enable DMANSECCTRL.INTREN_ANYCHINTR.
- Update SKY1 DT node to describe 8 channel interrupt entries mapped to one SPI.

Changes in v5:
- Fix the formatting issue in the AI tag.
- Remove the unnecessary "cix,sky1-dma-350".

Changes in v4:
- Reword binding text to align with kernel style.
- Revise the AI attribution to the standard format.
- Remove redundant links from the commit log.

Changes in v3:
- Rework binding compatible description to match generic-first model.
- Keep interrupts schema support for both 1-IRQ and 8-IRQ topologies.
- Drop SoC match-data dependency for IRQ mode selection.
- Detect IRQ topology via platform_irq_count() in probe path.
- Refactor IRQ handling into a shared channel handler.
- Enable DMANSECCTRL.INTREN_ANYCHINTR only in combined IRQ mode.

Changes in v2:
- Update to kernel standards, enhance patch description, and refactor driver to use match data for hardware differentiation instead of compatible strings.

Jun Guo (2):
dmaengine: arm-dma350: enable ANYCH interrupt for shared IRQ wiring
arm64: dts: cix: add sky1 DMA-350 node with channel IRQ entries

  arch/arm64/boot/dts/cix/sky1.dtsi | 14 ++++++++++++++
  drivers/dma/arm-dma350.c          |  9 +++++++++
  2 files changed, 23 insertions(+)
maintainer Applied
#7 lore raw

Re: (subset) [PATCH v7 0/2] dmaengine: arm-dma350: handle shared channel IRQ wiring on sky1

In reply to Jun Guo
Quoted 10 lines · Jun Guo

This series updates DMA-350 support for the SKY1 integration where all DMA
channel interrupt outputs are wired to the same GIC SPI.

Patch 1 enables DMANSECCTRL.INTREN_ANYCHINTR in the driver so per-channel
interrupt status is propagated even when channels share one parent IRQ line.

[...]

Applied, thanks!

[1/2] dmaengine: arm-dma350: enable ANYCH interrupt for shared IRQ wiring

      commit: 643c1e1ae3eb3cd9be31e83c2240e41849a6cb56

Best regards,

Signature · 1 line
~Vinod