From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44397) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XBhWa-0004ae-Di for qemu-devel@nongnu.org; Mon, 28 Jul 2014 05:47:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XBhWU-0006Ap-IR for qemu-devel@nongnu.org; Mon, 28 Jul 2014 05:47:20 -0400 Received: from mail-wi0-x229.google.com ([2a00:1450:400c:c05::229]:34654) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XBhWU-0006Ah-AY for qemu-devel@nongnu.org; Mon, 28 Jul 2014 05:47:14 -0400 Received: by mail-wi0-f169.google.com with SMTP id n3so3974236wiv.2 for ; Mon, 28 Jul 2014 02:47:11 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <53D61C18.4020002@redhat.com> Date: Mon, 28 Jul 2014 11:47:04 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <20140717110153.8352.80175.stgit@PASHA-ISP> <20140717110222.8352.18258.stgit@PASHA-ISP> In-Reply-To: <20140717110222.8352.18258.stgit@PASHA-ISP> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH v2 04/49] fdc: adding vmstate for save/restore List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Dovgalyuk , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, mark.burton@greensocs.com, real@ispras.ru, batuzovk@ispras.ru, fred.konrad@greensocs.com Il 17/07/2014 13:02, Pavel Dovgalyuk ha scritto: > VMState added by this patch preserves correct > loading of the FDC device state. > > Signed-off-by: Pavel Dovgalyuk > --- > hw/block/fdc.c | 11 +++++++++-- > 1 files changed, 9 insertions(+), 2 deletions(-) > > diff --git a/hw/block/fdc.c b/hw/block/fdc.c > index 490d127..132310a 100644 > --- a/hw/block/fdc.c > +++ b/hw/block/fdc.c > @@ -697,12 +697,17 @@ static const VMStateDescription vmstate_fdrive_media_rate = { > > static const VMStateDescription vmstate_fdrive = { > .name = "fdrive", > - .version_id = 1, > + .version_id = 2, > .minimum_version_id = 1, > .fields = (VMStateField[]) { > VMSTATE_UINT8(head, FDrive), > VMSTATE_UINT8(track, FDrive), > VMSTATE_UINT8(sect, FDrive), > + VMSTATE_UINT8_V(last_sect, FDrive, 2), > + VMSTATE_UINT8_V(max_track, FDrive, 2), > + VMSTATE_UINT16_V(bps, FDrive, 2), > + VMSTATE_UINT8_V(ro, FDrive, 2), > + VMSTATE_UINT8_V(perpendicular, FDrive, 2), Perpendicular can be added to a subsection, migrated only if nonzero. The others can be reconstructed by calling fd_revalidate in vmstate_fdrive's post_load callback. > VMSTATE_END_OF_LIST() > }, > .subsections = (VMStateSubsection[]) { > @@ -736,7 +741,7 @@ static int fdc_post_load(void *opaque, int version_id) > > static const VMStateDescription vmstate_fdc = { > .name = "fdc", > - .version_id = 2, > + .version_id = 3, > .minimum_version_id = 2, > .pre_save = fdc_pre_save, > .post_load = fdc_post_load, > @@ -769,6 +774,8 @@ static const VMStateDescription vmstate_fdc = { > VMSTATE_UINT8_EQUAL(num_floppies, FDCtrl), > VMSTATE_STRUCT_ARRAY(drives, FDCtrl, MAX_FD, 1, > vmstate_fdrive, FDrive), > + VMSTATE_INT32_V(reset_sensei, FDCtrl, 3), Subsection, only migrated if nonzero. > + VMSTATE_TIMER_V(result_timer, FDCtrl, 3), Subsection, only migrated if pending. Paolo > VMSTATE_END_OF_LIST() > } > }; > > >