qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alon Levy <alevy@redhat.com>
To: qemu-devel@nongnu.org
Cc: yhalperi@redhat.com, kraxel@redhat.com
Subject: [Qemu-devel] [PATCH 2/2] qxl: migrate delta in memslot
Date: Tue, 18 Oct 2011 17:26:07 +0200	[thread overview]
Message-ID: <1318951567-12418-2-git-send-email-alevy@redhat.com> (raw)
In-Reply-To: <1318951567-12418-1-git-send-email-alevy@redhat.com>

Adds a subsection to do the migration. Doesn't update the version of
vmstate. Delta is required to recreate the mem slots if delta!=0, which
happens for a driver using QXL_IO_SET_MODE.

RHBZ: 740547

Signed-off-by: Alon Levy <alevy@redhat.com>
---
 hw/qxl.c |   30 ++++++++++++++++++++++++++++--
 1 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/hw/qxl.c b/hw/qxl.c
index 4e9f39f..e9ba731 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -911,9 +911,9 @@ static void qxl_add_memslot(PCIQXLDevice *d, uint32_t slot_id, uint64_t delta,
     guest_start = le64_to_cpu(d->guest_slots[slot_id].slot.mem_start);
     guest_end   = le64_to_cpu(d->guest_slots[slot_id].slot.mem_end);
 
-    dprint(d, 1, "%s: slot %d: guest phys 0x%" PRIx64 " - 0x%" PRIx64 "\n",
+    dprint(d, 1, "%s: slot %d: guest phys 0x%" PRIx64 " - 0x%" PRIx64 " delta 0x%"PRIx64"\n",
            __FUNCTION__, slot_id,
-           guest_start, guest_end);
+           guest_start, guest_end, delta);
 
     PANIC_ON(slot_id >= NUM_MEMSLOTS);
     PANIC_ON(guest_start > guest_end);
@@ -1731,6 +1731,24 @@ static int qxl_post_load(void *opaque, int version)
 
 #define QXL_SAVE_VERSION 21
 
+static bool qxl_memslot_delta_needed(void *opaque)
+{
+    struct guest_slots *s = opaque;
+
+    return s->delta != 0; /* 0 is the default state */
+}
+
+static VMStateDescription qxl_memslot_delta = {
+    .name               = "qxl-memslot-delta",
+    .version_id         = QXL_SAVE_VERSION,
+    .minimum_version_id = QXL_SAVE_VERSION,
+    .minimum_version_id_old = QXL_SAVE_VERSION,
+    .fields = (VMStateField[]) {
+        VMSTATE_UINT64(delta,          struct guest_slots),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 static VMStateDescription qxl_memslot = {
     .name               = "qxl-memslot",
     .version_id         = QXL_SAVE_VERSION,
@@ -1740,6 +1758,14 @@ static VMStateDescription qxl_memslot = {
         VMSTATE_UINT64(slot.mem_end,   struct guest_slots),
         VMSTATE_UINT32(active,         struct guest_slots),
         VMSTATE_END_OF_LIST()
+    },
+    .subsections = (VMStateSubsection []) {
+        {
+            .vmsd = &qxl_memslot_delta,
+            .needed = qxl_memslot_delta_needed,
+        }, {
+            /* empty */
+        }
     }
 };
 
-- 
1.7.6.4

  reply	other threads:[~2011-10-18 15:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-18 15:26 [Qemu-devel] [PATCH 1/2] qxl: create slots on post_load in any state Alon Levy
2011-10-18 15:26 ` Alon Levy [this message]
2011-10-19  8:28 ` Gerd Hoffmann
2011-10-19  9:55   ` Alon Levy

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=1318951567-12418-2-git-send-email-alevy@redhat.com \
    --to=alevy@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yhalperi@redhat.com \
    /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).