qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH v2 09/49] pckbd: adding new fields to vmstat


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [RFC PATCH v2 09/49] pckbd: adding new fields to vmstate
Date: Mon, 28 Jul 2014 11:36:31 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

Il 17/07/2014 13:02, Pavel Dovgalyuk ha scritto:
> This patch adds outport to VMState to allow correct saving and restoring
> the state of PC keyboard controller.
> 
> Signed-off-by: Pavel Dovgalyuk <address@hidden>
> ---
>  hw/input/pckbd.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
> index ca1cffc..19f6658 100644
> --- a/hw/input/pckbd.c
> +++ b/hw/input/pckbd.c
> @@ -371,13 +371,14 @@ static void kbd_reset(void *opaque)
>  
>  static const VMStateDescription vmstate_kbd = {
>      .name = "pckbd",
> -    .version_id = 3,
> +    .version_id = 4,
>      .minimum_version_id = 3,
>      .fields = (VMStateField[]) {
>          VMSTATE_UINT8(write_cmd, KBDState),
>          VMSTATE_UINT8(status, KBDState),
>          VMSTATE_UINT8(mode, KBDState),
>          VMSTATE_UINT8(pending, KBDState),
> +        VMSTATE_UINT8_V(outport, KBDState, 4),
>          VMSTATE_END_OF_LIST()
>      }
>  };
> 
> 
> 

Again it would be nice to use a subsection.  You can use as the
"default" value

    KBD_OUT_RESET | KBD_OUT_A20
     | (kbd->status & KBD_STAT_OBF ? KBD_OUT_OBF : 0)
     | (kbd->status & KBD_STAT_MOUSE_OBF ? KBD_OUT_MOUSE_OBF : 0)

If the value of outport matches this, you need not write it.  It's not
trivial, but you could do it like this:

- needed: return false if outport doesn't have the value above

- subsection post_load: set kbd->outport_present = 1

- device post_load: reconstruct outport if kbd->outport_present == 0

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]