Commit 97b83deb557679c909465456acaa723c2ba34948

Authored by aliguori
1 parent bf16cc8f

virtio: Allow guest to defer VIRTIO_F_NOTIFY_ON_EMPTY (Alex Williamson)

There may be cases where the guest does not want the avail queue
interrupt, even when it's empty.  For the virtio-net case, the
guest may use a different buffering scheme or decide polling for
used buffers is more efficient.  This can be accomplished by simply
checking for whether the guest has acknowledged the existing notify
on empty flag.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6865 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 4 additions and 3 deletions
hw/virtio.c
... ... @@ -726,9 +726,10 @@ VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size,
726 726  
727 727 void virtio_notify(VirtIODevice *vdev, VirtQueue *vq)
728 728 {
729   - /* Always notify when queue is empty */
730   - if ((vq->inuse || vring_avail_idx(vq) != vq->last_avail_idx) &&
731   - (vring_avail_flags(vq) & VRING_AVAIL_F_NO_INTERRUPT))
  729 + /* Always notify when queue is empty (when feature acknowledge) */
  730 + if ((vring_avail_flags(vq) & VRING_AVAIL_F_NO_INTERRUPT) &&
  731 + (!(vdev->features & (1 << VIRTIO_F_NOTIFY_ON_EMPTY)) ||
  732 + (vq->inuse || vring_avail_idx(vq) != vq->last_avail_idx)))
732 733 return;
733 734  
734 735 vdev->isr |= 0x01;
... ...