aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2009-06-21 19:50:40 +0300
committerAnthony Liguori <aliguori@us.ibm.com>2009-06-24 09:09:15 -0500
commitff24bd589c657ad82ae0f151c4906f120a91f6f3 (patch)
tree137df1a224d2de18b86bbdbb1bbc3311dcddb35a /hw/virtio.c
parentaba800a3ffdffd9484d458344bfea8886e9062d2 (diff)
downloadqemu-ff24bd589c657ad82ae0f151c4906f120a91f6f3.zip
qemu-ff24bd589c657ad82ae0f151c4906f120a91f6f3.tar.gz
qemu-ff24bd589c657ad82ae0f151c4906f120a91f6f3.tar.bz2
qemu/virtio: virtio save/load bindings
Implement bindings for virtio save/load. Use them in virtio pci. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/virtio.c')
-rw-r--r--hw/virtio.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/hw/virtio.c b/hw/virtio.c
index 1a80832..843be86 100644
--- a/hw/virtio.c
+++ b/hw/virtio.c
@@ -616,9 +616,8 @@ void virtio_save(VirtIODevice *vdev, QEMUFile *f)
{
int i;
- /* FIXME: load/save binding. */
- //pci_device_save(&vdev->pci_dev, f);
- //msix_save(&vdev->pci_dev, f);
+ if (vdev->binding->save_config)
+ vdev->binding->save_config(vdev->binding_opaque, f);
qemu_put_8s(f, &vdev->status);
qemu_put_8s(f, &vdev->isr);
@@ -644,18 +643,20 @@ void virtio_save(VirtIODevice *vdev, QEMUFile *f)
qemu_put_be32(f, vdev->vq[i].vring.num);
qemu_put_be64(f, vdev->vq[i].pa);
qemu_put_be16s(f, &vdev->vq[i].last_avail_idx);
- if (vdev->nvectors)
- qemu_put_be16s(f, &vdev->vq[i].vector);
+ if (vdev->binding->save_queue)
+ vdev->binding->save_queue(vdev->binding_opaque, i, f);
}
}
-void virtio_load(VirtIODevice *vdev, QEMUFile *f)
+int virtio_load(VirtIODevice *vdev, QEMUFile *f)
{
- int num, i;
+ int num, i, ret;
- /* FIXME: load/save binding. */
- //pci_device_load(&vdev->pci_dev, f);
- //r = msix_load(&vdev->pci_dev, f);
+ if (vdev->binding->load_config) {
+ ret = vdev->binding->load_config(vdev->binding_opaque, f);
+ if (ret)
+ return ret;
+ }
qemu_get_8s(f, &vdev->status);
qemu_get_8s(f, &vdev->isr);
@@ -664,10 +665,6 @@ void virtio_load(VirtIODevice *vdev, QEMUFile *f)
vdev->config_len = qemu_get_be32(f);
qemu_get_buffer(f, vdev->config, vdev->config_len);
- if (vdev->nvectors) {
- qemu_get_be16s(f, &vdev->config_vector);
- //msix_vector_use(&vdev->pci_dev, vdev->config_vector);
- }
num = qemu_get_be32(f);
for (i = 0; i < num; i++) {
@@ -678,13 +675,15 @@ void virtio_load(VirtIODevice *vdev, QEMUFile *f)
if (vdev->vq[i].pa) {
virtqueue_init(&vdev->vq[i]);
}
- if (vdev->nvectors) {
- qemu_get_be16s(f, &vdev->vq[i].vector);
- //msix_vector_use(&vdev->pci_dev, vdev->config_vector);
+ if (vdev->binding->load_queue) {
+ ret = vdev->binding->load_queue(vdev->binding_opaque, i, f);
+ if (ret)
+ return ret;
}
}
virtio_notify_vector(vdev, VIRTIO_NO_VECTOR);
+ return 0;
}
void virtio_cleanup(VirtIODevice *vdev)