aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-03-20 16:13:50 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-03-20 16:13:50 +0000
commit97b83deb557679c909465456acaa723c2ba34948 (patch)
tree01584249ce6bc8cae70e98db04499d53b44652dd /hw
parentbf16cc8f97ff57db191eec73346ba0333ade342b (diff)
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
Diffstat (limited to 'hw')
-rw-r--r--hw/virtio.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/hw/virtio.c b/hw/virtio.c
index b94ab0f054..08ea16dee5 100644
--- a/hw/virtio.c
+++ b/hw/virtio.c
@@ -726,9 +726,10 @@ VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size,
void virtio_notify(VirtIODevice *vdev, VirtQueue *vq)
{
- /* Always notify when queue is empty */
- if ((vq->inuse || vring_avail_idx(vq) != vq->last_avail_idx) &&
- (vring_avail_flags(vq) & VRING_AVAIL_F_NO_INTERRUPT))
+ /* Always notify when queue is empty (when feature acknowledge) */
+ if ((vring_avail_flags(vq) & VRING_AVAIL_F_NO_INTERRUPT) &&
+ (!(vdev->features & (1 << VIRTIO_F_NOTIFY_ON_EMPTY)) ||
+ (vq->inuse || vring_avail_idx(vq) != vq->last_avail_idx)))
return;
vdev->isr |= 0x01;