aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio/virtio.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2019-10-11 15:58:03 +0200
committerJason Wang <jasowang@redhat.com>2019-10-29 10:28:07 +0800
commit1dd713837cac8ec5a97d3b8492d72ce5ac94803c (patch)
tree807a8d973bbb2e93f2caa1b5951381c9318007a3 /hw/virtio/virtio.c
parent34ea023d4b959f35be8771470483c57dbbe2447d (diff)
downloadqemu-1dd713837cac8ec5a97d3b8492d72ce5ac94803c.zip
qemu-1dd713837cac8ec5a97d3b8492d72ce5ac94803c.tar.gz
qemu-1dd713837cac8ec5a97d3b8492d72ce5ac94803c.tar.bz2
virtio: new post_load hook
Post load hook in virtio vmsd is called early while device is processed, and when VirtIODevice core isn't fully initialized. Most device specific code isn't ready to deal with a device in such state, and behaves weirdly. Add a new post_load hook in a device class instead. Devices should use this unless they specifically want to verify the migration stream as it's processed, e.g. for bounds checking. Cc: qemu-stable@nongnu.org Suggested-by: "Dr. David Alan Gilbert" <dgilbert@redhat.com> Cc: Mikhail Sennikovsky <mikhail.sennikovskii@cloud.ionos.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'hw/virtio/virtio.c')
-rw-r--r--hw/virtio/virtio.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 527df03..54a46e2 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -2291,6 +2291,13 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)
}
rcu_read_unlock();
+ if (vdc->post_load) {
+ ret = vdc->post_load(vdev);
+ if (ret) {
+ return ret;
+ }
+ }
+
return 0;
}