qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 01/12] integratorcp: adding vmstate for save/


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v2 01/12] integratorcp: adding vmstate for save/restore
Date: Mon, 1 Sep 2014 18:03:49 +0100

On 28 August 2014 12:18, Pavel Dovgalyuk <address@hidden> wrote:
> VMState added by this patch preserves correct
> loading of the integratorcp device state.
>
> Signed-off-by: Pavel Dovgalyuk <address@hidden>
> ---
>  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



reply via email to

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