From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33664) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMyKD-0003Gf-Q5 for qemu-devel@nongnu.org; Thu, 28 Aug 2014 07:57:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMyK8-00027p-Sv for qemu-devel@nongnu.org; Thu, 28 Aug 2014 07:57:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35473) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMyK8-00027e-L4 for qemu-devel@nongnu.org; Thu, 28 Aug 2014 07:57:04 -0400 Message-ID: <53FF1907.7040504@redhat.com> Date: Thu, 28 Aug 2014 13:56:55 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <20140828111822.1624.24556.stgit@PASHA-ISP> <20140828111835.1624.21791.stgit@PASHA-ISP> In-Reply-To: <20140828111835.1624.21791.stgit@PASHA-ISP> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 02/12] pcspk: adding vmstate for save/restore List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Dovgalyuk , qemu-devel@nongnu.org Cc: zealot351@gmail.com, maria.klimushenkova@ispras.ru Il 28/08/2014 13:18, Pavel Dovgalyuk ha scritto: > VMState added by this patch preserves correct > loading of the PC speaker device state. > > Signed-off-by: Pavel Dovgalyuk > --- > hw/audio/pcspk.c | 17 +++++++++++++++-- > 1 files changed, 15 insertions(+), 2 deletions(-) > > diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c > index 1d81bbe..1d58ef0 100644 > --- a/hw/audio/pcspk.c > +++ b/hw/audio/pcspk.c > @@ -50,8 +50,8 @@ typedef struct { > unsigned int pit_count; > unsigned int samples; > unsigned int play_pos; > - int data_on; > - int dummy_refresh_clock; > + uint8_t data_on; > + uint8_t dummy_refresh_clock; > } PCSpkState; > > static const char *s_spk = "pcspk"; > @@ -163,6 +163,18 @@ static const MemoryRegionOps pcspk_io_ops = { > }, > }; > > +static const VMStateDescription vmstate_spk = { > + .name = "pcspk", > + .version_id = 1, > + .minimum_version_id = 1, > + .minimum_version_id_old = 1, > + .fields = (VMStateField[]) { > + VMSTATE_UINT8(data_on, PCSpkState), > + VMSTATE_UINT8(dummy_refresh_clock, PCSpkState), > + VMSTATE_END_OF_LIST() > + } > +}; > + > static void pcspk_initfn(Object *obj) > { > PCSpkState *s = PC_SPEAKER(obj); > @@ -192,6 +204,7 @@ static void pcspk_class_initfn(ObjectClass *klass, void *data) > > dc->realize = pcspk_realizefn; > set_bit(DEVICE_CATEGORY_SOUND, dc->categories); > + dc->vmsd = &vmstate_spk; > dc->props = pcspk_properties; > /* Reason: pointer property "pit", realize sets global pcspk_state */ > dc->cannot_instantiate_with_device_add_yet = true; > This breaks migration to 2.1 and earlier. Not a big deal, just a heads up for distributions. Paolo