From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XDEzn-0004RE-3a for qemu-devel@nongnu.org; Fri, 01 Aug 2014 11:43:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XDEzh-0002KK-L0 for qemu-devel@nongnu.org; Fri, 01 Aug 2014 11:43:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8821) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XDEzh-0002Jx-D2 for qemu-devel@nongnu.org; Fri, 01 Aug 2014 11:43:45 -0400 Date: Fri, 1 Aug 2014 16:43:30 +0100 From: "Dr. David Alan Gilbert" Message-ID: <20140801154329.GA14305@work-vm> References: <20140731125321.1600.46604.stgit@PASHA-ISP.novsu.ac.ru> <20140731125350.1600.55672.stgit@PASHA-ISP.novsu.ac.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140731125350.1600.55672.stgit@PASHA-ISP.novsu.ac.ru> Subject: Re: [Qemu-devel] [RFC PATCH v3 04/49] fdc: adding vmstate for save/restore List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Dovgalyuk Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, mark.burton@greensocs.com, qemu-devel@nongnu.org, batuzovk@ispras.ru, maria.klimushenkova@ispras.ru, real@ispras.ru, pbonzini@redhat.com, afaerber@suse.de, fred.konrad@greensocs.com * Pavel Dovgalyuk (Pavel.Dovgaluk@ispras.ru) wrote: > VMState added by this patch preserves correct > loading of the FDC device state. This is a pretty big series, but I suspect most people don't need most of these devices, especially for replay/reverse execution stuff. Why don't you boil this down to a much smaller basic set that's enough to get replay/reverse execution stuff on a simple setup; and then once people have got it going add more of the devices in. (Even if reading about floppy perpendicular mode is kind of fun for a Friday afternoon). Dave > > Signed-off-by: Pavel Dovgalyuk > --- > hw/block/fdc.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- > 1 files changed, 83 insertions(+), 2 deletions(-) > > diff --git a/hw/block/fdc.c b/hw/block/fdc.c > index 490d127..7305f75 100644 > --- a/hw/block/fdc.c > +++ b/hw/block/fdc.c > @@ -695,10 +695,34 @@ static const VMStateDescription vmstate_fdrive_media_rate = { > } > }; > > +static bool fdrive_perpendicular_needed(void *opaque) > +{ > + FDrive *drive = opaque; > + > + return drive->perpendicular != 0; > +} > + > +static const VMStateDescription vmstate_fdrive_perpendicular = { > + .name = "fdrive/perpendicular", > + .version_id = 1, > + .minimum_version_id = 1, > + .fields = (VMStateField[]) { > + VMSTATE_UINT8(perpendicular, FDrive), > + VMSTATE_END_OF_LIST() > + } > +}; > + > +static int fdrive_post_load(void *opaque, int version_id) > +{ > + fd_revalidate(opaque); > + return 0; > +} > + > static const VMStateDescription vmstate_fdrive = { > .name = "fdrive", > - .version_id = 1, > + .version_id = 2, > .minimum_version_id = 1, > + .post_load = fdrive_post_load, > .fields = (VMStateField[]) { > VMSTATE_UINT8(head, FDrive), > VMSTATE_UINT8(track, FDrive), > @@ -713,6 +737,9 @@ static const VMStateDescription vmstate_fdrive = { > .vmsd = &vmstate_fdrive_media_rate, > .needed = &fdrive_media_rate_needed, > } , { > + .vmsd = &vmstate_fdrive_perpendicular, > + .needed = &fdrive_perpendicular_needed, > + } , { > /* empty */ > } > } > @@ -725,6 +752,14 @@ static void fdc_pre_save(void *opaque) > s->dor_vmstate = s->dor | GET_CUR_DRV(s); > } > > +static int fdc_pre_load(void *opaque) > +{ > + FDCtrl *s = opaque; > + s->reset_sensei = 0; > + timer_del(s->result_timer); > + return 0; > +} > + > static int fdc_post_load(void *opaque, int version_id) > { > FDCtrl *s = opaque; > @@ -734,11 +769,46 @@ static int fdc_post_load(void *opaque, int version_id) > return 0; > } > > +static bool fdc_reset_sensei_needed(void *opaque) > +{ > + FDCtrl *s = opaque; > + > + return s->reset_sensei != 0; > +} > + > +static const VMStateDescription vmstate_fdc_reset_sensei = { > + .name = "fdc/reset_sensei", > + .version_id = 1, > + .minimum_version_id = 1, > + .fields = (VMStateField[]) { > + VMSTATE_INT32(reset_sensei, FDCtrl), > + VMSTATE_END_OF_LIST() > + } > +}; > + > +static bool fdc_result_timer_needed(void *opaque) > +{ > + FDCtrl *s = opaque; > + > + return timer_pending(s->result_timer); > +} > + > +static const VMStateDescription vmstate_fdc_result_timer = { > + .name = "fdc/result_timer", > + .version_id = 1, > + .minimum_version_id = 1, > + .fields = (VMStateField[]) { > + VMSTATE_TIMER(result_timer, FDCtrl), > + VMSTATE_END_OF_LIST() > + } > +}; > + > static const VMStateDescription vmstate_fdc = { > .name = "fdc", > - .version_id = 2, > + .version_id = 3, > .minimum_version_id = 2, > .pre_save = fdc_pre_save, > + .pre_load = fdc_pre_load, > .post_load = fdc_post_load, > .fields = (VMStateField[]) { > /* Controller State */ > @@ -770,6 +840,17 @@ static const VMStateDescription vmstate_fdc = { > VMSTATE_STRUCT_ARRAY(drives, FDCtrl, MAX_FD, 1, > vmstate_fdrive, FDrive), > VMSTATE_END_OF_LIST() > + }, > + .subsections = (VMStateSubsection[]) { > + { > + .vmsd = &vmstate_fdc_reset_sensei, > + .needed = fdc_reset_sensei_needed, > + } , { > + .vmsd = &vmstate_fdc_result_timer, > + .needed = fdc_result_timer_needed, > + } , { > + /* empty */ > + } > } > }; > > > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK