linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fpga: dfl: afu: Pass the correct device to dma_mapping_error()
@ 2019-04-10 21:53 Scott Wood
  2019-04-11 12:33 ` Wu Hao
  0 siblings, 1 reply; 6+ messages in thread
From: Scott Wood @ 2019-04-10 21:53 UTC (permalink / raw)
  To: Alan Tull, Moritz Fischer; +Cc: linux-fpga, linux-kernel, Wu Hao, Scott Wood

dma_mapping_error() was being called on a different device struct than
what was passed to map/unmap.  Besides rendering the error checking
ineffective, it caused a debug splat with CONFIG_DMA_API_DEBUG.

Signed-off-by: Scott Wood <swood@redhat.com>
---
 drivers/fpga/dfl-afu-dma-region.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/fpga/dfl-afu-dma-region.c b/drivers/fpga/dfl-afu-dma-region.c
index e18a786fc943..cd68002ac097 100644
--- a/drivers/fpga/dfl-afu-dma-region.c
+++ b/drivers/fpga/dfl-afu-dma-region.c
@@ -399,7 +399,7 @@ int afu_dma_map_region(struct dfl_feature_platform_data *pdata,
 				    region->pages[0], 0,
 				    region->length,
 				    DMA_BIDIRECTIONAL);
-	if (dma_mapping_error(&pdata->dev->dev, region->iova)) {
+	if (dma_mapping_error(dfl_fpga_pdata_to_parent(pdata), region->iova)) {
 		dev_err(&pdata->dev->dev, "failed to map for dma\n");
 		ret = -EFAULT;
 		goto unpin_pages;
-- 
1.8.3.1


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

* Re: [PATCH] fpga: dfl: afu: Pass the correct device to dma_mapping_error()
  2019-04-10 21:53 [PATCH] fpga: dfl: afu: Pass the correct device to dma_mapping_error() Scott Wood
@ 2019-04-11 12:33 ` Wu Hao
  2019-04-11 16:35   ` Moritz Fischer
  0 siblings, 1 reply; 6+ messages in thread
From: Wu Hao @ 2019-04-11 12:33 UTC (permalink / raw)
  To: Scott Wood; +Cc: Alan Tull, Moritz Fischer, linux-fpga, linux-kernel

On Wed, Apr 10, 2019 at 04:53:27PM -0500, Scott Wood wrote:
> dma_mapping_error() was being called on a different device struct than
> what was passed to map/unmap.  Besides rendering the error checking
> ineffective, it caused a debug splat with CONFIG_DMA_API_DEBUG.
> 
> Signed-off-by: Scott Wood <swood@redhat.com>

Hi Scott,

Looks good to me. Thanks for catching this issue.

Acked-by: Wu Hao <hao.wu@intel.com>

Hao

> ---
>  drivers/fpga/dfl-afu-dma-region.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/fpga/dfl-afu-dma-region.c b/drivers/fpga/dfl-afu-dma-region.c
> index e18a786fc943..cd68002ac097 100644
> --- a/drivers/fpga/dfl-afu-dma-region.c
> +++ b/drivers/fpga/dfl-afu-dma-region.c
> @@ -399,7 +399,7 @@ int afu_dma_map_region(struct dfl_feature_platform_data *pdata,
>  				    region->pages[0], 0,
>  				    region->length,
>  				    DMA_BIDIRECTIONAL);
> -	if (dma_mapping_error(&pdata->dev->dev, region->iova)) {
> +	if (dma_mapping_error(dfl_fpga_pdata_to_parent(pdata), region->iova)) {
>  		dev_err(&pdata->dev->dev, "failed to map for dma\n");
>  		ret = -EFAULT;
>  		goto unpin_pages;
> -- 
> 1.8.3.1

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

* Re: [PATCH] fpga: dfl: afu: Pass the correct device to dma_mapping_error()
  2019-04-11 12:33 ` Wu Hao
@ 2019-04-11 16:35   ` Moritz Fischer
  2019-04-15 19:22     ` Alan Tull
  0 siblings, 1 reply; 6+ messages in thread
From: Moritz Fischer @ 2019-04-11 16:35 UTC (permalink / raw)
  To: Wu Hao; +Cc: Scott Wood, Alan Tull, linux-fpga, Linux Kernel Mailing List

Hi Scott,

good catch!

On Thu, Apr 11, 2019 at 5:49 AM Wu Hao <hao.wu@intel.com> wrote:
>
> On Wed, Apr 10, 2019 at 04:53:27PM -0500, Scott Wood wrote:
> > dma_mapping_error() was being called on a different device struct than
> > what was passed to map/unmap.  Besides rendering the error checking
> > ineffective, it caused a debug splat with CONFIG_DMA_API_DEBUG.
> >
> > Signed-off-by: Scott Wood <swood@redhat.com>
>
> Hi Scott,
>
> Looks good to me. Thanks for catching this issue.
>
> Acked-by: Wu Hao <hao.wu@intel.com>
>
> Hao
>
> > ---
> >  drivers/fpga/dfl-afu-dma-region.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/fpga/dfl-afu-dma-region.c b/drivers/fpga/dfl-afu-dma-region.c
> > index e18a786fc943..cd68002ac097 100644
> > --- a/drivers/fpga/dfl-afu-dma-region.c
> > +++ b/drivers/fpga/dfl-afu-dma-region.c
> > @@ -399,7 +399,7 @@ int afu_dma_map_region(struct dfl_feature_platform_data *pdata,
> >                                   region->pages[0], 0,
> >                                   region->length,
> >                                   DMA_BIDIRECTIONAL);
> > -     if (dma_mapping_error(&pdata->dev->dev, region->iova)) {
> > +     if (dma_mapping_error(dfl_fpga_pdata_to_parent(pdata), region->iova)) {
> >               dev_err(&pdata->dev->dev, "failed to map for dma\n");
> >               ret = -EFAULT;
> >               goto unpin_pages;
> > --
> > 1.8.3.1

Acked-by: Moritz Fischer <mdf@kernel.org>

Thanks
Moritz

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

* Re: [PATCH] fpga: dfl: afu: Pass the correct device to dma_mapping_error()
  2019-04-11 16:35   ` Moritz Fischer
@ 2019-04-15 19:22     ` Alan Tull
  2019-05-08 21:39       ` Scott Wood
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Tull @ 2019-04-15 19:22 UTC (permalink / raw)
  To: Moritz Fischer
  Cc: Wu Hao, Scott Wood, Alan Tull, linux-fpga, Linux Kernel Mailing List

On Thu, Apr 11, 2019 at 11:36 AM Moritz Fischer
<moritz.fischer.private@gmail.com> wrote:

Hi Scott,

Thanks!

>
> Hi Scott,
>
> good catch!
>
> On Thu, Apr 11, 2019 at 5:49 AM Wu Hao <hao.wu@intel.com> wrote:
> >
> > On Wed, Apr 10, 2019 at 04:53:27PM -0500, Scott Wood wrote:
> > > dma_mapping_error() was being called on a different device struct than
> > > what was passed to map/unmap.  Besides rendering the error checking
> > > ineffective, it caused a debug splat with CONFIG_DMA_API_DEBUG.
> > >
> > > Signed-off-by: Scott Wood <swood@redhat.com>
> >
> > Hi Scott,
> >
> > Looks good to me. Thanks for catching this issue.
> >
> > Acked-by: Wu Hao <hao.wu@intel.com>
> >
> > Hao
> >
> > > ---
> > >  drivers/fpga/dfl-afu-dma-region.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/fpga/dfl-afu-dma-region.c b/drivers/fpga/dfl-afu-dma-region.c
> > > index e18a786fc943..cd68002ac097 100644
> > > --- a/drivers/fpga/dfl-afu-dma-region.c
> > > +++ b/drivers/fpga/dfl-afu-dma-region.c
> > > @@ -399,7 +399,7 @@ int afu_dma_map_region(struct dfl_feature_platform_data *pdata,
> > >                                   region->pages[0], 0,
> > >                                   region->length,
> > >                                   DMA_BIDIRECTIONAL);
> > > -     if (dma_mapping_error(&pdata->dev->dev, region->iova)) {
> > > +     if (dma_mapping_error(dfl_fpga_pdata_to_parent(pdata), region->iova)) {
> > >               dev_err(&pdata->dev->dev, "failed to map for dma\n");
> > >               ret = -EFAULT;
> > >               goto unpin_pages;
> > > --
> > > 1.8.3.1
>
> Acked-by: Moritz Fischer <mdf@kernel.org>

Acked-by: Alan Tull <atull@kernel.org>

>
> Thanks
> Moritz

Alan

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

* Re: [PATCH] fpga: dfl: afu: Pass the correct device to dma_mapping_error()
  2019-04-15 19:22     ` Alan Tull
@ 2019-05-08 21:39       ` Scott Wood
  2019-05-09  1:55         ` Moritz Fischer
  0 siblings, 1 reply; 6+ messages in thread
From: Scott Wood @ 2019-05-08 21:39 UTC (permalink / raw)
  To: Alan Tull, Moritz Fischer; +Cc: Wu Hao, linux-fpga, Linux Kernel Mailing List

On Mon, 2019-04-15 at 14:22 -0500, Alan Tull wrote:
> On Thu, Apr 11, 2019 at 11:36 AM Moritz Fischer
> <moritz.fischer.private@gmail.com> wrote:
> 
> Hi Scott,
> 
> Thanks!
> 
> > Hi Scott,
> > 
> > good catch!
> > 
> > On Thu, Apr 11, 2019 at 5:49 AM Wu Hao <hao.wu@intel.com> wrote:
> > > On Wed, Apr 10, 2019 at 04:53:27PM -0500, Scott Wood wrote:
> > > > dma_mapping_error() was being called on a different device struct
> > > > than
> > > > what was passed to map/unmap.  Besides rendering the error checking
> > > > ineffective, it caused a debug splat with CONFIG_DMA_API_DEBUG.
> > > > 
> > > > Signed-off-by: Scott Wood <swood@redhat.com>
> > > 
> > > Hi Scott,
> > > 
> > > Looks good to me. Thanks for catching this issue.
> > > 
> > > Acked-by: Wu Hao <hao.wu@intel.com>
> > > 
> > > Hao
> > > 
> > > > ---
> > > >  drivers/fpga/dfl-afu-dma-region.c | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > 
> > > > diff --git a/drivers/fpga/dfl-afu-dma-region.c b/drivers/fpga/dfl-
> > > > afu-dma-region.c
> > > > index e18a786fc943..cd68002ac097 100644
> > > > --- a/drivers/fpga/dfl-afu-dma-region.c
> > > > +++ b/drivers/fpga/dfl-afu-dma-region.c
> > > > @@ -399,7 +399,7 @@ int afu_dma_map_region(struct
> > > > dfl_feature_platform_data *pdata,
> > > >                                   region->pages[0], 0,
> > > >                                   region->length,
> > > >                                   DMA_BIDIRECTIONAL);
> > > > -     if (dma_mapping_error(&pdata->dev->dev, region->iova)) {
> > > > +     if (dma_mapping_error(dfl_fpga_pdata_to_parent(pdata), region-
> > > > >iova)) {
> > > >               dev_err(&pdata->dev->dev, "failed to map for dma\n");
> > > >               ret = -EFAULT;
> > > >               goto unpin_pages;
> > > > --
> > > > 1.8.3.1
> > 
> > Acked-by: Moritz Fischer <mdf@kernel.org>
> 
> Acked-by: Alan Tull <atull@kernel.org>

Whose tree would these patches be going through?

-Scott



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

* Re: [PATCH] fpga: dfl: afu: Pass the correct device to dma_mapping_error()
  2019-05-08 21:39       ` Scott Wood
@ 2019-05-09  1:55         ` Moritz Fischer
  0 siblings, 0 replies; 6+ messages in thread
From: Moritz Fischer @ 2019-05-09  1:55 UTC (permalink / raw)
  To: Scott Wood
  Cc: Alan Tull, Moritz Fischer, Wu Hao, linux-fpga, Linux Kernel Mailing List

Hi Scott,

On Wed, May 08, 2019 at 04:39:51PM -0500, Scott Wood wrote:
> On Mon, 2019-04-15 at 14:22 -0500, Alan Tull wrote:
> > On Thu, Apr 11, 2019 at 11:36 AM Moritz Fischer
> > <moritz.fischer.private@gmail.com> wrote:
> > 
> > Hi Scott,
> > 
> > Thanks!
> > 
> > > Hi Scott,
> > > 
> > > good catch!
> > > 
> > > On Thu, Apr 11, 2019 at 5:49 AM Wu Hao <hao.wu@intel.com> wrote:
> > > > On Wed, Apr 10, 2019 at 04:53:27PM -0500, Scott Wood wrote:
> > > > > dma_mapping_error() was being called on a different device struct
> > > > > than
> > > > > what was passed to map/unmap.  Besides rendering the error checking
> > > > > ineffective, it caused a debug splat with CONFIG_DMA_API_DEBUG.
> > > > > 
> > > > > Signed-off-by: Scott Wood <swood@redhat.com>
> > > > 
> > > > Hi Scott,
> > > > 
> > > > Looks good to me. Thanks for catching this issue.
> > > > 
> > > > Acked-by: Wu Hao <hao.wu@intel.com>
> > > > 
> > > > Hao
> > > > 
> > > > > ---
> > > > >  drivers/fpga/dfl-afu-dma-region.c | 2 +-
> > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/drivers/fpga/dfl-afu-dma-region.c b/drivers/fpga/dfl-
> > > > > afu-dma-region.c
> > > > > index e18a786fc943..cd68002ac097 100644
> > > > > --- a/drivers/fpga/dfl-afu-dma-region.c
> > > > > +++ b/drivers/fpga/dfl-afu-dma-region.c
> > > > > @@ -399,7 +399,7 @@ int afu_dma_map_region(struct
> > > > > dfl_feature_platform_data *pdata,
> > > > >                                   region->pages[0], 0,
> > > > >                                   region->length,
> > > > >                                   DMA_BIDIRECTIONAL);
> > > > > -     if (dma_mapping_error(&pdata->dev->dev, region->iova)) {
> > > > > +     if (dma_mapping_error(dfl_fpga_pdata_to_parent(pdata), region-
> > > > > >iova)) {
> > > > >               dev_err(&pdata->dev->dev, "failed to map for dma\n");
> > > > >               ret = -EFAULT;
> > > > >               goto unpin_pages;
> > > > > --
> > > > > 1.8.3.1
> > > 
> > > Acked-by: Moritz Fischer <mdf@kernel.org>
> > 
> > Acked-by: Alan Tull <atull@kernel.org>
> 
> Whose tree would these patches be going through?

Greg, usually. We're a bit late this time... again ... But haven't forgotten about it.

Sorry,

Moritz

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

end of thread, other threads:[~2019-05-09  1:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-10 21:53 [PATCH] fpga: dfl: afu: Pass the correct device to dma_mapping_error() Scott Wood
2019-04-11 12:33 ` Wu Hao
2019-04-11 16:35   ` Moritz Fischer
2019-04-15 19:22     ` Alan Tull
2019-05-08 21:39       ` Scott Wood
2019-05-09  1:55         ` Moritz Fischer

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).