Message ID | 4FAA6BD9.7010206@redhat.com |
---|---|
State | New |
Headers | show |
> -----Original Message----- > From: Paolo Bonzini [mailto:pbonzini@redhat.com] > Sent: Wednesday, May 09, 2012 9:07 PM > Subject: Re: PATCH v5 0/7] RTC: New logic to emulate RTC > > > 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; I rebased those patches on the top of KVM. I will change to use QEMU in next version. > 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. How to use rtc-test? I cannot manage to run rtc-test. I searched in google but get nothing. > 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! Would you mind if I add your name in Acked-by in next version? Best regards yang
Il 10/05/2012 03:41, Zhang, Yang Z ha scritto: >> 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. > > How to use rtc-test? I cannot manage to run rtc-test. I searched in google but get nothing. "make check-qtest-i386 V=1" will show how to invoke it with gtester. You can similarly use gdb instead of gtester. > Would you mind if I add your name in Acked-by in next version? I prefer to do some tests myself and reply with Acked-by. Paolo
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 []) {