summaryrefslogtreecommitdiff
path: root/drivers/vdpa/mlx5/net
diff options
context:
space:
mode:
authorDragos Tatulea <dtatulea@nvidia.com>2023-10-18 20:14:55 +0300
committerMichael S. Tsirkin <mst@redhat.com>2023-11-01 16:19:57 +0300
commit5dc31bd245a4fd7fe2d1fd79b7a2a81c96d6d33c (patch)
tree0df8f8fd7d0a79df4d5fdec6dbc12c91e7f79e94 /drivers/vdpa/mlx5/net
parentcf6e024cf7683551ae218ce9af56b82e68a0ef06 (diff)
downloadlinux-5dc31bd245a4fd7fe2d1fd79b7a2a81c96d6d33c.tar.xz
vdpa/mlx5: Update cvq iotlb mapping on ASID change
For the following sequence: - cvq group is in ASID 0 - .set_map(1, cvq_iotlb) - .set_group_asid(cvq_group, 1) ... the cvq mapping from ASID 0 will be used. This is not always correct behaviour. This patch adds support for the above mentioned flow by saving the iotlb on each .set_map and updating the cvq iotlb with it on a cvq group change. Acked-by: Jason Wang <jasowang@redhat.com> Acked-by: Eugenio PĂ©rez <eperezma@redhat.com> Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com> Message-Id: <20231018171456.1624030-18-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>
Diffstat (limited to 'drivers/vdpa/mlx5/net')
-rw-r--r--drivers/vdpa/mlx5/net/mlx5_vnet.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
index 63aa6ec4ef88..55f9233dedf1 100644
--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
+++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
@@ -3203,12 +3203,19 @@ static int mlx5_set_group_asid(struct vdpa_device *vdev, u32 group,
unsigned int asid)
{
struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev);
+ int err = 0;
if (group >= MLX5_VDPA_NUMVQ_GROUPS)
return -EINVAL;
mvdev->group2asid[group] = asid;
- return 0;
+
+ mutex_lock(&mvdev->mr_mtx);
+ if (group == MLX5_VDPA_CVQ_GROUP && mvdev->mr[asid])
+ err = mlx5_vdpa_update_cvq_iotlb(mvdev, mvdev->mr[asid]->iotlb, asid);
+ mutex_unlock(&mvdev->mr_mtx);
+
+ return err;
}
static const struct vdpa_config_ops mlx5_vdpa_ops = {