mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] dmaengine: fsl-dpaa2-qdma: Fix the size of dma pools
@ 2024-01-18 16:29 Frank Li
  2024-01-22 16:25 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Frank Li @ 2024-01-18 16:29 UTC (permalink / raw)
  To: Vinod Koul, Uwe Kleine-König, Guanhua Gao, Laurentiu Tudor,
	Ioana Ciornei, Li Zetao, Peng Ma,
	open list:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM, open list
  Cc: imx

From: Guanhua Gao <guanhua.gao@nxp.com>

In case of long format of qDMA command descriptor, there are one frame
descriptor, three entries in the frame list and two data entries. So the
size of dma_pool_create for these three fields should be the same with
the total size of entries respectively, or the contents may be overwritten
by the next allocated descriptor.

Fixes: 7fdf9b05c73b ("dmaengine: fsl-dpaa2-qdma: Add NXP dpaa2 qDMA controller driver for Layerscape SoCs")
Signed-off-by: Guanhua Gao <guanhua.gao@nxp.com>
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
 drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c b/drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c
index 7958ac33e36ce..5a8061a307cda 100644
--- a/drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c
+++ b/drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c
@@ -38,15 +38,17 @@ static int dpaa2_qdma_alloc_chan_resources(struct dma_chan *chan)
 	if (!dpaa2_chan->fd_pool)
 		goto err;
 
-	dpaa2_chan->fl_pool = dma_pool_create("fl_pool", dev,
-					      sizeof(struct dpaa2_fl_entry),
-					      sizeof(struct dpaa2_fl_entry), 0);
+	dpaa2_chan->fl_pool =
+		dma_pool_create("fl_pool", dev,
+				 sizeof(struct dpaa2_fl_entry) * 3,
+				 sizeof(struct dpaa2_fl_entry), 0);
+
 	if (!dpaa2_chan->fl_pool)
 		goto err_fd;
 
 	dpaa2_chan->sdd_pool =
 		dma_pool_create("sdd_pool", dev,
-				sizeof(struct dpaa2_qdma_sd_d),
+				sizeof(struct dpaa2_qdma_sd_d) * 2,
 				sizeof(struct dpaa2_qdma_sd_d), 0);
 	if (!dpaa2_chan->sdd_pool)
 		goto err_fl;
-- 
2.34.1


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

* Re: [PATCH 1/1] dmaengine: fsl-dpaa2-qdma: Fix the size of dma pools
  2024-01-18 16:29 [PATCH 1/1] dmaengine: fsl-dpaa2-qdma: Fix the size of dma pools Frank Li
@ 2024-01-22 16:25 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2024-01-22 16:25 UTC (permalink / raw)
  To: Uwe Kleine-König, Guanhua Gao, Laurentiu Tudor,
	Ioana Ciornei, Li Zetao, Peng Ma, dmaengine, linux-kernel,
	Frank Li
  Cc: imx


On Thu, 18 Jan 2024 11:29:16 -0500, Frank Li wrote:
> In case of long format of qDMA command descriptor, there are one frame
> descriptor, three entries in the frame list and two data entries. So the
> size of dma_pool_create for these three fields should be the same with
> the total size of entries respectively, or the contents may be overwritten
> by the next allocated descriptor.
> 
> 
> [...]

Applied, thanks!

[1/1] dmaengine: fsl-dpaa2-qdma: Fix the size of dma pools
      commit: b73e43dcd7a8be26880ef8ff336053b29e79dbc5

Best regards,
-- 
~Vinod



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

end of thread, other threads:[~2024-01-22 16:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-18 16:29 [PATCH 1/1] dmaengine: fsl-dpaa2-qdma: Fix the size of dma pools Frank Li
2024-01-22 16:25 ` 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®