mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
virtio: add "use-started" property
In order to avoid migration issues, we introduce a "use-started" property to the base virtio device to indicate whether use "started" flag or not. This property will be true by default and set to false when machine type <= 4.0. Suggested-by: Greg Kurz <groug@kaod.org> Signed-off-by: Xie Yongji <xieyongji@baidu.com> Message-Id: <20190626023130.31315-2-xieyongji@baidu.com> Reviewed-by: Greg Kurz <groug@kaod.org> Tested-by: Greg Kurz <groug@kaod.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
683c1d89ef
commit
e57f2c31b6
4 changed files with 31 additions and 13 deletions
|
@ -105,6 +105,7 @@ struct VirtIODevice
|
|||
uint16_t device_id;
|
||||
bool vm_running;
|
||||
bool broken; /* device in invalid state, needs reset */
|
||||
bool use_started;
|
||||
bool started;
|
||||
bool start_on_kick; /* virtio 1.0 transitional devices support that */
|
||||
VMChangeStateEntry *vmstate;
|
||||
|
@ -351,4 +352,24 @@ static inline bool virtio_is_big_endian(VirtIODevice *vdev)
|
|||
/* Devices conforming to VIRTIO 1.0 or later are always LE. */
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool virtio_device_started(VirtIODevice *vdev, uint8_t status)
|
||||
{
|
||||
if (vdev->use_started) {
|
||||
return vdev->started;
|
||||
}
|
||||
|
||||
return status & VIRTIO_CONFIG_S_DRIVER_OK;
|
||||
}
|
||||
|
||||
static inline void virtio_set_started(VirtIODevice *vdev, bool started)
|
||||
{
|
||||
if (started) {
|
||||
vdev->start_on_kick = false;
|
||||
}
|
||||
|
||||
if (vdev->use_started) {
|
||||
vdev->started = started;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue