[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 5/7] RTC:Add RTC update-ended interrupt suppo
From: |
Stefano Stabellini |
Subject: |
Re: [Qemu-devel] [PATCH v4 5/7] RTC:Add RTC update-ended interrupt support |
Date: |
Tue, 20 Mar 2012 18:35:24 +0000 |
User-agent: |
Alpine 2.00 (DEB 1167 2008-08-23) |
> +/* handle update-ended timer */
> +static void check_update_timer(RTCState *s)
> +{
> + uint64_t next_update_time, expire_time;
> + uint64_t guest_usec;
> + qemu_del_timer(s->update_timer);
> + qemu_del_timer(s->update_timer2);
> +
> + if (!((s->cmos_data[RTC_REG_C] & (REG_C_UF | REG_C_AF)) ==
> + (REG_C_UF | REG_C_AF)) && !(s->cmos_data[RTC_REG_B] &
> REG_B_SET)) {
> + s->use_timer = 1;
> + guest_usec = get_guest_rtc_us(s) % USEC_PER_SEC;
> + if (guest_usec >= (USEC_PER_SEC - 244)) {
> + /* RTC is in update cycle when enabling UIE */
> + s->cmos_data[RTC_REG_A] |= REG_A_UIP;
> + next_update_time = (USEC_PER_SEC - guest_usec) * NS_PER_USEC;
> + expire_time = qemu_get_clock_ns(rtc_clock) + next_update_time;
> + qemu_mod_timer(s->update_timer2, expire_time);
> + } else {
> + next_update_time = (USEC_PER_SEC - guest_usec - 244) *
> NS_PER_USEC;
> + expire_time = qemu_get_clock_ns(rtc_clock) + next_update_time;
> + s->next_update_time = expire_time;
> + qemu_mod_timer(s->update_timer, expire_time);
> + }
> + } else {
> + s->use_timer = 0;
> + }
> +}
This is the function that is used to figure out whether we need the
timers or not, the condition seems to be:
(Not (REG_C_UF | REG_C_AF)) And (Not (REG_B_SET))
Shouldn't actually check for UIE being enabled?
Re: [Qemu-devel] [PATCH v4 5/7] RTC:Add RTC update-ended interrupt support, Zhang, Yang Z, 2012/03/21