if (version_id != 2)
return -EINVAL;
- ret = virtio_load(vdev, f);
+ ret = virtio_load(vdev, f, version_id);
if (ret) {
return ret;
}
}
/* The virtio device */
- ret = virtio_load(VIRTIO_DEVICE(s), f);
+ ret = virtio_load(VIRTIO_DEVICE(s), f, version_id);
if (ret) {
return ret;
}
if (version_id < 2 || version_id > VIRTIO_NET_VM_VERSION)
return -EINVAL;
- ret = virtio_load(vdev, f);
+ ret = virtio_load(vdev, f, version_id);
if (ret) {
return ret;
}
VirtIODevice *vdev = VIRTIO_DEVICE(opaque);
int ret;
- ret = virtio_load(vdev, f);
+ ret = virtio_load(vdev, f, version_id);
if (ret) {
return ret;
}
if (version_id != 1)
return -EINVAL;
- ret = virtio_load(vdev, f);
+ ret = virtio_load(vdev, f, version_id);
if (ret) {
return ret;
}
if (version_id != 1) {
return -EINVAL;
}
- virtio_load(vdev, f);
+ virtio_load(vdev, f, version_id);
/* We may have an element ready but couldn't process it due to a quota
* limit. Make sure to try again after live migration when the quota may
{
BusState *qbus = qdev_get_parent_bus(DEVICE(vdev));
VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
+ VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev);
int i;
if (k->save_config) {
k->save_queue(qbus->parent, i, f);
}
}
+
+ if (vdc->save != NULL) {
+ vdc->save(vdev, f);
+ }
}
int virtio_set_features(VirtIODevice *vdev, uint32_t val)
return bad ? -1 : 0;
}
-int virtio_load(VirtIODevice *vdev, QEMUFile *f)
+int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)
{
int i, ret;
int32_t config_len;
uint32_t supported_features;
BusState *qbus = qdev_get_parent_bus(DEVICE(vdev));
VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
+ VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev);
if (k->load_config) {
ret = k->load_config(qbus->parent, f);
}
virtio_notify_vector(vdev, VIRTIO_NO_VECTOR);
+
+ if (vdc->load != NULL) {
+ return vdc->load(vdev, f, version_id);
+ }
+
return 0;
}
* must mask in frontend instead.
*/
void (*guest_notifier_mask)(VirtIODevice *vdev, int n, bool mask);
+ void (*save)(VirtIODevice *vdev, QEMUFile *f);
+ int (*load)(VirtIODevice *vdev, QEMUFile *f, int version_id);
} VirtioDeviceClass;
void virtio_init(VirtIODevice *vdev, const char *name,
void virtio_save(VirtIODevice *vdev, QEMUFile *f);
-int virtio_load(VirtIODevice *vdev, QEMUFile *f);
+int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id);
void virtio_notify_config(VirtIODevice *vdev);