From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52969) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vr29L-00085G-7o for qemu-devel@nongnu.org; Thu, 12 Dec 2013 04:01:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vr29E-0005Mb-Uc for qemu-devel@nongnu.org; Thu, 12 Dec 2013 04:01:39 -0500 Received: from [222.73.24.84] (port=53828 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vr29E-0005KL-Ib for qemu-devel@nongnu.org; Thu, 12 Dec 2013 04:01:32 -0500 Message-ID: <52A97AF6.8070707@cn.fujitsu.com> Date: Thu, 12 Dec 2013 16:59:34 +0800 From: Li Guang MIME-Version: 1.0 References: <1386749341-9843-1-git-send-email-lig.fnst@cn.fujitsu.com> <1386749341-9843-2-git-send-email-lig.fnst@cn.fujitsu.com> In-Reply-To: <1386749341-9843-2-git-send-email-lig.fnst@cn.fujitsu.com> Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1; format=flowed Subject: Re: [Qemu-devel] [PATCH v11 1/5] vmstate: add VMSTATE_PTIMER_ARRAY List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: liguang Cc: Peter Maydell , Peter Crosthwaite , Juan Quintela , qemu-devel@nongnu.org, Stefan Hajnoczi , =?ISO-8859-1?Q?Andreas_F=E4rber?= ping ... this patch is not changed since v8, can it get some comments? Thanks! liguang wrote: > Signed-off-by: liguang > --- > include/migration/vmstate.h | 4 ++++ > savevm.c | 31 +++++++++++++++++++++++++++++++ > 2 files changed, 35 insertions(+), 0 deletions(-) > > diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h > index 9d09e60..f5d6e81 100644 > --- a/include/migration/vmstate.h > +++ b/include/migration/vmstate.h > @@ -165,6 +165,7 @@ extern const VMStateInfo vmstate_info_timer; > extern const VMStateInfo vmstate_info_buffer; > extern const VMStateInfo vmstate_info_unused_buffer; > extern const VMStateInfo vmstate_info_bitmap; > +extern const VMStateInfo vmstate_info_ptimer; > > #define type_check_2darray(t1,t2,n,m) ((t1(*)[n][m])0 - (t2*)0) > #define type_check_array(t1,t2,n) ((t1(*)[n])0 - (t2*)0) > @@ -613,6 +614,9 @@ extern const VMStateInfo vmstate_info_bitmap; > #define VMSTATE_TIMER_ARRAY(_f, _s, _n) \ > VMSTATE_ARRAY_OF_POINTER(_f, _s, _n, 0, vmstate_info_timer, QEMUTimer *) > > +#define VMSTATE_PTIMER_ARRAY(_f, _s, _n) \ > + VMSTATE_ARRAY_OF_POINTER(_f, _s, _n, 0, vmstate_info_ptimer, ptimer_state*) > + > #define VMSTATE_BOOL_ARRAY_V(_f, _s, _n, _v) \ > VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_bool, bool) > > diff --git a/savevm.c b/savevm.c > index 2f631d4..54dbb33 100644 > --- a/savevm.c > +++ b/savevm.c > @@ -30,6 +30,7 @@ > #include "monitor/monitor.h" > #include "sysemu/sysemu.h" > #include "qemu/timer.h" > +#include "hw/ptimer.h" > #include "audio/audio.h" > #include "migration/migration.h" > #include "qemu/sockets.h" > @@ -1362,6 +1363,36 @@ const VMStateInfo vmstate_info_timer = { > .put = put_timer, > }; > > +static int get_ptimer(QEMUFile *f, void *pv, size_t size) > +{ > + ptimer_state *v = pv; > + uint64_t count; > + > + count = qemu_get_be64(f); > + if (count != -1) { > + ptimer_set_count(v, count); > + } else { > + ptimer_stop(v); > + } > + > + return 0; > +} > + > +static void put_ptimer(QEMUFile *f, void *pv, size_t size) > +{ > + ptimer_state *v = pv; > + uint64_t count; > + > + count = ptimer_get_count(v); > + qemu_put_be64(f, count); > +} > + > +const VMStateInfo vmstate_info_ptimer = { > + .name = "ptimer", > + .get = get_ptimer, > + .put = put_ptimer, > +}; > + > /* uint8_t buffers */ > > static int get_buffer(QEMUFile *f, void *pv, size_t size) >