From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:47521) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGBay-0004xb-QX for qemu-devel@nongnu.org; Tue, 18 Oct 2011 11:28:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RGBax-0007mJ-0K for qemu-devel@nongnu.org; Tue, 18 Oct 2011 11:28:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52933) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGBaw-0007m4-Ml for qemu-devel@nongnu.org; Tue, 18 Oct 2011 11:28:46 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9IFSk7G002141 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 18 Oct 2011 11:28:46 -0400 From: Alon Levy Date: Tue, 18 Oct 2011 17:26:07 +0200 Message-Id: <1318951567-12418-2-git-send-email-alevy@redhat.com> In-Reply-To: <1318951567-12418-1-git-send-email-alevy@redhat.com> References: <1318951567-12418-1-git-send-email-alevy@redhat.com> Subject: [Qemu-devel] [PATCH 2/2] qxl: migrate delta in memslot List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: yhalperi@redhat.com, kraxel@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 --- 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