qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] PATCH v5 0/7] RTC: New logic to emulate RTC


From: Paolo Bonzini
Subject: Re: [Qemu-devel] PATCH v5 0/7] RTC: New logic to emulate RTC
Date: Wed, 09 May 2012 15:06:33 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120425 Thunderbird/12.0

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]