diff options
author | James Hogan <james.hogan@imgtec.com> | 2016-04-22 17:19:15 (GMT) |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2016-05-13 13:30:25 (GMT) |
commit | 24e1df664fd3c025664ae0b64a4aec691507959a (patch) | |
tree | 38804cbc65c08db6a51d8b5be71e60dca8abf525 /arch/mips/alchemy | |
parent | aab4673b599d8037c713afce40fabae398ca96c4 (diff) | |
download | linux-24e1df664fd3c025664ae0b64a4aec691507959a.tar.xz |
MIPS: malta-time: Take seconds into account
When estimating the clock frequency based on the RTC, take seconds into
account in case the Update In Progress (UIP) bit wasn't seen. This can
happen in virtual machines (which may get pre-empted by the hypervisor
at inopportune times) with QEMU emulating the RTC (and in fact not
setting the UIP bit for very long), especially on slow hosts such as
FPGA systems and hardware emulators. This results in several seconds
actually having elapsed before seeing the UIP bit instead of just one
second, and exaggerated timer frequencies.
While updating the comments, they're also fixed to match the code in
that the rising edge of the update flag is detected first, not the
falling edge.
The rising edge gives a more precise point to read the counters in a
virtualised system than the falling edge, resulting in a more accurate
frequency.
It does however mean that we have to also wait for the falling edge
before doing the read of the RTC seconds register, otherwise it seems to
be possible in slow hardware emulation to stray into the interval when
the RTC time is undefined during the update (at least 244uS after the
rising edge of the update flag). This can result in both seconds values
reading the same, and it wrapping to 60 seconds, vastly underestimating
the frequency.
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/13174/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/alchemy')
0 files changed, 0 insertions, 0 deletions