Skip to content

Commit

Permalink
virtio_pci: use priv for vq notification
Browse files Browse the repository at this point in the history
slightly reduce the amount of pointer chasing this needs to do.
More importantly, this will easily generalize to virtio 1.0.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
Michael S. Tsirkin committed Dec 9, 2014
1 parent 3ec7a77 commit f30eaf4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/virtio/virtio_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,9 @@ static void vp_reset(struct virtio_device *vdev)
/* the notify function used when creating a virt queue */
static bool vp_notify(struct virtqueue *vq)
{
struct virtio_pci_device *vp_dev = to_vp_device(vq->vdev);

/* we write the queue's selector into the notification register to
* signal the other end */
iowrite16(vq->index, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_NOTIFY);
iowrite16(vq->index, (void __iomem *)vq->priv);
return true;
}

Expand Down Expand Up @@ -437,6 +435,7 @@ static struct virtqueue *setup_vq(struct virtio_device *vdev, unsigned index,
goto out_activate_queue;
}

vq->priv = (void __force *)vp_dev->ioaddr + VIRTIO_PCI_QUEUE_NOTIFY;
info->vq = vq;

if (msix_vec != VIRTIO_MSI_NO_VECTOR) {
Expand Down

0 comments on commit f30eaf4

Please sign in to comment.