@@ -31,11 +31,9 @@ struct mlx5_vdpa_mr {
3131 struct list_head head ;
3232 unsigned long num_directs ;
3333 unsigned long num_klms ;
34- /* state of dvq mr */
35- bool initialized ;
3634
37- /* serialize mkey creation and destruction */
38- struct mutex mkey_mtx ;
35+ struct vhost_iotlb * iotlb ;
36+
3937 bool user_mr ;
4038};
4139
@@ -74,11 +72,12 @@ struct mlx5_vdpa_wq_ent {
7472enum {
7573 MLX5_VDPA_DATAVQ_GROUP ,
7674 MLX5_VDPA_CVQ_GROUP ,
75+ MLX5_VDPA_DATAVQ_DESC_GROUP ,
7776 MLX5_VDPA_NUMVQ_GROUPS
7877};
7978
8079enum {
81- MLX5_VDPA_NUM_AS = MLX5_VDPA_NUMVQ_GROUPS
80+ MLX5_VDPA_NUM_AS = 2
8281};
8382
8483struct mlx5_vdpa_dev {
@@ -93,7 +92,9 @@ struct mlx5_vdpa_dev {
9392 u16 max_idx ;
9493 u32 generation ;
9594
96- struct mlx5_vdpa_mr mr ;
95+ struct mlx5_vdpa_mr * mr [MLX5_VDPA_NUM_AS ];
96+ /* serialize mr access */
97+ struct mutex mr_mtx ;
9798 struct mlx5_control_vq cvq ;
9899 struct workqueue_struct * wq ;
99100 unsigned int group2asid [MLX5_VDPA_NUMVQ_GROUPS ];
@@ -114,12 +115,19 @@ void mlx5_vdpa_free_resources(struct mlx5_vdpa_dev *mvdev);
114115int mlx5_vdpa_create_mkey (struct mlx5_vdpa_dev * mvdev , u32 * mkey , u32 * in ,
115116 int inlen );
116117int mlx5_vdpa_destroy_mkey (struct mlx5_vdpa_dev * mvdev , u32 mkey );
117- int mlx5_vdpa_handle_set_map (struct mlx5_vdpa_dev * mvdev , struct vhost_iotlb * iotlb ,
118- bool * change_map , unsigned int asid );
119- int mlx5_vdpa_create_mr (struct mlx5_vdpa_dev * mvdev , struct vhost_iotlb * iotlb ,
120- unsigned int asid );
121- void mlx5_vdpa_destroy_mr (struct mlx5_vdpa_dev * mvdev );
122- void mlx5_vdpa_destroy_mr_asid (struct mlx5_vdpa_dev * mvdev , unsigned int asid );
118+ struct mlx5_vdpa_mr * mlx5_vdpa_create_mr (struct mlx5_vdpa_dev * mvdev ,
119+ struct vhost_iotlb * iotlb );
120+ void mlx5_vdpa_destroy_mr_resources (struct mlx5_vdpa_dev * mvdev );
121+ void mlx5_vdpa_destroy_mr (struct mlx5_vdpa_dev * mvdev ,
122+ struct mlx5_vdpa_mr * mr );
123+ void mlx5_vdpa_update_mr (struct mlx5_vdpa_dev * mvdev ,
124+ struct mlx5_vdpa_mr * mr ,
125+ unsigned int asid );
126+ int mlx5_vdpa_update_cvq_iotlb (struct mlx5_vdpa_dev * mvdev ,
127+ struct vhost_iotlb * iotlb ,
128+ unsigned int asid );
129+ int mlx5_vdpa_create_dma_mr (struct mlx5_vdpa_dev * mvdev );
130+ int mlx5_vdpa_reset_mr (struct mlx5_vdpa_dev * mvdev , unsigned int asid );
123131
124132#define mlx5_vdpa_warn (__dev , format , ...) \
125133 dev_warn((__dev)->mdev->device, "%s:%d:(pid %d) warning: " format, __func__, __LINE__, \
0 commit comments