aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2011-05-18 13:57:37 +0800
committerMichael S. Tsirkin <mst@redhat.com>2011-06-12 10:33:38 +0300
commitd3674c5754775eb65ec2f2fd5f8cfe9b032ca0b1 (patch)
treebb074dc6c76acef80cd297fa001f80ef0d44886e /hw
parent7157e2e23e89adcd436caeab31fdd6b47eded377 (diff)
downloadqemu-d3674c5754775eb65ec2f2fd5f8cfe9b032ca0b1.zip
qemu-d3674c5754775eb65ec2f2fd5f8cfe9b032ca0b1.tar.gz
qemu-d3674c5754775eb65ec2f2fd5f8cfe9b032ca0b1.tar.bz2
virtio: correctly initialize vm_running
Current vm_running was not explicitly initialized and its value was changed by vm state notifier, this may confuse the virtio device being hotplugged such as virtio-net with vhost backend as it may think the vm was not running. Solve this by initialize this value explicitly in virtio_common_init(). Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/virtio.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/virtio.c b/hw/virtio.c
index a651860..36b8f35 100644
--- a/hw/virtio.c
+++ b/hw/virtio.c
@@ -787,6 +787,7 @@ VirtIODevice *virtio_common_init(const char *name, uint16_t device_id,
vdev->queue_sel = 0;
vdev->config_vector = VIRTIO_NO_VECTOR;
vdev->vq = qemu_mallocz(sizeof(VirtQueue) * VIRTIO_PCI_QUEUE_MAX);
+ vdev->vm_running = vm_running;
for(i = 0; i < VIRTIO_PCI_QUEUE_MAX; i++) {
vdev->vq[i].vector = VIRTIO_NO_VECTOR;
vdev->vq[i].vdev = vdev;