[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 17/41] virtio: split virtio_post_load() from virtio_
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 17/41] virtio: split virtio_post_load() from virtio_load() |
Date: |
Wed, 2 Dec 2009 13:04:15 +0100 |
Signed-off-by: Juan Quintela <address@hidden>
---
hw/virtio.c | 45 +++++++++++++++++++++++++++++----------------
1 files changed, 29 insertions(+), 16 deletions(-)
diff --git a/hw/virtio.c b/hw/virtio.c
index f549543..bb93e8c 100644
--- a/hw/virtio.c
+++ b/hw/virtio.c
@@ -656,6 +656,32 @@ void virtio_save(VirtIODevice *vdev, QEMUFile *f)
}
}
+static int virtio_post_load(void *opaque, int version_id)
+{
+ VirtIODevice *vdev = opaque;
+ int i, ret;
+
+ for (i = 0; i < vdev->num_pci_queues; i++) {
+ if (vdev->vq[i].pa) {
+ virtqueue_init(&vdev->vq[i]);
+ }
+ if (vdev->type == VIRTIO_PCI) {
+ if (!virtio_pci_msix_present(vdev->binding_opaque)) {
+ vdev->vq[i].vector = VIRTIO_NO_VECTOR;
+ }
+ if (vdev->vq[i].vector != VIRTIO_NO_VECTOR) {
+ ret = virtio_pci_msix_vector_use(vdev->binding_opaque,
+ vdev->vq[i].vector);
+ if (ret)
+ return ret;
+ }
+ }
+ }
+
+ virtio_notify_vector(vdev, VIRTIO_NO_VECTOR);
+ return 0;
+}
+
int virtio_load(VirtIODevice *vdev, QEMUFile *f)
{
int i, ret;
@@ -681,25 +707,12 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f)
vdev->vq[i].pa = qemu_get_be64(f);
qemu_get_be16s(f, &vdev->vq[i].last_avail_idx);
- if (vdev->vq[i].pa) {
- virtqueue_init(&vdev->vq[i]);
- }
- if (vdev->type == VIRTIO_PCI) {
- if (virtio_pci_msix_present(vdev->binding_opaque)) {
+ if (vdev->type == VIRTIO_PCI &&
+ virtio_pci_msix_present(vdev->binding_opaque)) {
qemu_get_be16s(f, &vdev->vq[i].vector);
- } else {
- vdev->vq[i].vector = VIRTIO_NO_VECTOR;
- }
- if (vdev->vq[i].vector != VIRTIO_NO_VECTOR) {
- ret = virtio_pci_msix_vector_use(vdev->binding_opaque,
- vdev->vq[i].vector);
- if (ret)
- return ret;
- }
}
}
-
- virtio_notify_vector(vdev, VIRTIO_NO_VECTOR);
+ virtio_post_load(vdev, 1);
return 0;
}
--
1.6.5.2
- [Qemu-devel] [PATCH 13/41] msix: msix_load/save are not needed anymore, (continued)
[Qemu-devel] [PATCH 16/41] virtio: Add num_pci_queues field, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 17/41] virtio: split virtio_post_load() from virtio_load(),
Juan Quintela <=
[Qemu-devel] [PATCH 18/41] virtio: change config_len type to int32_t, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 21/41] virtio: port to vmstate, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 19/41] virtio: use the right types for VirtQueue elements, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 20/41] virtio: abstract test for save/load values, Juan Quintela, 2009/12/02
[Qemu-devel] [PATCH 22/41] virtio-net: change tx_timer_active to uint32_t, Juan Quintela, 2009/12/02