@@ -28,19 +28,6 @@ struct virtio_vdpa_device {
28
28
struct virtio_device vdev ;
29
29
struct vdpa_device * vdpa ;
30
30
u64 features ;
31
-
32
- /* The lock to protect virtqueue list */
33
- spinlock_t lock ;
34
- /* List of virtio_vdpa_vq_info */
35
- struct list_head virtqueues ;
36
- };
37
-
38
- struct virtio_vdpa_vq_info {
39
- /* the actual virtqueue */
40
- struct virtqueue * vq ;
41
-
42
- /* the list node for the virtqueues list */
43
- struct list_head node ;
44
31
};
45
32
46
33
static inline struct virtio_vdpa_device *
@@ -135,28 +122,25 @@ static irqreturn_t virtio_vdpa_config_cb(void *private)
135
122
136
123
static irqreturn_t virtio_vdpa_virtqueue_cb (void * private )
137
124
{
138
- struct virtio_vdpa_vq_info * info = private ;
125
+ struct virtqueue * vq = private ;
139
126
140
- return vring_interrupt (0 , info -> vq );
127
+ return vring_interrupt (0 , vq );
141
128
}
142
129
143
130
static struct virtqueue *
144
131
virtio_vdpa_setup_vq (struct virtio_device * vdev , unsigned int index ,
145
132
void (* callback )(struct virtqueue * vq ),
146
133
const char * name , bool ctx )
147
134
{
148
- struct virtio_vdpa_device * vd_dev = to_virtio_vdpa_device (vdev );
149
135
struct vdpa_device * vdpa = vd_get_vdpa (vdev );
150
136
struct device * dma_dev ;
151
137
const struct vdpa_config_ops * ops = vdpa -> config ;
152
- struct virtio_vdpa_vq_info * info ;
153
138
bool (* notify )(struct virtqueue * vq ) = virtio_vdpa_notify ;
154
139
struct vdpa_callback cb ;
155
140
struct virtqueue * vq ;
156
141
u64 desc_addr , driver_addr , device_addr ;
157
142
/* Assume split virtqueue, switch to packed if necessary */
158
143
struct vdpa_vq_state state = {0 };
159
- unsigned long flags ;
160
144
u32 align , max_num , min_num = 1 ;
161
145
bool may_reduce_num = true;
162
146
int err ;
@@ -179,10 +163,6 @@ virtio_vdpa_setup_vq(struct virtio_device *vdev, unsigned int index,
179
163
if (ops -> get_vq_ready (vdpa , index ))
180
164
return ERR_PTR (- ENOENT );
181
165
182
- /* Allocate and fill out our active queue description */
183
- info = kmalloc (sizeof (* info ), GFP_KERNEL );
184
- if (!info )
185
- return ERR_PTR (- ENOMEM );
186
166
if (ops -> get_vq_size )
187
167
max_num = ops -> get_vq_size (vdpa , index );
188
168
else
@@ -217,7 +197,7 @@ virtio_vdpa_setup_vq(struct virtio_device *vdev, unsigned int index,
217
197
218
198
/* Setup virtqueue callback */
219
199
cb .callback = callback ? virtio_vdpa_virtqueue_cb : NULL ;
220
- cb .private = info ;
200
+ cb .private = vq ;
221
201
cb .trigger = NULL ;
222
202
ops -> set_vq_cb (vdpa , index , & cb );
223
203
ops -> set_vq_num (vdpa , index , virtqueue_get_vring_size (vq ));
@@ -248,13 +228,6 @@ virtio_vdpa_setup_vq(struct virtio_device *vdev, unsigned int index,
248
228
249
229
ops -> set_vq_ready (vdpa , index , 1 );
250
230
251
- vq -> priv = info ;
252
- info -> vq = vq ;
253
-
254
- spin_lock_irqsave (& vd_dev -> lock , flags );
255
- list_add (& info -> node , & vd_dev -> virtqueues );
256
- spin_unlock_irqrestore (& vd_dev -> lock , flags );
257
-
258
231
return vq ;
259
232
260
233
err_vq :
@@ -263,7 +236,6 @@ virtio_vdpa_setup_vq(struct virtio_device *vdev, unsigned int index,
263
236
ops -> set_vq_ready (vdpa , index , 0 );
264
237
/* VDPA driver should make sure vq is stopeed here */
265
238
WARN_ON (ops -> get_vq_ready (vdpa , index ));
266
- kfree (info );
267
239
return ERR_PTR (err );
268
240
}
269
241
@@ -272,20 +244,12 @@ static void virtio_vdpa_del_vq(struct virtqueue *vq)
272
244
struct virtio_vdpa_device * vd_dev = to_virtio_vdpa_device (vq -> vdev );
273
245
struct vdpa_device * vdpa = vd_dev -> vdpa ;
274
246
const struct vdpa_config_ops * ops = vdpa -> config ;
275
- struct virtio_vdpa_vq_info * info = vq -> priv ;
276
247
unsigned int index = vq -> index ;
277
- unsigned long flags ;
278
-
279
- spin_lock_irqsave (& vd_dev -> lock , flags );
280
- list_del (& info -> node );
281
- spin_unlock_irqrestore (& vd_dev -> lock , flags );
282
248
283
249
/* Select and deactivate the queue (best effort) */
284
250
ops -> set_vq_ready (vdpa , index , 0 );
285
251
286
252
vring_del_virtqueue (vq );
287
-
288
- kfree (info );
289
253
}
290
254
291
255
static void virtio_vdpa_del_vqs (struct virtio_device * vdev )
@@ -501,8 +465,6 @@ static int virtio_vdpa_probe(struct vdpa_device *vdpa)
501
465
vd_dev -> vdev .dev .release = virtio_vdpa_release_dev ;
502
466
vd_dev -> vdev .config = & virtio_vdpa_config_ops ;
503
467
vd_dev -> vdpa = vdpa ;
504
- INIT_LIST_HEAD (& vd_dev -> virtqueues );
505
- spin_lock_init (& vd_dev -> lock );
506
468
507
469
vd_dev -> vdev .id .device = ops -> get_device_id (vdpa );
508
470
if (vd_dev -> vdev .id .device == 0 )
0 commit comments