linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vdp/mlx5: Fix setting the correct dma_device
@ 2021-06-03 11:22 Eli Cohen
  2021-06-04  2:35 ` Jason Wang
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Cohen @ 2021-06-03 11:22 UTC (permalink / raw)
  To: mst, jasowang, virtualization, linux-kernel; +Cc: elic

Before SF support was introduced, the DMA device was equal to
mdev->device which was in essence equal to pdev->dev;
With SF introduction this is no longer true. It has already been
handled for vhost_vdpa since the reference to the dma device can from
within mlx5_vdpa. With virtio_vdpa this broke. To fix this we set the
real dma device when initializing the device.

Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices")
Signed-off-by: Eli Cohen <elic@nvidia.com>
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
index bc33f2c523d3..a4ff158181e0 100644
--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
+++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
@@ -2046,7 +2046,7 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name)
 	if (err)
 		goto err_mtu;
 
-	mvdev->vdev.dma_dev = mdev->device;
+	mvdev->vdev.dma_dev = &mdev->pdev->dev;
 	err = mlx5_vdpa_alloc_resources(&ndev->mvdev);
 	if (err)
 		goto err_mtu;
-- 
2.31.1


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

* Re: [PATCH] vdp/mlx5: Fix setting the correct dma_device
  2021-06-03 11:22 [PATCH] vdp/mlx5: Fix setting the correct dma_device Eli Cohen
@ 2021-06-04  2:35 ` Jason Wang
  2021-06-04 15:57   ` Leon Romanovsky
  0 siblings, 1 reply; 5+ messages in thread
From: Jason Wang @ 2021-06-04  2:35 UTC (permalink / raw)
  To: Eli Cohen, mst, virtualization, linux-kernel


在 2021/6/3 下午7:22, Eli Cohen 写道:
> Before SF support was introduced, the DMA device was equal to
> mdev->device which was in essence equal to pdev->dev;
> With SF introduction this is no longer true. It has already been
> handled for vhost_vdpa since the reference to the dma device can from
> within mlx5_vdpa. With virtio_vdpa this broke. To fix this we set the
> real dma device when initializing the device.
>
> Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices")


Note sure this is correct, according to the commit log it should be the 
patch that introduces the SF or aux bus support for vDPA.


> Signed-off-by: Eli Cohen <elic@nvidia.com>


Patch looks correct.

Thanks


> ---
>   drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> index bc33f2c523d3..a4ff158181e0 100644
> --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
> +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> @@ -2046,7 +2046,7 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name)
>   	if (err)
>   		goto err_mtu;
>   
> -	mvdev->vdev.dma_dev = mdev->device;
> +	mvdev->vdev.dma_dev = &mdev->pdev->dev;
>   	err = mlx5_vdpa_alloc_resources(&ndev->mvdev);
>   	if (err)
>   		goto err_mtu;


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

* Re: [PATCH] vdp/mlx5: Fix setting the correct dma_device
  2021-06-04  2:35 ` Jason Wang
@ 2021-06-04 15:57   ` Leon Romanovsky
  2021-06-07  2:30     ` Jason Wang
  0 siblings, 1 reply; 5+ messages in thread
From: Leon Romanovsky @ 2021-06-04 15:57 UTC (permalink / raw)
  To: Jason Wang; +Cc: Eli Cohen, mst, virtualization, linux-kernel

On Fri, Jun 04, 2021 at 10:35:59AM +0800, Jason Wang wrote:
> 
> 在 2021/6/3 下午7:22, Eli Cohen 写道:
> > Before SF support was introduced, the DMA device was equal to
> > mdev->device which was in essence equal to pdev->dev;
> > With SF introduction this is no longer true. It has already been
> > handled for vhost_vdpa since the reference to the dma device can from
> > within mlx5_vdpa. With virtio_vdpa this broke. To fix this we set the
> > real dma device when initializing the device.
> > 
> > Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices")
> 
> 
> Note sure this is correct, according to the commit log it should be the
> patch that introduces the SF or aux bus support for vDPA.

Where did you see that?

git log -p drivers/vdpa/mlx5/net/mlx5_vnet.c

...
+       mvdev->vdev.dma_dev = mdev->device;
+       err = mlx5_vdpa_alloc_resources(&ndev->mvdev);
...
 comes from commit 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices")

Thanks

> 
> 
> > Signed-off-by: Eli Cohen <elic@nvidia.com>
> 
> 
> Patch looks correct.
> 
> Thanks
> 
> 
> > ---
> >   drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> > index bc33f2c523d3..a4ff158181e0 100644
> > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
> > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> > @@ -2046,7 +2046,7 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name)
> >   	if (err)
> >   		goto err_mtu;
> > -	mvdev->vdev.dma_dev = mdev->device;
> > +	mvdev->vdev.dma_dev = &mdev->pdev->dev;
> >   	err = mlx5_vdpa_alloc_resources(&ndev->mvdev);
> >   	if (err)
> >   		goto err_mtu;
> 
> _______________________________________________
> Virtualization mailing list
> Virtualization@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/virtualization

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

* Re: [PATCH] vdp/mlx5: Fix setting the correct dma_device
  2021-06-04 15:57   ` Leon Romanovsky
@ 2021-06-07  2:30     ` Jason Wang
  2021-06-07  5:51       ` Leon Romanovsky
  0 siblings, 1 reply; 5+ messages in thread
From: Jason Wang @ 2021-06-07  2:30 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: Eli Cohen, mst, virtualization, linux-kernel


在 2021/6/4 下午11:57, Leon Romanovsky 写道:
> On Fri, Jun 04, 2021 at 10:35:59AM +0800, Jason Wang wrote:
>> 在 2021/6/3 下午7:22, Eli Cohen 写道:
>>> Before SF support was introduced, the DMA device was equal to
>>> mdev->device which was in essence equal to pdev->dev;
>>> With SF introduction this is no longer true. It has already been
>>> handled for vhost_vdpa since the reference to the dma device can from
>>> within mlx5_vdpa. With virtio_vdpa this broke. To fix this we set the
>>> real dma device when initializing the device.
>>>
>>> Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices")
>>
>> Note sure this is correct, according to the commit log it should be the
>> patch that introduces the SF or aux bus support for vDPA.
> Where did you see that?
>
> git log -p drivers/vdpa/mlx5/net/mlx5_vnet.c
>
> ...
> +       mvdev->vdev.dma_dev = mdev->device;
> +       err = mlx5_vdpa_alloc_resources(&ndev->mvdev);
> ...
>   comes from commit 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices")


If I read the commit log and code correctly:

"

With SF introduction this is no longer true.

"

It works before SF is introduced.

Thanks


>
> Thanks
>
>>
>>> Signed-off-by: Eli Cohen <elic@nvidia.com>
>>
>> Patch looks correct.
>>
>> Thanks
>>
>>
>>> ---
>>>    drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
>>> index bc33f2c523d3..a4ff158181e0 100644
>>> --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
>>> +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
>>> @@ -2046,7 +2046,7 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name)
>>>    	if (err)
>>>    		goto err_mtu;
>>> -	mvdev->vdev.dma_dev = mdev->device;
>>> +	mvdev->vdev.dma_dev = &mdev->pdev->dev;
>>>    	err = mlx5_vdpa_alloc_resources(&ndev->mvdev);
>>>    	if (err)
>>>    		goto err_mtu;
>> _______________________________________________
>> Virtualization mailing list
>> Virtualization@lists.linux-foundation.org
>> https://lists.linuxfoundation.org/mailman/listinfo/virtualization


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

* Re: [PATCH] vdp/mlx5: Fix setting the correct dma_device
  2021-06-07  2:30     ` Jason Wang
@ 2021-06-07  5:51       ` Leon Romanovsky
  0 siblings, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2021-06-07  5:51 UTC (permalink / raw)
  To: Jason Wang; +Cc: Eli Cohen, mst, virtualization, linux-kernel

On Mon, Jun 07, 2021 at 10:30:42AM +0800, Jason Wang wrote:
> 
> 在 2021/6/4 下午11:57, Leon Romanovsky 写道:
> > On Fri, Jun 04, 2021 at 10:35:59AM +0800, Jason Wang wrote:
> > > 在 2021/6/3 下午7:22, Eli Cohen 写道:
> > > > Before SF support was introduced, the DMA device was equal to
> > > > mdev->device which was in essence equal to pdev->dev;
> > > > With SF introduction this is no longer true. It has already been
> > > > handled for vhost_vdpa since the reference to the dma device can from
> > > > within mlx5_vdpa. With virtio_vdpa this broke. To fix this we set the
> > > > real dma device when initializing the device.
> > > > 
> > > > Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices")
> > > 
> > > Note sure this is correct, according to the commit log it should be the
> > > patch that introduces the SF or aux bus support for vDPA.
> > Where did you see that?
> > 
> > git log -p drivers/vdpa/mlx5/net/mlx5_vnet.c
> > 
> > ...
> > +       mvdev->vdev.dma_dev = mdev->device;
> > +       err = mlx5_vdpa_alloc_resources(&ndev->mvdev);
> > ...
> >   comes from commit 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices")
> 
> 
> If I read the commit log and code correctly:
> 
> "
> 
> With SF introduction this is no longer true.
> 
> "
> 
> It works before SF is introduced.

Yes, you are right, sorry for the noise.

> 
> Thanks
> 
> 
> > 
> > Thanks
> > 
> > > 
> > > > Signed-off-by: Eli Cohen <elic@nvidia.com>
> > > 
> > > Patch looks correct.
> > > 
> > > Thanks
> > > 
> > > 
> > > > ---
> > > >    drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +-
> > > >    1 file changed, 1 insertion(+), 1 deletion(-)
> > > > 
> > > > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> > > > index bc33f2c523d3..a4ff158181e0 100644
> > > > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
> > > > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> > > > @@ -2046,7 +2046,7 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name)
> > > >    	if (err)
> > > >    		goto err_mtu;
> > > > -	mvdev->vdev.dma_dev = mdev->device;
> > > > +	mvdev->vdev.dma_dev = &mdev->pdev->dev;
> > > >    	err = mlx5_vdpa_alloc_resources(&ndev->mvdev);
> > > >    	if (err)
> > > >    		goto err_mtu;
> > > _______________________________________________
> > > Virtualization mailing list
> > > Virtualization@lists.linux-foundation.org
> > > https://lists.linuxfoundation.org/mailman/listinfo/virtualization
> 

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

end of thread, other threads:[~2021-06-07  5:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03 11:22 [PATCH] vdp/mlx5: Fix setting the correct dma_device Eli Cohen
2021-06-04  2:35 ` Jason Wang
2021-06-04 15:57   ` Leon Romanovsky
2021-06-07  2:30     ` Jason Wang
2021-06-07  5:51       ` Leon Romanovsky

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