]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
vdpa/mlx5: Setup driver only if VIRTIO_CONFIG_S_DRIVER_OK
authorEli Cohen <elic@nvidia.com>
Tue, 8 Sep 2020 12:33:46 +0000 (15:33 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 09:12:00 +0000 (10:12 +0100)
[ Upstream commit 1897f0b618b0af0eb9dca709ab6bdf9ef1969ef7 ]

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@nvidia.com>
Link: https://lore.kernel.org/r/20200908123346.GA169007@mtl-vdi-166.wap.labs.mlnx
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/vdpa/mlx5/net/mlx5_vnet.c

index 5ca309473c03d6de37a4dffbcf6f8c53467a5323..1fa6fcac82992f9d58d853b7359a9c0a1dd6648c 100644 (file)
@@ -1658,6 +1658,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;
+
        restore_channels_info(ndev);
        err = setup_driver(ndev);
        if (err)