From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:38643) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SS6bM-0004Km-CL for qemu-devel@nongnu.org; Wed, 09 May 2012 09:06:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SS6bG-0005uC-3X for qemu-devel@nongnu.org; Wed, 09 May 2012 09:06:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61469) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SS6bF-0005tq-Rq for qemu-devel@nongnu.org; Wed, 09 May 2012 09:06:38 -0400 Message-ID: <4FAA6BD9.7010206@redhat.com> Date: Wed, 09 May 2012 15:06:33 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] PATCH v5 0/7] RTC: New logic to emulate RTC List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Zhang, Yang Z" Cc: "'aliguori@us.ibm.com'" , "'qemu-devel@nongnu.org'" Il 09/05/2012 09:22, Zhang, Yang Z ha scritto: > Changes in v5: > Rebase to latest head. > Add Checking of divider, because it also can stop the update. > Fixing some bugs. At last this passes my tests, great! There's still a few problems, but more or less it's ok: 1) it needs rebase on top of the latest version of QEMU; 2) it doesn't pass tests/rtc-test, but that might even be a problem with the test; I'll try to look at it. 3) the migration code is not perfect, something like this needs to be squashed in diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c index e76c34b..026bb29 100644 --- a/hw/mc146818rtc.c +++ b/hw/mc146818rtc.c @@ -821,27 +821,34 @@ static int rtc_load_old(QEMUFile *f, void *opaque, int version_id) } qemu_get_buffer(f, s->cmos_data, sizeof(s->cmos_data)); - /* dummy load for compatibility */ - qemu_get_buffer(f, buf, 77); + qemu_get_8s(f, &s->cmos_index); + + /* Skip loading of s->current_tm, we already have the + * information in cmos_data. + */ + qemu_get_buffer(f, buf, 7*4); + + qemu_get_timer(f, s->periodic_timer); + s->next_periodic_time = qemu_get_be64(f); + + /* Skip loading of next_second_time, second_timer, second_timer2. */ + qemu_get_buffer(f, buf, 3*8); rtc_set_time(s); rtc_set_offset(s, 0); - periodic_timer_update(s, qemu_get_clock_ns(rtc_clock)); check_update_timer(s); - -#ifdef TARGET_I386 - if (s->lost_tick_policy == LOST_TICK_SLEW) { - rtc_coalesced_timer_update(s); + if (version_id >= 2) { + s->irq_coalesced = qemu_get_be32(f); + s->period = qemu_get_be32(f); } -#endif - return 0; + return rtc_post_load(opaque, version_id); } static const VMStateDescription vmstate_rtc = { .name = "mc146818rtc", .version_id = 3, .minimum_version_id = 3, - .minimum_version_id_old = 2, + .minimum_version_id_old = 1, .load_state_old = rtc_load_old, .post_load = rtc_post_load, .fields = (VMStateField []) { Otherwise looks good! Paolo