]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
vdpa/mlx5: Create helper function for dma mappings
authorDragos Tatulea <dtatulea@nvidia.com>
Wed, 18 Oct 2023 17:14:44 +0000 (20:14 +0300)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 1 Nov 2023 13:19:55 +0000 (09:19 -0400)
Necessary for upcoming cvq separation from mr allocation.

Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
Message-Id: <20231018171456.1624030-7-dtatulea@nvidia.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Si-Wei Liu <si-wei.liu@oracle.com>
Tested-by: Si-Wei Liu <si-wei.liu@oracle.com>
Tested-by: Lei Yang <leiyang@redhat.com>
drivers/vdpa/mlx5/core/mlx5_vdpa.h
drivers/vdpa/mlx5/core/mr.c
drivers/vdpa/mlx5/net/mlx5_vnet.c

index ca56242972b3af646b6808b33d7f7c4947c45b6c..3748f027cfe92e286e36aa55f0db9ebf0fad3179 100644 (file)
@@ -120,6 +120,7 @@ int mlx5_vdpa_create_mr(struct mlx5_vdpa_dev *mvdev, struct vhost_iotlb *iotlb,
                        unsigned int asid);
 void mlx5_vdpa_destroy_mr(struct mlx5_vdpa_dev *mvdev);
 void mlx5_vdpa_destroy_mr_asid(struct mlx5_vdpa_dev *mvdev, unsigned int asid);
+int mlx5_vdpa_create_dma_mr(struct mlx5_vdpa_dev *mvdev);
 
 #define mlx5_vdpa_warn(__dev, format, ...)                                                         \
        dev_warn((__dev)->mdev->device, "%s:%d:(pid %d) warning: " format, __func__, __LINE__,     \
index 5a1971fcd87b109d33be10ae8bdb678428e5d2d8..7bd0883b8b25d2c2bd1e0eef907feffed375dd28 100644 (file)
@@ -619,3 +619,8 @@ int mlx5_vdpa_handle_set_map(struct mlx5_vdpa_dev *mvdev, struct vhost_iotlb *io
 
        return err;
 }
+
+int mlx5_vdpa_create_dma_mr(struct mlx5_vdpa_dev *mvdev)
+{
+       return mlx5_vdpa_create_mr(mvdev, NULL, 0);
+}
index 946488b8989f4b379b811ad05e401527fa9ea9b3..3f3c9542e87853613813a5c5a69bc921244cd042 100644 (file)
@@ -2880,7 +2880,7 @@ static int mlx5_vdpa_reset(struct vdpa_device *vdev)
        ++mvdev->generation;
 
        if (MLX5_CAP_GEN(mvdev->mdev, umem_uid_0)) {
-               if (mlx5_vdpa_create_mr(mvdev, NULL, 0))
+               if (mlx5_vdpa_create_dma_mr(mvdev))
                        mlx5_vdpa_warn(mvdev, "create MR failed\n");
        }
        up_write(&ndev->reslock);
@@ -3485,7 +3485,7 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,
                goto err_mpfs;
 
        if (MLX5_CAP_GEN(mvdev->mdev, umem_uid_0)) {
-               err = mlx5_vdpa_create_mr(mvdev, NULL, 0);
+               err = mlx5_vdpa_create_dma_mr(mvdev);
                if (err)
                        goto err_res;
        }