* [PATCH] Fix virtio migration when the device is down If the guest did not initalize the pfn, don't use it
@ 2008-03-04 15:34 Dor Laor
0 siblings, 0 replies; only message in thread
From: Dor Laor @ 2008-03-04 15:34 UTC (permalink / raw)
To: kvm-devel, Anthony Liguori
repository: /home/dor/src/merge/kvm
branch: trunk
commit db89e8403773a68d4c0ac3d6813f19ec83cb7011
Author: Dor Laor <dor.laor@qumranet.com>
Date: Tue Mar 4 08:14:37 2008 -0500
Fix virtio migration when the device is down
If the guest did not initalize the pfn, don't use it.
Signed-off-by: Dor Laor <dor.laor@qumranet.com>
diff --git a/qemu/hw/virtio.c b/qemu/hw/virtio.c
index 69fe810..1367af1 100644
--- a/qemu/hw/virtio.c
+++ b/qemu/hw/virtio.c
@@ -192,10 +192,15 @@ void virtio_dev_save(QEMUFile *f, VirtIODevice *vdev)
for(i = 0; i < VIRTIO_PCI_QUEUE_MAX; i++) {
if (!vdev->vq[i].vring.num)
continue;
+
qemu_put_be32s(f, &vdev->vq[i].pfn);
qemu_put_be16s(f, &vdev->vq[i].last_avail_idx);
qemu_put_be32s(f, &vdev->vq[i].index);
+ /* The guest does not have the driver active */
+ if (!vdev->vq[i].pfn)
+ continue;
+
/* Save the descriptor ring instead of constantly mark them dirty */
qemu_put_buffer(f, (uint8_t*)vdev->vq[i].vring.desc, vdev->vq[i].vring.num * sizeof(VRingDesc));
qemu_put_buffer(f, (uint8_t*)vdev->vq[i].vring.avail, TARGET_PAGE_SIZE);
@@ -220,9 +225,14 @@ int virtio_dev_load(QEMUFile *f, VirtIODevice *vdev, int version_id)
for(i = 0; i < VIRTIO_PCI_QUEUE_MAX; i++) {
if (!vdev->vq[i].vring.num)
continue;
+
qemu_get_be32s(f, &vdev->vq[i].pfn);
qemu_get_be16s(f, &vdev->vq[i].last_avail_idx);
qemu_get_be32s(f, &vdev->vq[i].index);
+ /* The guest does not have the driver active */
+ if (!vdev->vq[i].pfn)
+ continue;
+
virtqueue_init(&vdev->vq[i], phys_ram_base +
(vdev->vq[i].pfn << TARGET_PAGE_BITS));
qemu_get_buffer(f, (uint8_t*)vdev->vq[i].vring.desc, vdev->vq[i].vring.num * sizeof(VRingDesc));
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2008-03-04 15:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-04 15:34 [PATCH] Fix virtio migration when the device is down If the guest did not initalize the pfn, don't use it Dor Laor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox