mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
hw/virtio: introduce virtio_device_should_start
The previous fix to virtio_device_started revealed a problem in its
use by both the core and the device code. The core code should be able
to handle the device "starting" while the VM isn't running to handle
the restoration of migration state. To solve this duel use introduce a
new helper for use by the vhost-user backends who all use it to feed a
should_start variable.
We can also pick up a change vhost_user_blk_set_status while we are at
it which follows the same pattern.
Fixes: 9f6bcfd99f
(hw/virtio: move vm_running check to virtio_device_started)
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Message-Id: <20221107121407.1010913-1-alex.bennee@linaro.org>
This commit is contained in:
parent
b22fbc5bcb
commit
259d69c00b
8 changed files with 25 additions and 11 deletions
|
@ -90,7 +90,7 @@ static void vu_rng_stop(VirtIODevice *vdev)
|
|||
static void vu_rng_set_status(VirtIODevice *vdev, uint8_t status)
|
||||
{
|
||||
VHostUserRNG *rng = VHOST_USER_RNG(vdev);
|
||||
bool should_start = virtio_device_started(vdev, status);
|
||||
bool should_start = virtio_device_should_start(vdev, status);
|
||||
|
||||
if (vhost_dev_is_started(&rng->vhost_dev) == should_start) {
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue