diff mbox

[v2,12/12] pl031: add missed field to vmstate

Message ID 20140828111930.1624.40704.stgit@PASHA-ISP
State New
Headers show

Commit Message

Pavel Dovgalyuk Aug. 28, 2014, 11:19 a.m. UTC
This patch adds timer which uses virtual clock to the VMState.
Such timers are required for saving because virtual clock is the part
of the virtual machine state.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
---
 hw/timer/pl031.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Comments

Peter Maydell Sept. 1, 2014, 4:59 p.m. UTC | #1
On 28 August 2014 12:19, Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru> wrote:
> This patch adds timer which uses virtual clock to the VMState.
> Such timers are required for saving because virtual clock is the part
> of the virtual machine state.
>
> Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
> ---
>  hw/timer/pl031.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/hw/timer/pl031.c b/hw/timer/pl031.c
> index 34d9b44..f8e5abc 100644
> --- a/hw/timer/pl031.c
> +++ b/hw/timer/pl031.c
> @@ -230,12 +230,13 @@ static int pl031_post_load(void *opaque, int version_id)
>
>  static const VMStateDescription vmstate_pl031 = {
>      .name = "pl031",
> -    .version_id = 1,
> +    .version_id = 2,
>      .minimum_version_id = 1,
>      .pre_save = pl031_pre_save,
>      .post_load = pl031_post_load,
>      .fields = (VMStateField[]) {
>          VMSTATE_UINT32(tick_offset_vmstate, PL031State),
> +        VMSTATE_TIMER_V(timer, PL031State, 2),
>          VMSTATE_UINT32(mr, PL031State),
>          VMSTATE_UINT32(lr, PL031State),
>          VMSTATE_UINT32(cr, PL031State),

Looking at the code I'm not sure this patch is required.
It looks like the intention is that the migrated state for
the timer is in the tick_offset_vmstate: we have a
pre-save hook that sets up that field, and then the post-load
hook calls pl031_set_alarm() which will always completely
reinitialise s->timer using timer_del() or timer_mod().
What am I missing?

thanks
-- PMM
Pavel Dovgalyuk Sept. 2, 2014, 9:53 a.m. UTC | #2
> From: Peter Maydell [mailto:peter.maydell@linaro.org]
> On 28 August 2014 12:19, Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru> wrote:
> > This patch adds timer which uses virtual clock to the VMState.
> > Such timers are required for saving because virtual clock is the part
> > of the virtual machine state.
> >
> > Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
> > ---
> >  hw/timer/pl031.c |    3 ++-
> >  1 files changed, 2 insertions(+), 1 deletions(-)
> >
> > diff --git a/hw/timer/pl031.c b/hw/timer/pl031.c
> > index 34d9b44..f8e5abc 100644
> > --- a/hw/timer/pl031.c
> > +++ b/hw/timer/pl031.c
> > @@ -230,12 +230,13 @@ static int pl031_post_load(void *opaque, int version_id)
> >
> >  static const VMStateDescription vmstate_pl031 = {
> >      .name = "pl031",
> > -    .version_id = 1,
> > +    .version_id = 2,
> >      .minimum_version_id = 1,
> >      .pre_save = pl031_pre_save,
> >      .post_load = pl031_post_load,
> >      .fields = (VMStateField[]) {
> >          VMSTATE_UINT32(tick_offset_vmstate, PL031State),
> > +        VMSTATE_TIMER_V(timer, PL031State, 2),
> >          VMSTATE_UINT32(mr, PL031State),
> >          VMSTATE_UINT32(lr, PL031State),
> >          VMSTATE_UINT32(cr, PL031State),
> 
> Looking at the code I'm not sure this patch is required.
> It looks like the intention is that the migrated state for
> the timer is in the tick_offset_vmstate: we have a
> pre-save hook that sets up that field, and then the post-load
> hook calls pl031_set_alarm() which will always completely
> reinitialise s->timer using timer_del() or timer_mod().
> What am I missing?

You are right, this is replay-specific patch, I'll remove it from this series.

Pavel Dovgalyuk
diff mbox

Patch

diff --git a/hw/timer/pl031.c b/hw/timer/pl031.c
index 34d9b44..f8e5abc 100644
--- a/hw/timer/pl031.c
+++ b/hw/timer/pl031.c
@@ -230,12 +230,13 @@  static int pl031_post_load(void *opaque, int version_id)
 
 static const VMStateDescription vmstate_pl031 = {
     .name = "pl031",
-    .version_id = 1,
+    .version_id = 2,
     .minimum_version_id = 1,
     .pre_save = pl031_pre_save,
     .post_load = pl031_post_load,
     .fields = (VMStateField[]) {
         VMSTATE_UINT32(tick_offset_vmstate, PL031State),
+        VMSTATE_TIMER_V(timer, PL031State, 2),
         VMSTATE_UINT32(mr, PL031State),
         VMSTATE_UINT32(lr, PL031State),
         VMSTATE_UINT32(cr, PL031State),