All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dmaengine: cv1800b-dmamux: fix channel allocation order
@ 2025-12-10 19:30 Anton D. Stavinskii
  2025-12-12  2:12 ` Inochi Amaoto
  0 siblings, 1 reply; 2+ messages in thread
From: Anton D. Stavinskii @ 2025-12-10 19:30 UTC (permalink / raw)
  To: Vinod Koul; +Cc: dmaengine, linux-kernel, inochiama, Anton D. Stavinskii

The dmamux builds the free_maps list using llist_add(), which inserts
new nodes at the head. Using increasing channel indices causes the
first allocation to use DMA channel 7 while the DMA engine hands out
channel 0, leading to mismatched routing.

Reverse the channel index order so the first allocation gets channel 0.

Fixes: db7d07b5add4d ("dmaengine: add driver for Sophgo CV18XX/SG200X dmamux")
Signed-off-by: Anton D. Stavinskii <stavinsky@gmail.com>
---
 drivers/dma/cv1800b-dmamux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/cv1800b-dmamux.c b/drivers/dma/cv1800b-dmamux.c
index e900d6595617..825e1614051d 100644
--- a/drivers/dma/cv1800b-dmamux.c
+++ b/drivers/dma/cv1800b-dmamux.c
@@ -214,7 +214,7 @@ static int cv1800_dmamux_probe(struct platform_device *pdev)
 		}
 
 		init_llist_node(&tmp->node);
-		tmp->channel = i;
+		tmp->channel = MAX_DMA_CH_ID - i;
 		llist_add(&tmp->node, &data->free_maps);
 	}
 
-- 
2.43.0


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

* Re: [PATCH] dmaengine: cv1800b-dmamux: fix channel allocation order
  2025-12-10 19:30 [PATCH] dmaengine: cv1800b-dmamux: fix channel allocation order Anton D. Stavinskii
@ 2025-12-12  2:12 ` Inochi Amaoto
  0 siblings, 0 replies; 2+ messages in thread
From: Inochi Amaoto @ 2025-12-12  2:12 UTC (permalink / raw)
  To: Anton D. Stavinskii; +Cc: Vinod Koul, dmaengine, linux-kernel, inochiama

On Wed, Dec 10, 2025 at 11:30:12PM +0400, Anton D. Stavinskii wrote:
> The dmamux builds the free_maps list using llist_add(), which inserts
> new nodes at the head. Using increasing channel indices causes the
> first allocation to use DMA channel 7 while the DMA engine hands out
> channel 0, leading to mismatched routing.
> 
> Reverse the channel index order so the first allocation gets channel 0.
> 
> Fixes: db7d07b5add4d ("dmaengine: add driver for Sophgo CV18XX/SG200X dmamux")
> Signed-off-by: Anton D. Stavinskii <stavinsky@gmail.com>
> ---
>  drivers/dma/cv1800b-dmamux.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/cv1800b-dmamux.c b/drivers/dma/cv1800b-dmamux.c
> index e900d6595617..825e1614051d 100644
> --- a/drivers/dma/cv1800b-dmamux.c
> +++ b/drivers/dma/cv1800b-dmamux.c
> @@ -214,7 +214,7 @@ static int cv1800_dmamux_probe(struct platform_device *pdev)
>  		}
>  
>  		init_llist_node(&tmp->node);
> -		tmp->channel = i;
> +		tmp->channel = MAX_DMA_CH_ID - i;
>  		llist_add(&tmp->node, &data->free_maps);
>  	}
>  
> -- 
> 2.43.0
> 

The problem is caused by the dw-axi-dmac driver, which allocate
channel dynamically. And the dma multiplexer can only routes
the interrupt statically, so it has the wrong information about
the channel enabled.

This patch does not fix the problem actually, I have sent a new
patch for it.

https://lore.kernel.org/all/20251212020504.915616-1-inochiama@gmail.com/

Regards,
Inochi

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

end of thread, other threads:[~2025-12-12  2:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-10 19:30 [PATCH] dmaengine: cv1800b-dmamux: fix channel allocation order Anton D. Stavinskii
2025-12-12  2:12 ` Inochi Amaoto

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.