Jason Wang
2020-Sep-09 02:08 UTC
[PATCH v2] vdpa/mlx5: Setup driver only if VIRTIO_CONFIG_S_DRIVER_OK
----- Original Message -----> set_map() is used by mlx5 vdpa to create a memory region based on the > address map passed by the iotlb argument. If we get successive calls, we > will destroy the current memory region and build another one based on > the new address mapping. We also need to setup the hardware resources > since they depend on the memory region. > > If these calls happen before DRIVER_OK, It means that driver VQs may > also not been setup and we may not create them yet. In this case we want > to avoid setting up the other resources and defer this till we get > DRIVER OK. > > Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices") > Signed-off-by: Eli Cohen <elic at nvidia.com> > --- > V1->V2: Improve changelog description > > drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c > b/drivers/vdpa/mlx5/net/mlx5_vnet.c > index 9df69d5efe8c..c89cd48a0aab 100644 > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c > @@ -1645,6 +1645,9 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_net > *ndev, struct vhost_iotlb * > if (err) > goto err_mr; > > + if (!(ndev->mvdev.status & VIRTIO_CONFIG_S_DRIVER_OK)) > + return 0; > +Is there any reason that we still need to do vq suspending and saving before? Thanks> restore_channels_info(ndev); > err = setup_driver(ndev); > if (err) > -- > 2.26.0 > >