hw/virtio/vring/event_idx: fix the vring_avail_event error
commita3614c65cfc3ba2958b69befdc156101953f8a8c
authorBin Wu <wu.wubin@huawei.com>
Fri, 31 Oct 2014 00:40:16 +0000 (31 00:40 +0000)
committerMichael S. Tsirkin <mst@redhat.com>
Sun, 2 Nov 2014 11:44:12 +0000 (2 13:44 +0200)
tree22ea715b0db707216ac246992b07acd851cdde44
parentdb80c7b974f4ccab56bd5e8ff2248c7339b00c73
hw/virtio/vring/event_idx: fix the vring_avail_event error

The event idx in virtio is an effective way to reduce the number of
interrupts and exits of the guest. When the guest puts an request
into the virtio ring, it doesn't exit immediately to inform the
backend. Instead, the guest checks the "avail" event idx to determine
the notification.

In virtqueue_pop, when a request is poped, the current avail event
idx should be set to the number of vq->last_avail_idx.

Signed-off-by: Bin Wu <wu.wubin@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
hw/virtio/dataplane/vring.c
hw/virtio/virtio.c