linux-fpga.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fpga: zynq-fpga: use sgtable-based scatterlist wrappers
       [not found] <CGME20250527093152eucas1p24a904b0d973252ebc0d05034a276e9cf@eucas1p2.samsung.com>
@ 2025-05-27  9:31 ` Marek Szyprowski
  2025-05-27 12:11   ` Jason Gunthorpe
  0 siblings, 1 reply; 4+ messages in thread
From: Marek Szyprowski @ 2025-05-27  9:31 UTC (permalink / raw)
  To: linux-fpga
  Cc: Marek Szyprowski, Moritz Fischer, Wu Hao, Xu Yilun, Tom Rix,
	Michal Simek, Jason Gunthorpe, stable

Use common wrappers operating directly on the struct sg_table objects to
fix incorrect use of statterlists related calls. dma_unmap_sg() function
has to be called with the number of elements originally passed to the
dma_map_sg() function, not the one returned in sgtable's nents.

CC: stable@vger.kernel.org
Fixes: 425902f5c8e3 ("fpga zynq: Use the scatterlist interface")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/fpga/zynq-fpga.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/fpga/zynq-fpga.c b/drivers/fpga/zynq-fpga.c
index f7e08f7ea9ef..9bd39d1d4048 100644
--- a/drivers/fpga/zynq-fpga.c
+++ b/drivers/fpga/zynq-fpga.c
@@ -406,7 +406,7 @@ static int zynq_fpga_ops_write(struct fpga_manager *mgr, struct sg_table *sgt)
 	}
 
 	priv->dma_nelms =
-	    dma_map_sg(mgr->dev.parent, sgt->sgl, sgt->nents, DMA_TO_DEVICE);
+	    dma_map_sgtable(mgr->dev.parent, sgt, DMA_TO_DEVICE);
 	if (priv->dma_nelms == 0) {
 		dev_err(&mgr->dev, "Unable to DMA map (TO_DEVICE)\n");
 		return -ENOMEM;
@@ -478,7 +478,7 @@ static int zynq_fpga_ops_write(struct fpga_manager *mgr, struct sg_table *sgt)
 	clk_disable(priv->clk);
 
 out_free:
-	dma_unmap_sg(mgr->dev.parent, sgt->sgl, sgt->nents, DMA_TO_DEVICE);
+	dma_unmap_sgtable(mgr->dev.parent, sgt, DMA_TO_DEVICE);
 	return err;
 }
 
-- 
2.34.1


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

* Re: [PATCH] fpga: zynq-fpga: use sgtable-based scatterlist wrappers
  2025-05-27  9:31 ` [PATCH] fpga: zynq-fpga: use sgtable-based scatterlist wrappers Marek Szyprowski
@ 2025-05-27 12:11   ` Jason Gunthorpe
  2025-06-13  9:22     ` Xu Yilun
  0 siblings, 1 reply; 4+ messages in thread
From: Jason Gunthorpe @ 2025-05-27 12:11 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: linux-fpga, Moritz Fischer, Wu Hao, Xu Yilun, Tom Rix,
	Michal Simek, stable

On Tue, May 27, 2025 at 11:31:37AM +0200, Marek Szyprowski wrote:
> Use common wrappers operating directly on the struct sg_table objects to
> fix incorrect use of statterlists related calls. dma_unmap_sg() function
> has to be called with the number of elements originally passed to the
> dma_map_sg() function, not the one returned in sgtable's nents.
> 
> CC: stable@vger.kernel.org
> Fixes: 425902f5c8e3 ("fpga zynq: Use the scatterlist interface")
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  drivers/fpga/zynq-fpga.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

Jason

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

* Re: [PATCH] fpga: zynq-fpga: use sgtable-based scatterlist wrappers
  2025-05-27 12:11   ` Jason Gunthorpe
@ 2025-06-13  9:22     ` Xu Yilun
  2025-06-16  8:09       ` Xu Yilun
  0 siblings, 1 reply; 4+ messages in thread
From: Xu Yilun @ 2025-06-13  9:22 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Marek Szyprowski, linux-fpga, Moritz Fischer, Wu Hao, Xu Yilun,
	Tom Rix, Michal Simek, stable

On Tue, May 27, 2025 at 09:11:28AM -0300, Jason Gunthorpe wrote:
> On Tue, May 27, 2025 at 11:31:37AM +0200, Marek Szyprowski wrote:
> > Use common wrappers operating directly on the struct sg_table objects to
> > fix incorrect use of statterlists related calls. dma_unmap_sg() function
> > has to be called with the number of elements originally passed to the
> > dma_map_sg() function, not the one returned in sgtable's nents.
> > 
> > CC: stable@vger.kernel.org
> > Fixes: 425902f5c8e3 ("fpga zynq: Use the scatterlist interface")
> > Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> > ---
> >  drivers/fpga/zynq-fpga.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

Reviewed-by: Xu Yilun <yilun.xu@intel.com>

Applied to for-next.

> 
> Jason
> 

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

* Re: [PATCH] fpga: zynq-fpga: use sgtable-based scatterlist wrappers
  2025-06-13  9:22     ` Xu Yilun
@ 2025-06-16  8:09       ` Xu Yilun
  0 siblings, 0 replies; 4+ messages in thread
From: Xu Yilun @ 2025-06-16  8:09 UTC (permalink / raw)
  To: Jason Gunthorpe, m.szyprowski
  Cc: Marek Szyprowski, linux-fpga, Moritz Fischer, Wu Hao, Xu Yilun,
	Tom Rix, Michal Simek, stable

On Fri, Jun 13, 2025 at 05:22:42PM +0800, Xu Yilun wrote:
> On Tue, May 27, 2025 at 09:11:28AM -0300, Jason Gunthorpe wrote:
> > On Tue, May 27, 2025 at 11:31:37AM +0200, Marek Szyprowski wrote:
> > > Use common wrappers operating directly on the struct sg_table objects to
> > > fix incorrect use of statterlists related calls. dma_unmap_sg() function
> > > has to be called with the number of elements originally passed to the
> > > dma_map_sg() function, not the one returned in sgtable's nents.
> > > 
> > > CC: stable@vger.kernel.org
> > > Fixes: 425902f5c8e3 ("fpga zynq: Use the scatterlist interface")
> > > Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> > > ---
> > >  drivers/fpga/zynq-fpga.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
> 
> Reviewed-by: Xu Yilun <yilun.xu@intel.com>
> 
> Applied to for-next.

Hello, Marek:

I've removed the patch from for-next. Please fix the issue.

https://lore.kernel.org/all/20250616141151.64eb59e0@canb.auug.org.au/

Thanks,
Yilun


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

end of thread, other threads:[~2025-06-16  8:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20250527093152eucas1p24a904b0d973252ebc0d05034a276e9cf@eucas1p2.samsung.com>
2025-05-27  9:31 ` [PATCH] fpga: zynq-fpga: use sgtable-based scatterlist wrappers Marek Szyprowski
2025-05-27 12:11   ` Jason Gunthorpe
2025-06-13  9:22     ` Xu Yilun
2025-06-16  8:09       ` Xu Yilun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).