@@ -131,7 +131,7 @@ static irqreturn_t virtio_vdpa_virtqueue_cb(void *private)
131
131
static struct virtqueue *
132
132
virtio_vdpa_setup_vq (struct virtio_device * vdev , unsigned int index ,
133
133
void (* callback )(struct virtqueue * vq ),
134
- const char * name , bool ctx )
134
+ const char * name , u32 size , bool ctx )
135
135
{
136
136
struct virtio_vdpa_device * vd_dev = to_virtio_vdpa_device (vdev );
137
137
struct vdpa_device * vdpa = vd_get_vdpa (vdev );
@@ -168,14 +168,17 @@ virtio_vdpa_setup_vq(struct virtio_device *vdev, unsigned int index,
168
168
goto error_new_virtqueue ;
169
169
}
170
170
171
+ if (!size || size > max_num )
172
+ size = max_num ;
173
+
171
174
if (ops -> get_vq_num_min )
172
175
min_num = ops -> get_vq_num_min (vdpa );
173
176
174
- may_reduce_num = (max_num == min_num ) ? false : true;
177
+ may_reduce_num = (size == min_num ) ? false : true;
175
178
176
179
/* Create the vring */
177
180
align = ops -> get_vq_align (vdpa );
178
- vq = vring_create_virtqueue (index , max_num , align , vdev ,
181
+ vq = vring_create_virtqueue (index , size , align , vdev ,
179
182
true, may_reduce_num , ctx ,
180
183
virtio_vdpa_notify , callback , name );
181
184
if (!vq ) {
@@ -285,9 +288,9 @@ static int virtio_vdpa_find_vqs(struct virtio_device *vdev, unsigned int nvqs,
285
288
continue ;
286
289
}
287
290
288
- vqs [i ] = virtio_vdpa_setup_vq (vdev , queue_idx ++ ,
289
- callbacks [i ], names [i ], ctx ?
290
- ctx [i ] : false);
291
+ vqs [i ] = virtio_vdpa_setup_vq (vdev , queue_idx ++ , callbacks [ i ],
292
+ names [i ], sizes ? sizes [i ] : 0 ,
293
+ ctx ? ctx [i ] : false);
291
294
if (IS_ERR (vqs [i ])) {
292
295
err = PTR_ERR (vqs [i ]);
293
296
goto err_setup_vq ;
0 commit comments