[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 4/7] RTC: Update the RTC clock only when reading
From: |
Juan Quintela |
Subject: |
Re: [Qemu-devel] [PATCH 4/7] RTC: Update the RTC clock only when reading it |
Date: |
Mon, 23 Jul 2012 07:17:33 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.97 (gnu/linux) |
Paolo Bonzini <address@hidden> wrote:
> From: "Zhang, Yang Z" <address@hidden>
>
> Calculate guest RTC based on the time of the last update, instead of
> using timers. The formula is
>
> (base_rtc + guest_time_now - guest_time_last_update + offset)
>
> Base_rtc is the RTC value when the RTC was last updated.
> Guest_time_now is the guest time when the access happens.
> Guest_time_last_update was the guest time when the RTC was last updated.
> Offset is used when divider reset happens or the set bit is toggled.
>
> The timer is kept in order to signal interrupts, but it only needs to
> run when either UF or AF is cleared. When the bits are both set, the
> timer does not run.
>
> UIP is now synthesized when reading register A. If the timer is not set,
> or if there is more than one second before it (as is the case at the
> end of this series), the leading edge of UIP is computed and the rising
> edge occurs 220us later. If the update timer occurs within one second,
> however, the rising edge of the AF and UF bits should coincide withe
> the falling edge of UIP. We do not know exactly when this will happen
> because there could be delays in the servicing of the timer. Hence, in
> this case reading register A only computes for the rising edge of UIP,
> and latches the bit until the timer is fired and clears it.
>
> Signed-off-by: Yang Zhang <address@hidden>
> Signed-off-by: Paolo Bonzini <address@hidden>
> @@ -540,11 +593,12 @@ static const VMStateDescription vmstate_rtc = {
> VMSTATE_INT32(current_tm.tm_mday, RTCState),
> VMSTATE_INT32(current_tm.tm_mon, RTCState),
> VMSTATE_INT32(current_tm.tm_year, RTCState),
> + VMSTATE_UINT64(base_rtc, RTCState),
> + VMSTATE_UINT64(last_update, RTCState),
> + VMSTATE_INT64(offset, RTCState),
VMSTATE_UINT64_V(base_rtc, RTCState, 3)
same ofr the others.
Normally, new fields are added at the end of the structure.
> VMSTATE_TIMER(periodic_timer, RTCState),
> VMSTATE_INT64(next_periodic_time, RTCState),
> - VMSTATE_INT64(next_second_time, RTCState),
> - VMSTATE_TIMER(second_timer, RTCState),
> - VMSTATE_TIMER(second_timer2, RTCState),
> + VMSTATE_TIMER(update_timer, RTCState),
I have to read the rest of the patch to know what is the relation of
this 4 fields, to see if there is any way to create this in any sane
way that is compatible.
The new fields can go in a different subsection. The three ones that
are removed, I don't know if that values can be calculated.
> VMSTATE_UINT32_V(irq_coalesced, RTCState, 2),
> VMSTATE_UINT32_V(period, RTCState, 2),
> VMSTATE_END_OF_LIST()
Later, Juan.
- [Qemu-devel] [PATCH 0/7] Remove periodic wakeup from RTC timer, Paolo Bonzini, 2012/07/20
- [Qemu-devel] [PATCH 1/7] RTC: Remove the logic to update time format when DM bit changed, Paolo Bonzini, 2012/07/20
- [Qemu-devel] [PATCH 2/7] RTC: Rename rtc_timer_update, Paolo Bonzini, 2012/07/20
- [Qemu-devel] [PATCH 3/7] RTC: Update interrupt state when interrupts are masked/unmasked, Paolo Bonzini, 2012/07/20
- [Qemu-devel] [PATCH 4/7] RTC: Update the RTC clock only when reading it, Paolo Bonzini, 2012/07/20
- Re: [Qemu-devel] [PATCH 4/7] RTC: Update the RTC clock only when reading it,
Juan Quintela <=
- [Qemu-devel] [PATCH 5/7] RTC: Add divider reset support, Paolo Bonzini, 2012/07/20
- [Qemu-devel] [PATCH 6/7] RTC: Do not fire timer periodically to catch next alarm, Paolo Bonzini, 2012/07/20
- [Qemu-devel] [PATCH 7/7] RTC: Allow to migrate from old QEMU, Paolo Bonzini, 2012/07/20