Skip to content

Commit ad03a0f

Browse files
eugpermarmstsirkin
authored andcommitted
vdpa/mlx5: Delete control vq iotlb in destroy_mr only when necessary
mlx5_vdpa_destroy_mr can be called from .set_map with data ASID after the control virtqueue ASID iotlb has been populated. The control vq iotlb must not be cleared, since it will not be populated again. So call the ASID aware destroy function which makes sure that the right vq resource is destroyed. Fixes: 8fcd20c ("vdpa/mlx5: Support different address spaces for control and data") Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Reviewed-by: Gal Pressman <gal@nvidia.com> Message-Id: <20230802171231.11001-5-dtatulea@nvidia.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com>
1 parent 9ee8110 commit ad03a0f

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

drivers/vdpa/mlx5/core/mlx5_vdpa.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ int mlx5_vdpa_handle_set_map(struct mlx5_vdpa_dev *mvdev, struct vhost_iotlb *io
122122
int mlx5_vdpa_create_mr(struct mlx5_vdpa_dev *mvdev, struct vhost_iotlb *iotlb,
123123
unsigned int asid);
124124
void mlx5_vdpa_destroy_mr(struct mlx5_vdpa_dev *mvdev);
125+
void mlx5_vdpa_destroy_mr_asid(struct mlx5_vdpa_dev *mvdev, unsigned int asid);
125126

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

drivers/vdpa/mlx5/core/mr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ static void _mlx5_vdpa_destroy_dvq_mr(struct mlx5_vdpa_dev *mvdev, unsigned int
515515
mr->initialized = false;
516516
}
517517

518-
static void mlx5_vdpa_destroy_mr_asid(struct mlx5_vdpa_dev *mvdev, unsigned int asid)
518+
void mlx5_vdpa_destroy_mr_asid(struct mlx5_vdpa_dev *mvdev, unsigned int asid)
519519
{
520520
struct mlx5_vdpa_mr *mr = &mvdev->mr;
521521

drivers/vdpa/mlx5/net/mlx5_vnet.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2644,7 +2644,7 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev,
26442644
goto err_mr;
26452645

26462646
teardown_driver(ndev);
2647-
mlx5_vdpa_destroy_mr(mvdev);
2647+
mlx5_vdpa_destroy_mr_asid(mvdev, asid);
26482648
err = mlx5_vdpa_create_mr(mvdev, iotlb, asid);
26492649
if (err)
26502650
goto err_mr;
@@ -2660,7 +2660,7 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev,
26602660
return 0;
26612661

26622662
err_setup:
2663-
mlx5_vdpa_destroy_mr(mvdev);
2663+
mlx5_vdpa_destroy_mr_asid(mvdev, asid);
26642664
err_mr:
26652665
return err;
26662666
}

0 commit comments

Comments
 (0)