From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38199) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCrAU-0006DF-KE for qemu-devel@nongnu.org; Thu, 31 Jul 2014 10:17:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XCrAP-0000IO-Ln for qemu-devel@nongnu.org; Thu, 31 Jul 2014 10:17:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:28572) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCrAP-0000F3-EN for qemu-devel@nongnu.org; Thu, 31 Jul 2014 10:17:13 -0400 Message-ID: <53DA4F80.8020307@redhat.com> Date: Thu, 31 Jul 2014 16:15:28 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <20140731125321.1600.46604.stgit@PASHA-ISP.novsu.ac.ru> <20140731125435.1600.61692.stgit@PASHA-ISP.novsu.ac.ru> In-Reply-To: <20140731125435.1600.61692.stgit@PASHA-ISP.novsu.ac.ru> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH v3 12/49] mc146818rtc: add missed field to vmstate List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Dovgalyuk , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, mark.burton@greensocs.com, real@ispras.ru, batuzovk@ispras.ru, maria.klimushenkova@ispras.ru, afaerber@suse.de, fred.konrad@greensocs.com Il 31/07/2014 14:54, Pavel Dovgalyuk ha scritto: > This patch adds irq_reinject_on_ack_count field to VMState to allow correct > saving/loading the state of MC146818 RTC. > > Signed-off-by: Pavel Dovgalyuk > --- > hw/timer/mc146818rtc.c | 34 +++++++++++++++++++++++++++++++++- > 1 files changed, 33 insertions(+), 1 deletions(-) > > diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c > index 233fc70..0b78d88 100644 > --- a/hw/timer/mc146818rtc.c > +++ b/hw/timer/mc146818rtc.c > @@ -698,6 +698,13 @@ int rtc_get_memory(ISADevice *dev, int addr) > return s->cmos_data[addr]; > } > > +static int rtc_pre_load(void *opaque) > +{ > + RTCState *s = (RTCState *)opaque; > + s->irq_reinject_on_ack_count = 0; Probably not needed? > + return 0; > +} > + > static void rtc_set_date_from_host(ISADevice *dev) > { > RTCState *s = MC146818_RTC(dev); > @@ -733,10 +740,27 @@ static int rtc_post_load(void *opaque, int version_id) > return 0; > } > > +static const VMStateDescription vmstate_rtc_irq_reinject_on_ack_count = { > + .name = "irq_reinject_on_ack_count", > + .version_id = 1, > + .minimum_version_id = 1, > + .fields = (VMStateField[]) { > + VMSTATE_UINT16(irq_reinject_on_ack_count, RTCState), > + VMSTATE_END_OF_LIST() > + } > +}; > + > +static bool rtc_irq_reinject_on_ack_count_needed(void *opaque) > +{ > + RTCState *s = (RTCState *)opaque; > + return s->irq_reinject_on_ack_count != 0; > +} > + > static const VMStateDescription vmstate_rtc = { > .name = "mc146818rtc", > - .version_id = 3, > + .version_id = 4, You already know about this by now. :) Paolo > .minimum_version_id = 1, > + .pre_load = rtc_pre_load, > .post_load = rtc_post_load, > .fields = (VMStateField[]) { > VMSTATE_BUFFER(cmos_data, RTCState), > @@ -753,6 +777,14 @@ static const VMStateDescription vmstate_rtc = { > VMSTATE_TIMER_V(update_timer, RTCState, 3), > VMSTATE_UINT64_V(next_alarm_time, RTCState, 3), > VMSTATE_END_OF_LIST() > + }, > + .subsections = (VMStateSubsection[]) { > + { > + .vmsd = &vmstate_rtc_irq_reinject_on_ack_count, > + .needed = rtc_irq_reinject_on_ack_count_needed, > + }, { > + /* empty */ > + } > } > }; > >