From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56169) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMxjm-0001E2-69 for qemu-devel@nongnu.org; Thu, 28 Aug 2014 07:19:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMxjg-0007o8-3o for qemu-devel@nongnu.org; Thu, 28 Aug 2014 07:19:30 -0400 Received: from mail.ispras.ru ([83.149.199.45]:55542) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMxjf-0007nx-Rv for qemu-devel@nongnu.org; Thu, 28 Aug 2014 07:19:24 -0400 From: Pavel Dovgalyuk Date: Thu, 28 Aug 2014 15:19:25 +0400 Message-ID: <20140828111925.1624.87169.stgit@PASHA-ISP> In-Reply-To: <20140828111822.1624.24556.stgit@PASHA-ISP> References: <20140828111822.1624.24556.stgit@PASHA-ISP> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH v2 11/12] mc146818rtc: add missed field to vmstate List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, zealot351@gmail.com, maria.klimushenkova@ispras.ru, pavel.dovgaluk@ispras.ru 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 | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c index 233fc70..61dedcb 100644 --- a/hw/timer/mc146818rtc.c +++ b/hw/timer/mc146818rtc.c @@ -733,6 +733,22 @@ 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, @@ -753,6 +769,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 */ + } } }; @@ -785,6 +809,7 @@ static void rtc_reset(void *opaque) s->cmos_data[RTC_REG_B] &= ~(REG_B_PIE | REG_B_AIE | REG_B_SQWE); s->cmos_data[RTC_REG_C] &= ~(REG_C_UF | REG_C_IRQF | REG_C_PF | REG_C_AF); + s->irq_reinject_on_ack_count = 0; check_update_timer(s); qemu_irq_lower(s->irq);