From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42384) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XBhMP-0000CU-Je for qemu-devel@nongnu.org; Mon, 28 Jul 2014 05:36:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XBhMJ-0002pS-UJ for qemu-devel@nongnu.org; Mon, 28 Jul 2014 05:36:49 -0400 Received: from mail-wg0-x231.google.com ([2a00:1450:400c:c00::231]:34223) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XBhMJ-0002pO-N9 for qemu-devel@nongnu.org; Mon, 28 Jul 2014 05:36:43 -0400 Received: by mail-wg0-f49.google.com with SMTP id k14so7040141wgh.32 for ; Mon, 28 Jul 2014 02:36:42 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <53D6199F.9090708@redhat.com> Date: Mon, 28 Jul 2014 11:36:31 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <20140717110153.8352.80175.stgit@PASHA-ISP> <20140717110250.8352.81056.stgit@PASHA-ISP> In-Reply-To: <20140717110250.8352.81056.stgit@PASHA-ISP> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH v2 09/49] pckbd: adding new fields to vmstate 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: > This patch adds outport to VMState to allow correct saving and restoring > the state of PC keyboard controller. > > Signed-off-by: Pavel Dovgalyuk > --- > 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