qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/2] qxl: migrate delta in memslot


From: Alon Levy
Subject: [Qemu-devel] [PATCH 2/2] qxl: migrate delta in memslot
Date: Tue, 18 Oct 2011 17:26:07 +0200

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 <address@hidden>
---
 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 via email to

[Prev in Thread] Current Thread [Next in Thread]