On Fri, 5 Jul 2019 at 10:48, Paolo Bonzini <pbonz...@redhat.com> wrote:
> By the way, the data sheet says "the counter and match values are
> compared in a comparator. When both values are equal, the RTCINTR
> interrupt is asserted HIGH"; QEMU compares the RTC value (read from
> RTC_DR) and not the counter value, but Linux code seems to expect QEMU's
> behavior.

Rereading the datasheet more carefully, the RTCMR register
description is clear about the behaviour:
 "An equivalent match value is derived from this register. The
 derived value is compared with the counter value in the CLK1HZ
 domain to generate an interrupt."
and the section 2.2.4 on the "Update block" confirms this.
So in hardware what happens is that there is a free-running
counter, and an offset which is used to derive the actual RTCDR
value from that. For comparisons, the RTCMR value has the
offset applied in reverse to give a derived value which can
be directly compared against the raw free-running counter,
with the equivalent effect as if the RTCMR value was compared
with the RTCDR.

thanks
-- PMM

Reply via email to