mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] dmaengine: fsl-edma: fix channel parameter config for fixed channel requests
@ 2025-09-17  9:53 Joy Zou
  2025-09-17 14:42 ` Frank Li
  2026-02-25 11:20 ` Vinod Koul
  0 siblings, 2 replies; 3+ messages in thread
From: Joy Zou @ 2025-09-17  9:53 UTC (permalink / raw)
  To: Frank Li, Vinod Koul; +Cc: imx, dmaengine, linux-kernel, Joy Zou, stable

Configure only the requested channel when a fixed channel is specified
to avoid modifying other channels unintentionally.

Fix parameter configuration when a fixed DMA channel is requested on
i.MX9 AON domain and i.MX8QM/QXP/DXL platforms. When a client requests
a fixed channel (e.g., channel 6), the driver traverses channels 0-5
and may unintentionally modify their configuration if they are unused.

This leads to issues such as setting the `is_multi_fifo` flag unexpectedly,
causing memcpy tests to fail when using the dmatest tool.

Only affect edma memcpy test when the channel is fixed.

Fixes: 72f5801a4e2b ("dmaengine: fsl-edma: integrate v3 support")
Signed-off-by: Joy Zou <joy.zou@nxp.com>
Cc: stable@vger.kernel.org
---
 drivers/dma/fsl-edma-main.c | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
index 97583c7d51a2e8e7a50c7eb4f5ff0582ac95798d..f0c1a2a3fd26e663b3f0b918ff979a68af510fbf 100644
--- a/drivers/dma/fsl-edma-main.c
+++ b/drivers/dma/fsl-edma-main.c
@@ -317,10 +317,8 @@ static struct dma_chan *fsl_edma3_xlate(struct of_phandle_args *dma_spec,
 			return NULL;
 		i = fsl_chan - fsl_edma->chans;
 
-		fsl_chan->priority = dma_spec->args[1];
-		fsl_chan->is_rxchan = dma_spec->args[2] & FSL_EDMA_RX;
-		fsl_chan->is_remote = dma_spec->args[2] & FSL_EDMA_REMOTE;
-		fsl_chan->is_multi_fifo = dma_spec->args[2] & FSL_EDMA_MULTI_FIFO;
+		if (!b_chmux && i != dma_spec->args[0])
+			continue;
 
 		if ((dma_spec->args[2] & FSL_EDMA_EVEN_CH) && (i & 0x1))
 			continue;
@@ -328,17 +326,15 @@ static struct dma_chan *fsl_edma3_xlate(struct of_phandle_args *dma_spec,
 		if ((dma_spec->args[2] & FSL_EDMA_ODD_CH) && !(i & 0x1))
 			continue;
 
-		if (!b_chmux && i == dma_spec->args[0]) {
-			chan = dma_get_slave_channel(chan);
-			chan->device->privatecnt++;
-			return chan;
-		} else if (b_chmux && !fsl_chan->srcid) {
-			/* if controller support channel mux, choose a free channel */
-			chan = dma_get_slave_channel(chan);
-			chan->device->privatecnt++;
-			fsl_chan->srcid = dma_spec->args[0];
-			return chan;
-		}
+		fsl_chan->srcid = dma_spec->args[0];
+		fsl_chan->priority = dma_spec->args[1];
+		fsl_chan->is_rxchan = dma_spec->args[2] & FSL_EDMA_RX;
+		fsl_chan->is_remote = dma_spec->args[2] & FSL_EDMA_REMOTE;
+		fsl_chan->is_multi_fifo = dma_spec->args[2] & FSL_EDMA_MULTI_FIFO;
+
+		chan = dma_get_slave_channel(chan);
+		chan->device->privatecnt++;
+		return chan;
 	}
 	return NULL;
 }

---
base-commit: 05af764719214d6568adb55c8749dec295228da8
change-id: 20250917-b4-edma-chanconf-da616503f29f

Best regards,
-- 
Joy Zou <joy.zou@nxp.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dmaengine: fsl-edma: fix channel parameter config for fixed channel requests
  2025-09-17  9:53 [PATCH] dmaengine: fsl-edma: fix channel parameter config for fixed channel requests Joy Zou
@ 2025-09-17 14:42 ` Frank Li
  2026-02-25 11:20 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Frank Li @ 2025-09-17 14:42 UTC (permalink / raw)
  To: Joy Zou; +Cc: Vinod Koul, imx, dmaengine, linux-kernel, stable

On Wed, Sep 17, 2025 at 05:53:42PM +0800, Joy Zou wrote:
> Configure only the requested channel when a fixed channel is specified
> to avoid modifying other channels unintentionally.
>
> Fix parameter configuration when a fixed DMA channel is requested on
> i.MX9 AON domain and i.MX8QM/QXP/DXL platforms. When a client requests
> a fixed channel (e.g., channel 6), the driver traverses channels 0-5
> and may unintentionally modify their configuration if they are unused.
>
> This leads to issues such as setting the `is_multi_fifo` flag unexpectedly,
> causing memcpy tests to fail when using the dmatest tool.
>
> Only affect edma memcpy test when the channel is fixed.
>
> Fixes: 72f5801a4e2b ("dmaengine: fsl-edma: integrate v3 support")
> Signed-off-by: Joy Zou <joy.zou@nxp.com>
> Cc: stable@vger.kernel.org

Reviewed-by: Frank Li <Frank.Li@nxp.com>

> ---
>  drivers/dma/fsl-edma-main.c | 26 +++++++++++---------------
>  1 file changed, 11 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
> index 97583c7d51a2e8e7a50c7eb4f5ff0582ac95798d..f0c1a2a3fd26e663b3f0b918ff979a68af510fbf 100644
> --- a/drivers/dma/fsl-edma-main.c
> +++ b/drivers/dma/fsl-edma-main.c
> @@ -317,10 +317,8 @@ static struct dma_chan *fsl_edma3_xlate(struct of_phandle_args *dma_spec,
>  			return NULL;
>  		i = fsl_chan - fsl_edma->chans;
>
> -		fsl_chan->priority = dma_spec->args[1];
> -		fsl_chan->is_rxchan = dma_spec->args[2] & FSL_EDMA_RX;
> -		fsl_chan->is_remote = dma_spec->args[2] & FSL_EDMA_REMOTE;
> -		fsl_chan->is_multi_fifo = dma_spec->args[2] & FSL_EDMA_MULTI_FIFO;
> +		if (!b_chmux && i != dma_spec->args[0])
> +			continue;
>
>  		if ((dma_spec->args[2] & FSL_EDMA_EVEN_CH) && (i & 0x1))
>  			continue;
> @@ -328,17 +326,15 @@ static struct dma_chan *fsl_edma3_xlate(struct of_phandle_args *dma_spec,
>  		if ((dma_spec->args[2] & FSL_EDMA_ODD_CH) && !(i & 0x1))
>  			continue;
>
> -		if (!b_chmux && i == dma_spec->args[0]) {
> -			chan = dma_get_slave_channel(chan);
> -			chan->device->privatecnt++;
> -			return chan;
> -		} else if (b_chmux && !fsl_chan->srcid) {
> -			/* if controller support channel mux, choose a free channel */
> -			chan = dma_get_slave_channel(chan);
> -			chan->device->privatecnt++;
> -			fsl_chan->srcid = dma_spec->args[0];
> -			return chan;
> -		}
> +		fsl_chan->srcid = dma_spec->args[0];
> +		fsl_chan->priority = dma_spec->args[1];
> +		fsl_chan->is_rxchan = dma_spec->args[2] & FSL_EDMA_RX;
> +		fsl_chan->is_remote = dma_spec->args[2] & FSL_EDMA_REMOTE;
> +		fsl_chan->is_multi_fifo = dma_spec->args[2] & FSL_EDMA_MULTI_FIFO;
> +
> +		chan = dma_get_slave_channel(chan);
> +		chan->device->privatecnt++;
> +		return chan;
>  	}
>  	return NULL;
>  }
>
> ---
> base-commit: 05af764719214d6568adb55c8749dec295228da8
> change-id: 20250917-b4-edma-chanconf-da616503f29f
>
> Best regards,
> --
> Joy Zou <joy.zou@nxp.com>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dmaengine: fsl-edma: fix channel parameter config for fixed channel requests
  2025-09-17  9:53 [PATCH] dmaengine: fsl-edma: fix channel parameter config for fixed channel requests Joy Zou
  2025-09-17 14:42 ` Frank Li
@ 2026-02-25 11:20 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2026-02-25 11:20 UTC (permalink / raw)
  To: Frank Li, Joy Zou; +Cc: imx, dmaengine, linux-kernel, stable


On Wed, 17 Sep 2025 17:53:42 +0800, Joy Zou wrote:
> Configure only the requested channel when a fixed channel is specified
> to avoid modifying other channels unintentionally.
> 
> Fix parameter configuration when a fixed DMA channel is requested on
> i.MX9 AON domain and i.MX8QM/QXP/DXL platforms. When a client requests
> a fixed channel (e.g., channel 6), the driver traverses channels 0-5
> and may unintentionally modify their configuration if they are unused.
> 
> [...]

Applied, thanks!

[1/1] dmaengine: fsl-edma: fix channel parameter config for fixed channel requests
      commit: 2e7b5cf72e51c9cf9c8b75190189c757df31ddd9

Best regards,
-- 
~Vinod



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-02-25 11:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-17  9:53 [PATCH] dmaengine: fsl-edma: fix channel parameter config for fixed channel requests Joy Zou
2025-09-17 14:42 ` Frank Li
2026-02-25 11:20 ` Vinod Koul

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®