qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: qemu-devel@nongnu.org
Cc: Anthony Liguori <aliguori@us.ibm.com>,
	Rusty Russell <rusty@rustcorp.com.au>,
	David Gibson <david@gibson.dropbear.id.au>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] [PATCH 4/4] virtio: bump migration version number
Date: Mon, 10 Dec 2012 08:29:50 -0600	[thread overview]
Message-ID: <1355149790-8125-5-git-send-email-aliguori@us.ibm.com> (raw)
In-Reply-To: <1355149790-8125-1-git-send-email-aliguori@us.ibm.com>

And disable migration on big endian hosts from older versions where
endianness of the device state was ambiguous on the wire.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 hw/virtio-blk.c        | 13 +++++++++++--
 hw/virtio-serial-bus.c |  9 +++++++--
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index 7ab174f..837a709 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -566,8 +566,17 @@ static int virtio_blk_load(QEMUFile *f, void *opaque, int version_id)
     VirtIOBlock *s = opaque;
     int ret;
 
-    if (version_id != 2)
+#ifdef HOST_WORDS_BIGENDIAN
+    /* Because of the use of native endianness, we can't reliably handle
+     * migration below this version on big endian hosts. */
+    if (version < 3) {
         return -EINVAL;
+    }
+#endif
+
+    if (version_id < 2) {
+        return -EINVAL;
+    }
 
     ret = virtio_load(&s->vdev, f);
     if (ret) {
@@ -633,7 +642,7 @@ VirtIODevice *virtio_blk_init(DeviceState *dev, VirtIOBlkConf *blk)
 
     qemu_add_vm_change_state_handler(virtio_blk_dma_restart_cb, s);
     s->qdev = dev;
-    register_savevm(dev, "virtio-blk", virtio_blk_id++, 2,
+    register_savevm(dev, "virtio-blk", virtio_blk_id++, 3,
                     virtio_blk_save, virtio_blk_load, s);
     bdrv_set_dev_ops(s->bs, &virtio_block_ops, s);
     bdrv_set_buffer_alignment(s->bs, s->conf->logical_block_size);
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index aa1ded0..6aa3b85 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -665,9 +665,14 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
     unsigned int i;
     int ret;
 
-    if (version_id > 3) {
+#ifdef HOST_WORDS_BIGENDIAN
+    /* Because of the use of native endianness, we can't reliably handle
+     * migration below this version on big endian hosts. */
+
+    if (version_id < 4) {
         return -EINVAL;
     }
+#endif
 
     /* The virtio device */
     ret = virtio_load(&s->vdev, f);
@@ -987,7 +992,7 @@ VirtIODevice *virtio_serial_init(DeviceState *dev, virtio_serial_conf *conf)
      * Register for the savevm section with the virtio-console name
      * to preserve backward compat
      */
-    register_savevm(dev, "virtio-console", -1, 3, virtio_serial_save,
+    register_savevm(dev, "virtio-console", -1, 4, virtio_serial_save,
                     virtio_serial_load, vser);
 
     vser->post_load.timer = qemu_new_timer_ns(vm_clock,
-- 
1.8.0

  parent reply	other threads:[~2012-12-10 14:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-10 14:29 [Qemu-devel] [RFC 0/4] virtio: stabilize migration format Anthony Liguori
2012-12-10 14:29 ` [Qemu-devel] [PATCH 1/4] savevm: introduce little endian variants of savevm routines Anthony Liguori
2012-12-10 14:33   ` Peter Maydell
2012-12-10 15:24     ` Anthony Liguori
2012-12-10 14:29 ` [Qemu-devel] [PATCH 2/4] virtio: add wrapper for saving/restoring virtqueue elements Anthony Liguori
2012-12-14 11:46   ` Paolo Bonzini
2012-12-14 13:54     ` Anthony Liguori
2012-12-10 14:29 ` [Qemu-devel] [PATCH 3/4] virtio: modify savevm to have a stable wire format Anthony Liguori
2012-12-11  0:32   ` Rusty Russell
2012-12-11  0:54     ` Anthony Liguori
2012-12-14  0:57       ` Rusty Russell
2012-12-14 11:50         ` Paolo Bonzini
2012-12-14 13:59           ` Anthony Liguori
2012-12-10 14:29 ` Anthony Liguori [this message]
2012-12-11  9:02 ` [Qemu-devel] [RFC 0/4] virtio: stabilize migration format Stefan Hajnoczi

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=1355149790-8125-5-git-send-email-aliguori@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rusty@rustcorp.com.au \
    /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;
as well as URLs for NNTP newsgroup(s).