WSL2-Linux-Kernel/arch/mips/mti-malta
James Hogan 24e1df664f 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>
2016-05-13 15:30:25 +02:00
..
Makefile MIPS: Malta: Setup RAM regions via DT 2015-11-11 08:35:47 +01:00
Platform
malta-amon.c
malta-display.c
malta-dt.c MIPS: Malta: Basic DT plumbing 2015-06-21 21:54:29 +02:00
malta-dtshim.c MIPS: Malta: Setup RAM regions via DT 2015-11-11 08:35:47 +01:00
malta-init.c MIPS: Fix early CM probing 2016-02-09 17:18:31 +01:00
malta-int.c MIPS: CM: Add support for reporting CM cache errors 2015-08-26 15:23:15 +02:00
malta-memory.c MIPS: Malta: Setup RAM regions via DT 2015-11-11 08:35:47 +01:00
malta-platform.c
malta-pm.c
malta-reset.c
malta-setup.c MIPS: Introduce plat_get_fdt a platform API to retrieve the FDT 2016-05-13 14:02:03 +02:00
malta-time.c MIPS: malta-time: Take seconds into account 2016-05-13 15:30:25 +02:00