From: Dor Laor <dor.laor@gmail.com>
To: kvm-devel <kvm-devel@lists.sourceforge.net>,
Anthony Liguori <aliguori@us.ibm.com>
Subject: [PATCH] Fix virtio migration when the device is down If the guest did not initalize the pfn, don't use it
Date: Tue, 04 Mar 2008 17:34:04 +0200 [thread overview]
Message-ID: <1204644844.19089.45.camel@localhost.localdomain> (raw)
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/
reply other threads:[~2008-03-04 15:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1204644844.19089.45.camel@localhost.localdomain \
--to=dor.laor@gmail.com \
--cc=aliguori@us.ibm.com \
--cc=dor.laor@qumranet.com \
--cc=kvm-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox