From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51025) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOV1j-0008HH-6N for qemu-devel@nongnu.org; Mon, 01 Sep 2014 13:04:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XOV1W-0004uT-Q4 for qemu-devel@nongnu.org; Mon, 01 Sep 2014 13:04:22 -0400 Received: from mail-la0-f41.google.com ([209.85.215.41]:50997) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOV1W-0004uC-J8 for qemu-devel@nongnu.org; Mon, 01 Sep 2014 13:04:10 -0400 Received: by mail-la0-f41.google.com with SMTP id gi9so6515625lab.28 for ; Mon, 01 Sep 2014 10:04:09 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20140828111829.1624.27181.stgit@PASHA-ISP> References: <20140828111822.1624.24556.stgit@PASHA-ISP> <20140828111829.1624.27181.stgit@PASHA-ISP> From: Peter Maydell Date: Mon, 1 Sep 2014 18:03:49 +0100 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH v2 01/12] integratorcp: adding vmstate for save/restore List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Dovgalyuk Cc: Paolo Bonzini , zealot351@gmail.com, maria.klimushenkova@ispras.ru, QEMU Developers On 28 August 2014 12:18, Pavel Dovgalyuk wrote: > VMState added by this patch preserves correct > loading of the integratorcp device state. > > Signed-off-by: Pavel Dovgalyuk > --- > hw/arm/integratorcp.c | 38 +++++++++++++++++++++++++++++++++++++- > 1 files changed, 37 insertions(+), 1 deletions(-) > > diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c > index 0e476c3..e5d5751 100644 > --- a/hw/arm/integratorcp.c > +++ b/hw/arm/integratorcp.c > @@ -42,6 +42,27 @@ typedef struct IntegratorCMState { > uint32_t fiq_enabled; > } IntegratorCMState; > > +static const VMStateDescription vmstate_integratorcm = { > + .name = "integratorcm", > + .version_id = 1, > + .minimum_version_id = 1, > + .minimum_version_id_old = 1, You don't need to specify minimum_version_id_old any more (if there's no load_state_old, and there usually isn't.) > + .fields = (VMStateField[]) { > + VMSTATE_UINT32(cm_osc, IntegratorCMState), > + VMSTATE_UINT32(cm_ctrl, IntegratorCMState), > + VMSTATE_UINT32(cm_lock, IntegratorCMState), > + VMSTATE_UINT32(cm_auxosc, IntegratorCMState), > + VMSTATE_UINT32(cm_sdram, IntegratorCMState), > + VMSTATE_UINT32(cm_init, IntegratorCMState), > + VMSTATE_UINT32(cm_flags, IntegratorCMState), > + VMSTATE_UINT32(cm_nvflags, IntegratorCMState), > + VMSTATE_UINT32(int_level, IntegratorCMState), > + VMSTATE_UINT32(irq_enabled, IntegratorCMState), > + VMSTATE_UINT32(fiq_enabled, IntegratorCMState), > + VMSTATE_END_OF_LIST() > + } > +}; > + > static uint8_t integrator_spd[128] = { > 128, 8, 4, 11, 9, 1, 64, 0, 2, 0xa0, 0xa0, 0, 0, 8, 0, 1, > 0xe, 4, 0x1c, 1, 2, 0x20, 0xc0, 0, 0, 0, 0, 0x30, 0x28, 0x30, 0x28, 0x40 > @@ -272,7 +293,7 @@ static int integratorcm_init(SysBusDevice *dev) > sysbus_init_mmio(dev, &s->iomem); > > integratorcm_do_remap(s); > - /* ??? Save/restore. */ > + vmstate_register(NULL, -1, &vmstate_integratorcm, s); No new uses of vmstate_register(), please. You want to set the dc->vmsd field in core_class_init(), I think. > return 0; > } > > @@ -296,6 +317,20 @@ typedef struct icp_pic_state { > qemu_irq parent_fiq; > } icp_pic_state; > > + > +static const VMStateDescription vmstate_icp_pic = { > + .name = "icp_pic_state", > + .version_id = 1, > + .minimum_version_id = 1, > + .minimum_version_id_old = 1, > + .fields = (VMStateField[]) { > + VMSTATE_UINT32(level, icp_pic_state), > + VMSTATE_UINT32(irq_enabled, icp_pic_state), > + VMSTATE_UINT32(fiq_enabled, icp_pic_state), > + VMSTATE_END_OF_LIST() > + } > +}; > + > static void icp_pic_update(icp_pic_state *s) > { > uint32_t flags; > @@ -399,6 +434,7 @@ static int icp_pic_init(SysBusDevice *sbd) > memory_region_init_io(&s->iomem, OBJECT(s), &icp_pic_ops, s, > "icp-pic", 0x00800000); > sysbus_init_mmio(sbd, &s->iomem); > + vmstate_register(NULL, -1, &vmstate_icp_pic, s); > return 0; > } Similar comments apply to this device. thanks -- PMM