[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 34/82] virtio: re-order vm_running and use_started checks
From: |
Michael S. Tsirkin |
Subject: |
[PULL v2 34/82] virtio: re-order vm_running and use_started checks |
Date: |
Wed, 2 Nov 2022 12:09:55 -0400 |
From: Alex Bennée <alex.bennee@linaro.org>
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:
9f6bcfd99f (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>
---
include/hw/virtio/virtio.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index f41b4a7e64..ebb58feaac 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -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;
}
--
MST
- [PULL v2 30/82] hw/pci-bridge/cxl-upstream: Add a CDAT table access DOE, (continued)
- [PULL v2 30/82] hw/pci-bridge/cxl-upstream: Add a CDAT table access DOE, Michael S. Tsirkin, 2022/11/02
- [PULL v2 26/82] hw/pci: PCIe Data Object Exchange emulation, Michael S. Tsirkin, 2022/11/02
- [PULL v2 32/82] vhost-user: Support vhost_dev_start, Michael S. Tsirkin, 2022/11/02
- [PULL v2 31/82] vhost: Change the sequence of device start, Michael S. Tsirkin, 2022/11/02
- Re: [PULL v2 31/82] vhost: Change the sequence of device start, Bernhard Beschow, 2022/11/05
- Re: [PULL v2 31/82] vhost: Change the sequence of device start, Michael S. Tsirkin, 2022/11/05
- Re: [PULL v2 31/82] vhost: Change the sequence of device start, Christian A. Ehrhardt, 2022/11/06
- Re: [PULL v2 31/82] vhost: Change the sequence of device start, Michael S. Tsirkin, 2022/11/07
- Re: [PULL v2 31/82] vhost: Change the sequence of device start, Christian A. Ehrhardt, 2022/11/07
- Re: [PULL v2 31/82] vhost: Change the sequence of device start, Michael S. Tsirkin, 2022/11/07
[PULL v2 34/82] virtio: re-order vm_running and use_started checks,
Michael S. Tsirkin <=
[PULL v2 35/82] virtio: introduce __virtio_queue_reset(), Michael S. Tsirkin, 2022/11/02
[PULL v2 33/82] hw/virtio/virtio-iommu-pci: Enforce the device is plugged on the root bus, Michael S. Tsirkin, 2022/11/02
[PULL v2 37/82] virtio: introduce virtio_queue_enable(), Michael S. Tsirkin, 2022/11/02
[PULL v2 38/82] virtio: core: vq reset feature negotation support, Michael S. Tsirkin, 2022/11/02
[PULL v2 36/82] virtio: introduce virtio_queue_reset(), Michael S. Tsirkin, 2022/11/02
[PULL v2 40/82] virtio-pci: support queue enable, Michael S. Tsirkin, 2022/11/02
[PULL v2 42/82] vhost: expose vhost_virtqueue_stop(), Michael S. Tsirkin, 2022/11/02
[PULL v2 39/82] virtio-pci: support queue reset, Michael S. Tsirkin, 2022/11/02
[PULL v2 41/82] vhost: expose vhost_virtqueue_start(), Michael S. Tsirkin, 2022/11/02
[PULL v2 43/82] vhost-net: vhost-kernel: introduce vhost_net_virtqueue_reset(), Michael S. Tsirkin, 2022/11/02