2019-04-10 21:54:28

by Crystal Wood

[permalink] [raw]
Subject: [PATCH] fpga: dfl: afu: Pass the correct device to dma_mapping_error()

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 <[email protected]>
---
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


2019-04-11 12:49:59

by Wu Hao

[permalink] [raw]
Subject: Re: [PATCH] fpga: dfl: afu: Pass the correct device to dma_mapping_error()

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 <[email protected]>

Hi Scott,

Looks good to me. Thanks for catching this issue.

Acked-by: Wu Hao <[email protected]>

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

2019-04-11 16:38:16

by Moritz Fischer

[permalink] [raw]
Subject: Re: [PATCH] fpga: dfl: afu: Pass the correct device to dma_mapping_error()

Hi Scott,

good catch!

On Thu, Apr 11, 2019 at 5:49 AM Wu Hao <[email protected]> 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 <[email protected]>
>
> Hi Scott,
>
> Looks good to me. Thanks for catching this issue.
>
> Acked-by: Wu Hao <[email protected]>
>
> 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 <[email protected]>

Thanks
Moritz

2019-04-15 20:33:40

by Alan Tull

[permalink] [raw]
Subject: Re: [PATCH] fpga: dfl: afu: Pass the correct device to dma_mapping_error()

On Thu, Apr 11, 2019 at 11:36 AM Moritz Fischer
<[email protected]> wrote:

Hi Scott,

Thanks!

>
> Hi Scott,
>
> good catch!
>
> On Thu, Apr 11, 2019 at 5:49 AM Wu Hao <[email protected]> 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 <[email protected]>
> >
> > Hi Scott,
> >
> > Looks good to me. Thanks for catching this issue.
> >
> > Acked-by: Wu Hao <[email protected]>
> >
> > 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 <[email protected]>

Acked-by: Alan Tull <[email protected]>

>
> Thanks
> Moritz

Alan

2019-05-08 22:33:59

by Crystal Wood

[permalink] [raw]
Subject: Re: [PATCH] fpga: dfl: afu: Pass the correct device to dma_mapping_error()

On Mon, 2019-04-15 at 14:22 -0500, Alan Tull wrote:
> On Thu, Apr 11, 2019 at 11:36 AM Moritz Fischer
> <[email protected]> wrote:
>
> Hi Scott,
>
> Thanks!
>
> > Hi Scott,
> >
> > good catch!
> >
> > On Thu, Apr 11, 2019 at 5:49 AM Wu Hao <[email protected]> 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 <[email protected]>
> > >
> > > Hi Scott,
> > >
> > > Looks good to me. Thanks for catching this issue.
> > >
> > > Acked-by: Wu Hao <[email protected]>
> > >
> > > 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 <[email protected]>
>
> Acked-by: Alan Tull <[email protected]>

Whose tree would these patches be going through?

-Scott


2019-05-09 01:57:30

by Moritz Fischer

[permalink] [raw]
Subject: Re: [PATCH] fpga: dfl: afu: Pass the correct device to dma_mapping_error()

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
> > <[email protected]> wrote:
> >
> > Hi Scott,
> >
> > Thanks!
> >
> > > Hi Scott,
> > >
> > > good catch!
> > >
> > > On Thu, Apr 11, 2019 at 5:49 AM Wu Hao <[email protected]> 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 <[email protected]>
> > > >
> > > > Hi Scott,
> > > >
> > > > Looks good to me. Thanks for catching this issue.
> > > >
> > > > Acked-by: Wu Hao <[email protected]>
> > > >
> > > > 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 <[email protected]>
> >
> > Acked-by: Alan Tull <[email protected]>
>
> 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