Fix virtio migration when the device is down If the guest did not initalize the pfn, don't use it
PATCH 1/1 Fix virtio migration when the device is down If the guest did not initalize the pfn, don't use it
repository: /home/dor/src/merge/kvm
branch: trunk
commit db89e8403773a68d4c0ac3d6813f19ec83cb7011
Author: Dor Laor <[email protected]> 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 <[email protected]>
qemu/hw/virtio.c +10 -0
@@ -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/