Skip to content

Commit

Permalink
virtio: re-order vm_running and use_started checks
Browse files Browse the repository at this point in the history
During migration the virtio device state can be restored before we
restart the VM. As no devices can be running while the VM is paused it
makes sense to bail out early in that case.

This returns the order introduced in:

 9f6bcfd (hw/virtio: move vm_running check to virtio_device_started)

to what virtio-sock was doing longhand.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Message-Id: <20221014132108.2559156-1-alex.bennee@linaro.org>
Tested-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
stsquad authored and mstsirkin committed Nov 2, 2022
1 parent 5ca10df commit f941a6b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions include/hw/virtio/virtio.h
Expand Up @@ -385,14 +385,14 @@ static inline bool virtio_is_big_endian(VirtIODevice *vdev)

static inline bool virtio_device_started(VirtIODevice *vdev, uint8_t status)
{
if (vdev->use_started) {
return vdev->started;
}

if (!vdev->vm_running) {
return false;
}

if (vdev->use_started) {
return vdev->started;
}

return status & VIRTIO_CONFIG_S_DRIVER_OK;
}

Expand Down

0 comments on commit f941a6b

Please sign in to comment.