From patchwork Tue Aug 2 23:08:36 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 108007 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id DC4DEB71D4 for ; Wed, 3 Aug 2011 09:08:49 +1000 (EST) Received: from localhost ([::1]:33054 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QoO4s-0000sY-Hu for incoming@patchwork.ozlabs.org; Tue, 02 Aug 2011 19:08:46 -0400 Received: from eggs.gnu.org ([140.186.70.92]:34138) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QoO4n-0000rw-4L for qemu-devel@nongnu.org; Tue, 02 Aug 2011 19:08:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QoO4l-0002tj-S9 for qemu-devel@nongnu.org; Tue, 02 Aug 2011 19:08:41 -0400 Received: from e32.co.us.ibm.com ([32.97.110.150]:35590) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QoO4l-0002td-FA for qemu-devel@nongnu.org; Tue, 02 Aug 2011 19:08:39 -0400 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e32.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id p72LwchF031911 for ; Tue, 2 Aug 2011 15:58:38 -0600 Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id p72N8bR5191368 for ; Tue, 2 Aug 2011 17:08:38 -0600 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p72H8a5b003713 for ; Tue, 2 Aug 2011 11:08:37 -0600 Received: from titi.austin.rr.com (sig-9-65-42-179.mts.ibm.com [9.65.42.179]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p72H8a44003684; Tue, 2 Aug 2011 11:08:36 -0600 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Tue, 2 Aug 2011 18:08:36 -0500 Message-Id: <1312326516-10117-1-git-send-email-aliguori@us.ibm.com> X-Mailer: git-send-email 1.7.4.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 32.97.110.150 Cc: Paolo Bonzini , Anthony Liguori , Juan Quintela Subject: [Qemu-devel] [PATCH] migration: remove subsections in fdc and rtl8139 and bump versions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org As Paolo points out, the migration protocol is ambiguous when using subsections today. That means that even if we preserve subsections and change the protocol accordingly, the old protocol w/subsections is still ambiguous. Remove subsection usage and bump any device using subsections. This effectively eliminates the amiguouity and allows for a clean transition to a new protocol with unambiguous subsections. Signed-off-by: Anthony Liguori --- hw/fdc.c | 37 ++++++------------------------------- hw/rtl8139.c | 34 +++------------------------------- 2 files changed, 9 insertions(+), 62 deletions(-) diff --git a/hw/fdc.c b/hw/fdc.c index edf0360..d8d74c9 100644 --- a/hw/fdc.c +++ b/hw/fdc.c @@ -554,45 +554,20 @@ static int fdrive_media_changed_post_load(void *opaque, int version_id) return 0; } -static bool fdrive_media_changed_needed(void *opaque) -{ - FDrive *drive = opaque; - - return (drive->bs != NULL && drive->bs->media_changed != 1); -} - -static const VMStateDescription vmstate_fdrive_media_changed = { - .name = "fdrive/media_changed", - .version_id = 1, - .minimum_version_id = 1, - .minimum_version_id_old = 1, - .pre_save = fdrive_media_changed_pre_save, - .post_load = fdrive_media_changed_post_load, - .fields = (VMStateField[]) { - VMSTATE_UINT8(media_changed, FDrive), - VMSTATE_END_OF_LIST() - } -}; - static const VMStateDescription vmstate_fdrive = { .name = "fdrive", - .version_id = 1, - .minimum_version_id = 1, - .minimum_version_id_old = 1, + .version_id = 2, + .minimum_version_id = 2, + .minimum_version_id_old = 2, + .pre_save = fdrive_media_changed_pre_save, + .post_load = fdrive_media_changed_post_load, .fields = (VMStateField[]) { VMSTATE_UINT8(head, FDrive), VMSTATE_UINT8(track, FDrive), VMSTATE_UINT8(sect, FDrive), + VMSTATE_UINT8(media_changed, FDrive), VMSTATE_END_OF_LIST() }, - .subsections = (VMStateSubsection[]) { - { - .vmsd = &vmstate_fdrive_media_changed, - .needed = &fdrive_media_changed_needed, - } , { - /* empty */ - } - } }; static void fdc_pre_save(void *opaque) diff --git a/hw/rtl8139.c b/hw/rtl8139.c index 5214b8c..11951f2 100644 --- a/hw/rtl8139.c +++ b/hw/rtl8139.c @@ -505,9 +505,6 @@ typedef struct RTL8139State { /* PCI interrupt timer */ QEMUTimer *timer; int64_t TimerExpire; - - /* Support migration to/from old versions */ - int rtl8139_mmio_io_addr_dummy; } RTL8139State; static void rtl8139_set_next_tctr_time(RTL8139State *s, int64_t current_time); @@ -3259,21 +3256,6 @@ static int rtl8139_post_load(void *opaque, int version_id) return 0; } -static bool rtl8139_hotplug_ready_needed(void *opaque) -{ - return qdev_machine_modified(); -} - -static const VMStateDescription vmstate_rtl8139_hotplug_ready ={ - .name = "rtl8139/hotplug_ready", - .version_id = 1, - .minimum_version_id = 1, - .minimum_version_id_old = 1, - .fields = (VMStateField []) { - VMSTATE_END_OF_LIST() - } -}; - static void rtl8139_pre_save(void *opaque) { RTL8139State* s = opaque; @@ -3283,14 +3265,13 @@ static void rtl8139_pre_save(void *opaque) rtl8139_set_next_tctr_time(s, current_time); s->TCTR = muldiv64(current_time - s->TCTR_base, PCI_FREQUENCY, get_ticks_per_sec()); - s->rtl8139_mmio_io_addr_dummy = s->rtl8139_mmio_io_addr; } static const VMStateDescription vmstate_rtl8139 = { .name = "rtl8139", - .version_id = 4, - .minimum_version_id = 3, - .minimum_version_id_old = 3, + .version_id = 5, + .minimum_version_id = 5, + .minimum_version_id_old = 5, .post_load = rtl8139_post_load, .pre_save = rtl8139_pre_save, .fields = (VMStateField []) { @@ -3336,7 +3317,6 @@ static const VMStateDescription vmstate_rtl8139 = { VMSTATE_UNUSED(4), VMSTATE_MACADDR(conf.macaddr, RTL8139State), - VMSTATE_INT32(rtl8139_mmio_io_addr_dummy, RTL8139State), VMSTATE_UINT32(currTxDesc, RTL8139State), VMSTATE_UINT32(currCPlusRxDesc, RTL8139State), @@ -3366,14 +3346,6 @@ static const VMStateDescription vmstate_rtl8139 = { VMSTATE_UINT32_V(cplus_enabled, RTL8139State, 4), VMSTATE_END_OF_LIST() }, - .subsections = (VMStateSubsection []) { - { - .vmsd = &vmstate_rtl8139_hotplug_ready, - .needed = rtl8139_hotplug_ready_needed, - }, { - /* empty */ - } - } }; /***********************************************************/