mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-09-06 18:05:37 +00:00
hw/virtio: add started_vu status field to vhost-user-gpio
As per the fix to vhost-user-blk in f5b22d06fb
(vhost: recheck dev
state in the vhost_migration_log routine) we really should track the
connection and starting separately.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20221130112439.2527228-4-alex.bennee@linaro.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
4daa5054c5
commit
060f4a9440
|
@ -86,6 +86,7 @@ static int vu_gpio_start(VirtIODevice *vdev)
|
||||||
error_report("Error starting vhost-user-gpio: %d", ret);
|
error_report("Error starting vhost-user-gpio: %d", ret);
|
||||||
goto err_guest_notifiers;
|
goto err_guest_notifiers;
|
||||||
}
|
}
|
||||||
|
gpio->started_vu = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* guest_notifier_mask/pending not used yet, so just unmask
|
* guest_notifier_mask/pending not used yet, so just unmask
|
||||||
|
@ -126,16 +127,12 @@ static void vu_gpio_stop(VirtIODevice *vdev)
|
||||||
struct vhost_dev *vhost_dev = &gpio->vhost_dev;
|
struct vhost_dev *vhost_dev = &gpio->vhost_dev;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!k->set_guest_notifiers) {
|
if (!gpio->started_vu) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
gpio->started_vu = false;
|
||||||
|
|
||||||
/*
|
if (!k->set_guest_notifiers) {
|
||||||
* We can call vu_gpio_stop multiple times, for example from
|
|
||||||
* vm_state_notify and the final object finalisation. Check we
|
|
||||||
* aren't already stopped before doing so.
|
|
||||||
*/
|
|
||||||
if (!vhost_dev_is_started(vhost_dev)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,17 @@ struct VHostUserGPIO {
|
||||||
VhostUserState vhost_user;
|
VhostUserState vhost_user;
|
||||||
VirtQueue *command_vq;
|
VirtQueue *command_vq;
|
||||||
VirtQueue *interrupt_vq;
|
VirtQueue *interrupt_vq;
|
||||||
|
/**
|
||||||
|
* There are at least two steps of initialization of the
|
||||||
|
* vhost-user device. The first is a "connect" step and
|
||||||
|
* second is a "start" step. Make a separation between
|
||||||
|
* those initialization phases by using two fields.
|
||||||
|
*
|
||||||
|
* @connected: see vu_gpio_connect()/vu_gpio_disconnect()
|
||||||
|
* @started_vu: see vu_gpio_start()/vu_gpio_stop()
|
||||||
|
*/
|
||||||
bool connected;
|
bool connected;
|
||||||
|
bool started_vu;
|
||||||
/*< public >*/
|
/*< public >*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue