Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
To: Frank Li <Frank.Li@nxp.com>, Vinod Koul <vkoul@kernel.org>,
	 Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	 Pengutronix Kernel Team <kernel@pengutronix.de>,
	 Fabio Estevam <festevam@gmail.com>
Cc: Frank Li <Frank.Li@kernel.org>, Joy Zou <joy.zou@nxp.com>,
	 imx@lists.linux.dev, dmaengine@vger.kernel.org,
	devicetree@vger.kernel.org,  linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	 Peng Fan <peng.fan@nxp.com>
Subject: [PATCH v2 0/3] dmaengine: fsl-edma: per-channel IOMMU support via DT child nodes
Date: Wed, 30 Sep 2026 14:26:08 +0800	[thread overview]
Message-ID: <20260930-edma-iommu-v2-0-72a62bf44c74@nxp.com> (raw)

I used iommu-map for eDMA, but iommu experts rejected it:
"Using iommu-map to describe synthetic dma_chan_dev devices that the
kernel creates is the same kind of DT abuse from over here:"
More info: https://lore.kernel.org/all/20260917144804.GI3196566@ziepe.ca/

So I followed here [2] as Krzysztof wrote for QCOM VPU:
"Thanks Jason for context and detailed arguments. Robin did not chime in
yet, but from what I understood the DT-child-node approach will be the
way we should go here.

I accept above point of view and I am fine with this, thus Vishnu and
Vikash - please go ahead with DT-child-node solution we had some time ago."
[2] https://lore.kernel.org/linux-iommu/c7b956a9-d3e8-4e18-b780-5d08f5cd2ca1@kernel.org/

The fsl,edma controller on i.MX95 has per-channel SMMU stream IDs,
where paired TX/RX channels share the same stream ID. The previous
approach used iommu-map at the controller node, but this is
architecturally wrong for platform devices - platform_dma_configure()
passes id=NULL to of_dma_configure_id(), so the iommu-map property is
never consulted by the kernel.

This series adds per-channel child nodes to the eDMA binding and
driver. Each child node (dma-channel@<addr>) describes a real
per-channel MMIO region and can carry its own interrupts, iommus, and
power-domains properties. This approach:

 - Uses the standard iommus property for per-channel stream ID
   assignment, which works through the existing of_dma_configure() ->
   of_iommu_configure() -> iommu_probe_device() path.

 - Provides real MMIO addresses in child reg properties, enabling
   Xen dom0less device passthrough where the hypervisor needs physical
   address information for channel-level granularity.

 - Maintains full backward compatibility - existing DTS without child
   nodes works unchanged.

The driver configures per-channel IOMMU following the same pattern as
tegra186-gpc-dma: set bus type on the dma_chan_dev, coerce the DMA
mask, call of_dma_configure() with the child node, and set
chan_dma_dev=true so dmaengine_get_dma_device() returns the per-channel
device for DMA API calls.

Tested on i.MX95 EVK with SMMUv3 enabled for edma2 channels 2-19
(stream IDs 0x30-0x38, paired). Channels without iommus (used by SPI,
I2C, etc.) continue to work in bypass mode.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
Changes in V2:
- Switch to add child node for dma channel.
- Link to V1: https://lore.kernel.org/dmaengine/20260916-edma-iommu-v1-0-e1731968081e@nxp.com/

---
Peng Fan (3):
      dt-bindings: dma: fsl,edma: add per-channel child node support
      dmaengine: fsl-edma: support per-channel DT child nodes
      arm64: dts: imx95: convert eDMA to per-channel child nodes

 .../devicetree/bindings/dma/fsl,edma.yaml          |  70 +-
 arch/arm64/boot/dts/freescale/imx95.dtsi           | 774 +++++++++++++++++----
 drivers/dma/fsl-edma-common.c                      |  10 +-
 drivers/dma/fsl-edma-main.c                        | 149 +++-
 4 files changed, 864 insertions(+), 139 deletions(-)
---
base-commit: 38cc189d30504989ed32704c9b87992de304d0fc
change-id: 20260926-edma-iommu-f5d0d97295d2

Best regards,
--  
Peng Fan <peng.fan@nxp.com>



             reply	other threads:[~2026-09-30  6:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30  6:26 Peng Fan (OSS) [this message]
2026-09-30  6:26 ` [PATCH v2 1/3] dt-bindings: dma: fsl,edma: add per-channel child node support Peng Fan (OSS)
2026-09-30 16:00   ` Frank Li
2026-09-30  6:26 ` [PATCH v2 2/3] dmaengine: fsl-edma: support per-channel DT child nodes Peng Fan (OSS)
2026-09-30  6:26 ` [PATCH v2 3/3] arm64: dts: imx95: convert eDMA to per-channel " Peng Fan (OSS)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260930-edma-iommu-v2-0-72a62bf44c74@nxp.com \
    --to=peng.fan@oss.nxp.com \
    --cc=Frank.Li@kernel.org \
    --cc=Frank.Li@nxp.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=joy.zou@nxp.com \
    --cc=kernel@pengutronix.de \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox