diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2013-08-12 11:08:09 +0200 |
---|---|---|
committer | Michael Roth <mdroth@linux.vnet.ibm.com> | 2013-08-13 10:04:25 -0500 |
commit | 8d676daf6d12fb5357da9ccd54ac7640dd7ea9f2 (patch) | |
tree | 7b4f54951da6cf17016bff73d0a060231dd00729 | |
parent | 6bf6fcd181efdcbbb136ce622e1b2e1cbc677b60 (diff) | |
download | qemu-8d676daf6d12fb5357da9ccd54ac7640dd7ea9f2.zip qemu-8d676daf6d12fb5357da9ccd54ac7640dd7ea9f2.tar.gz qemu-8d676daf6d12fb5357da9ccd54ac7640dd7ea9f2.tar.bz2 |
virtio: clear signalled_used_valid when switching from dataplane
When the dataplane thread stops, its vring.c implementation synchronizes
vring state back to virtio.c so we can continue emulating the virtio
device.
This patch ensures that virtio.c's signalled_used_valid flag is reset so
that we do not suppress guest notifications due to stale signalled_used
values.
Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 6793dfd1b6a99a79b9f2e3c4d6625ccd6513f240)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
-rw-r--r-- | hw/virtio/dataplane/vring.c | 1 | ||||
-rw-r--r-- | hw/virtio/virtio.c | 5 | ||||
-rw-r--r-- | include/hw/virtio/virtio.h | 1 |
3 files changed, 7 insertions, 0 deletions
diff --git a/hw/virtio/dataplane/vring.c b/hw/virtio/dataplane/vring.c index 82cc151..351a343 100644 --- a/hw/virtio/dataplane/vring.c +++ b/hw/virtio/dataplane/vring.c @@ -52,6 +52,7 @@ bool vring_setup(Vring *vring, VirtIODevice *vdev, int n) void vring_teardown(Vring *vring, VirtIODevice *vdev, int n) { virtio_queue_set_last_avail_idx(vdev, n, vring->last_avail_idx); + virtio_queue_invalidate_signalled_used(vdev, n); hostmem_finalize(&vring->hostmem); } diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 8176c14..a5251cb 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1025,6 +1025,11 @@ void virtio_queue_set_last_avail_idx(VirtIODevice *vdev, int n, uint16_t idx) vdev->vq[n].last_avail_idx = idx; } +void virtio_queue_invalidate_signalled_used(VirtIODevice *vdev, int n) +{ + vdev->vq[n].signalled_used_valid = false; +} + VirtQueue *virtio_get_queue(VirtIODevice *vdev, int n) { return vdev->vq + n; diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index a6c5c53..f2aa6a3 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -233,6 +233,7 @@ hwaddr virtio_queue_get_used_size(VirtIODevice *vdev, int n); hwaddr virtio_queue_get_ring_size(VirtIODevice *vdev, int n); uint16_t virtio_queue_get_last_avail_idx(VirtIODevice *vdev, int n); void virtio_queue_set_last_avail_idx(VirtIODevice *vdev, int n, uint16_t idx); +void virtio_queue_invalidate_signalled_used(VirtIODevice *vdev, int n); VirtQueue *virtio_get_queue(VirtIODevice *vdev, int n); uint16_t virtio_get_queue_index(VirtQueue *vq); int virtio_queue_get_id(VirtQueue *vq); |