qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Zhang, Yang Z" <yang.z.zhang@intel.com>
Cc: "'aliguori@us.ibm.com'" <aliguori@us.ibm.com>,
	"'qemu-devel@nongnu.org'" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] PATCH v5 0/7] RTC: New logic to emulate RTC
Date: Wed, 09 May 2012 15:06:33 +0200	[thread overview]
Message-ID: <4FAA6BD9.7010206@redhat.com> (raw)
In-Reply-To: <A9667DDFB95DB7438FA9D7D576C3D87E12C80F@SHSMSX101.ccr.corp.intel.com>

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	other threads:[~2012-05-09 13:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-09  7:22 [Qemu-devel] PATCH v5 0/7] RTC: New logic to emulate RTC Zhang, Yang Z
2012-05-09 13:06 ` Paolo Bonzini [this message]
2012-05-10  1:41   ` Zhang, Yang Z
2012-05-10  7:00     ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FAA6BD9.7010206@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yang.z.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).