Leon Romanovsky
2021-Jun-04 15:57 UTC
[PATCH] vdp/mlx5: Fix setting the correct dma_device
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 at 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 at lists.linux-foundation.org > https://lists.linuxfoundation.org/mailman/listinfo/virtualization
? 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 at 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 at lists.linux-foundation.org >> https://lists.linuxfoundation.org/mailman/listinfo/virtualization