Skip to content

Commit 5059e6e

Browse files
dtatuleamstsirkin
authored andcommitted
vdpa/mlx5: Create helper function for dma mappings
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>
1 parent cf4c185 commit 5059e6e

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

drivers/vdpa/mlx5/core/mlx5_vdpa.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ int mlx5_vdpa_create_mr(struct mlx5_vdpa_dev *mvdev, struct vhost_iotlb *iotlb,
120120
unsigned int asid);
121121
void mlx5_vdpa_destroy_mr(struct mlx5_vdpa_dev *mvdev);
122122
void mlx5_vdpa_destroy_mr_asid(struct mlx5_vdpa_dev *mvdev, unsigned int asid);
123+
int mlx5_vdpa_create_dma_mr(struct mlx5_vdpa_dev *mvdev);
123124

124125
#define mlx5_vdpa_warn(__dev, format, ...) \
125126
dev_warn((__dev)->mdev->device, "%s:%d:(pid %d) warning: " format, __func__, __LINE__, \

drivers/vdpa/mlx5/core/mr.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,3 +619,8 @@ int mlx5_vdpa_handle_set_map(struct mlx5_vdpa_dev *mvdev, struct vhost_iotlb *io
619619

620620
return err;
621621
}
622+
623+
int mlx5_vdpa_create_dma_mr(struct mlx5_vdpa_dev *mvdev)
624+
{
625+
return mlx5_vdpa_create_mr(mvdev, NULL, 0);
626+
}

drivers/vdpa/mlx5/net/mlx5_vnet.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2886,7 +2886,7 @@ static int mlx5_vdpa_reset(struct vdpa_device *vdev)
28862886
++mvdev->generation;
28872887

28882888
if (MLX5_CAP_GEN(mvdev->mdev, umem_uid_0)) {
2889-
if (mlx5_vdpa_create_mr(mvdev, NULL, 0))
2889+
if (mlx5_vdpa_create_dma_mr(mvdev))
28902890
mlx5_vdpa_warn(mvdev, "create MR failed\n");
28912891
}
28922892
up_write(&ndev->reslock);
@@ -3492,7 +3492,7 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,
34923492
goto err_mpfs;
34933493

34943494
if (MLX5_CAP_GEN(mvdev->mdev, umem_uid_0)) {
3495-
err = mlx5_vdpa_create_mr(mvdev, NULL, 0);
3495+
err = mlx5_vdpa_create_dma_mr(mvdev);
34963496
if (err)
34973497
goto err_res;
34983498
}

0 commit comments

Comments
 (0)