aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/virtio/virtio_pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/virtio/virtio_pci.c')
-rw-r--r--drivers/virtio/virtio_pci.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
index 2e03d416b9af..d902464b89ce 100644
--- a/drivers/virtio/virtio_pci.c
+++ b/drivers/virtio/virtio_pci.c
@@ -79,9 +79,6 @@ struct virtio_pci_vq_info
79 /* the number of entries in the queue */ 79 /* the number of entries in the queue */
80 int num; 80 int num;
81 81
82 /* the index of the queue */
83 int queue_index;
84
85 /* the virtual address of the ring queue */ 82 /* the virtual address of the ring queue */
86 void *queue; 83 void *queue;
87 84
@@ -202,11 +199,11 @@ static void vp_reset(struct virtio_device *vdev)
202static void vp_notify(struct virtqueue *vq) 199static void vp_notify(struct virtqueue *vq)
203{ 200{
204 struct virtio_pci_device *vp_dev = to_vp_device(vq->vdev); 201 struct virtio_pci_device *vp_dev = to_vp_device(vq->vdev);
205 struct virtio_pci_vq_info *info = vq->priv;
206 202
207 /* we write the queue's selector into the notification register to 203 /* we write the queue's selector into the notification register to
208 * signal the other end */ 204 * signal the other end */
209 iowrite16(info->queue_index, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_NOTIFY); 205 iowrite16(virtqueue_get_queue_index(vq),
206 vp_dev->ioaddr + VIRTIO_PCI_QUEUE_NOTIFY);
210} 207}
211 208
212/* Handle a configuration change: Tell driver if it wants to know. */ 209/* Handle a configuration change: Tell driver if it wants to know. */
@@ -402,7 +399,6 @@ static struct virtqueue *setup_vq(struct virtio_device *vdev, unsigned index,
402 if (!info) 399 if (!info)
403 return ERR_PTR(-ENOMEM); 400 return ERR_PTR(-ENOMEM);
404 401
405 info->queue_index = index;
406 info->num = num; 402 info->num = num;
407 info->msix_vector = msix_vec; 403 info->msix_vector = msix_vec;
408 404
@@ -418,7 +414,7 @@ static struct virtqueue *setup_vq(struct virtio_device *vdev, unsigned index,
418 vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN); 414 vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN);
419 415
420 /* create the vring */ 416 /* create the vring */
421 vq = vring_new_virtqueue(info->num, VIRTIO_PCI_VRING_ALIGN, vdev, 417 vq = vring_new_virtqueue(index, info->num, VIRTIO_PCI_VRING_ALIGN, vdev,
422 true, info->queue, vp_notify, callback, name); 418 true, info->queue, vp_notify, callback, name);
423 if (!vq) { 419 if (!vq) {
424 err = -ENOMEM; 420 err = -ENOMEM;
@@ -467,7 +463,8 @@ static void vp_del_vq(struct virtqueue *vq)
467 list_del(&info->node); 463 list_del(&info->node);
468 spin_unlock_irqrestore(&vp_dev->lock, flags); 464 spin_unlock_irqrestore(&vp_dev->lock, flags);
469 465
470 iowrite16(info->queue_index, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_SEL); 466 iowrite16(virtqueue_get_queue_index(vq),
467 vp_dev->ioaddr + VIRTIO_PCI_QUEUE_SEL);
471 468
472 if (vp_dev->msix_enabled) { 469 if (vp_dev->msix_enabled) {
473 iowrite16(VIRTIO_MSI_NO_VECTOR, 470 iowrite16(VIRTIO_MSI_NO_VECTOR,