qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
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
Subject: Re: [Qemu-devel] [RFC PATCH v3 04/49] fdc: adding vmstate for save/restore
Date: Fri, 1 Aug 2014 16:43:30 +0100	[thread overview]
Message-ID: <20140801154329.GA14305@work-vm> (raw)
In-Reply-To: <20140731125350.1600.55672.stgit@PASHA-ISP.novsu.ac.ru>

* 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 <pavel.dovgaluk@ispras.ru>
> ---
>  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

  parent reply	other threads:[~2014-08-01 15:43 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-31 12:53 [Qemu-devel] [RFC PATCH v3 00/49] Deterministic replay and reverse execution Pavel Dovgalyuk
2014-07-31 12:53 ` [Qemu-devel] [RFC PATCH v3 01/49] acpi: accurate overflow check Pavel Dovgalyuk
2014-07-31 12:53 ` [Qemu-devel] [RFC PATCH v3 02/49] integratorcp: adding vmstate for save/restore Pavel Dovgalyuk
2014-07-31 12:53 ` [Qemu-devel] [RFC PATCH v3 03/49] pcspk: " Pavel Dovgalyuk
2014-07-31 12:53 ` [Qemu-devel] [RFC PATCH v3 04/49] fdc: " Pavel Dovgalyuk
2014-07-31 12:58   ` Paolo Bonzini
2014-08-01 15:43   ` Dr. David Alan Gilbert [this message]
2014-07-31 12:53 ` [Qemu-devel] [RFC PATCH v3 05/49] parallel: " Pavel Dovgalyuk
2014-07-31 12:54 ` [Qemu-devel] [RFC PATCH v3 06/49] serial: fixing " Pavel Dovgalyuk
2014-07-31 13:00   ` Paolo Bonzini
2014-07-31 12:54 ` [Qemu-devel] [RFC PATCH v3 07/49] kvmapic: fixing loading vmstate Pavel Dovgalyuk
2014-07-31 13:01   ` Paolo Bonzini
2014-07-31 12:54 ` [Qemu-devel] [RFC PATCH v3 08/49] hpet: fixing saving and loading process Pavel Dovgalyuk
2014-07-31 12:54 ` [Qemu-devel] [RFC PATCH v3 09/49] pckbd: adding new fields to vmstate Pavel Dovgalyuk
2014-07-31 13:03   ` Paolo Bonzini
2014-07-31 12:54 ` [Qemu-devel] [RFC PATCH v3 10/49] rtl8139: " Pavel Dovgalyuk
2014-07-31 14:14   ` Paolo Bonzini
2014-07-31 12:54 ` [Qemu-devel] [RFC PATCH v3 11/49] piix: do not raise irq while loading vmstate Pavel Dovgalyuk
2014-07-31 12:54 ` [Qemu-devel] [RFC PATCH v3 12/49] mc146818rtc: add missed field to vmstate Pavel Dovgalyuk
2014-07-31 14:15   ` Paolo Bonzini
2014-07-31 12:54 ` [Qemu-devel] [RFC PATCH v3 13/49] pl031: " Pavel Dovgalyuk
2014-07-31 12:54 ` [Qemu-devel] [RFC PATCH v3 14/49] ide pci: reset status field before loading the vmstate Pavel Dovgalyuk
2014-07-31 12:54 ` [Qemu-devel] [RFC PATCH v3 15/49] softmmu: fixing usage of cpu_st/ld* from helpers Pavel Dovgalyuk
2014-07-31 16:07   ` Alex Bennée
2014-08-26  8:00     ` Pavel Dovgaluk
2014-07-31 12:54 ` [Qemu-devel] [RFC PATCH v3 16/49] target-i386: update fp status fix Pavel Dovgalyuk
2014-07-31 16:12   ` Alex Bennée
2014-07-31 12:55 ` [Qemu-devel] [RFC PATCH v3 17/49] migration: add vmstate for int8 and char arrays Pavel Dovgalyuk
2014-07-31 12:55 ` [Qemu-devel] [RFC PATCH v3 18/49] replay: global variables and function stubs Pavel Dovgalyuk
2014-07-31 12:55 ` [Qemu-devel] [RFC PATCH v3 19/49] block: add suffix parameter to bdrv_open functions Pavel Dovgalyuk
2014-07-31 12:55 ` [Qemu-devel] [RFC PATCH v3 20/49] sysemu: system functions for replay Pavel Dovgalyuk
2014-07-31 12:55 ` [Qemu-devel] [RFC PATCH v3 21/49] replay: internal functions for replay log Pavel Dovgalyuk
2014-07-31 12:55 ` [Qemu-devel] [RFC PATCH v3 22/49] cpu: invent instruction count for accurate replay Pavel Dovgalyuk
2014-07-31 16:17   ` Alex Bennée
2014-07-31 12:55 ` [Qemu-devel] [RFC PATCH v3 23/49] target-arm: instructions counting code for replay Pavel Dovgalyuk
2014-07-31 12:55 ` [Qemu-devel] [RFC PATCH v3 24/49] target-i386: " Pavel Dovgalyuk
2014-07-31 12:55 ` [Qemu-devel] [RFC PATCH v3 25/49] replay: interrupts and exceptions Pavel Dovgalyuk
2014-07-31 12:55 ` [Qemu-devel] [RFC PATCH v3 26/49] vga: do not use virtual clock for blinking cursor Pavel Dovgalyuk
2014-07-31 12:56 ` [Qemu-devel] [RFC PATCH v3 27/49] replay: asynchronous events infrastructure Pavel Dovgalyuk
2014-07-31 12:56 ` [Qemu-devel] [RFC PATCH v3 28/49] replay: recording and replaying clock ticks Pavel Dovgalyuk
2014-07-31 12:56 ` [Qemu-devel] [RFC PATCH v3 29/49] replay: recording and replaying different timers Pavel Dovgalyuk
2014-07-31 12:56 ` [Qemu-devel] [RFC PATCH v3 30/49] replay: shutdown event Pavel Dovgalyuk
2014-07-31 12:56 ` [Qemu-devel] [RFC PATCH v3 31/49] replay: checkpoints Pavel Dovgalyuk
2014-07-31 12:56 ` [Qemu-devel] [RFC PATCH v3 32/49] vmclock: add virtual clock based on replay icount Pavel Dovgalyuk
2014-07-31 12:56 ` [Qemu-devel] [RFC PATCH v3 33/49] replay: bottom halves Pavel Dovgalyuk
2014-07-31 12:56 ` [Qemu-devel] [RFC PATCH v3 34/49] replay: replay aio requests Pavel Dovgalyuk
2014-07-31 12:56 ` [Qemu-devel] [RFC PATCH v3 35/49] replay: thread pool Pavel Dovgalyuk
2014-07-31 12:56 ` [Qemu-devel] [RFC PATCH v3 36/49] pl031: vmstate in replay mode Pavel Dovgalyuk
2014-07-31 12:56 ` [Qemu-devel] [RFC PATCH v3 37/49] replay: initialization and deinitialization Pavel Dovgalyuk
2014-07-31 12:57 ` [Qemu-devel] [RFC PATCH v3 38/49] replay: command line options Pavel Dovgalyuk
2014-07-31 12:57 ` [Qemu-devel] [RFC PATCH v3 39/49] replay: snapshotting the virtual machine Pavel Dovgalyuk
2014-07-31 12:57 ` [Qemu-devel] [RFC PATCH v3 40/49] replay: recording of the user input Pavel Dovgalyuk
2014-07-31 12:57 ` [Qemu-devel] [RFC PATCH v3 41/49] tap-win32: destroy the thread at exit Pavel Dovgalyuk
2014-07-31 12:57 ` [Qemu-devel] [RFC PATCH v3 42/49] replay: network packets record/replay Pavel Dovgalyuk
2014-07-31 12:57 ` [Qemu-devel] [RFC PATCH v3 43/49] replay: audio data record/replay Pavel Dovgalyuk
2014-07-31 12:57 ` [Qemu-devel] [RFC PATCH v3 44/49] replay: serial port Pavel Dovgalyuk
2014-07-31 12:57 ` [Qemu-devel] [RFC PATCH v3 45/49] replay: USB passthrough Pavel Dovgalyuk
2014-07-31 12:57 ` [Qemu-devel] [RFC PATCH v3 46/49] replay: replay_info command Pavel Dovgalyuk
2014-07-31 12:57 ` [Qemu-devel] [RFC PATCH v3 47/49] replay: replay_break command Pavel Dovgalyuk
2014-07-31 12:57 ` [Qemu-devel] [RFC PATCH v3 48/49] replay: replay_seek_step command Pavel Dovgalyuk
2014-07-31 12:58 ` [Qemu-devel] [RFC PATCH v3 49/49] gdbstub: reverse debugging Pavel Dovgalyuk
2014-07-31 13:08   ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140801154329.GA14305@work-vm \
    --to=dgilbert@redhat.com \
    --cc=Pavel.Dovgaluk@ispras.ru \
    --cc=afaerber@suse.de \
    --cc=batuzovk@ispras.ru \
    --cc=fred.konrad@greensocs.com \
    --cc=maria.klimushenkova@ispras.ru \
    --cc=mark.burton@greensocs.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=real@ispras.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).