OpenBSD cvs log

created 2020-11-25T23:24:52Z
begin 2020-09-06T00:00:00Z
end 2020-09-07T00:00:00Z
path src/sys
commits 2

date 2020-09-06T20:50:00Z
author cheloha
files src/sys/arch/amd64/amd64/lapic.c log diff annotate
src/sys/arch/amd64/amd64/tsc.c log diff annotate
message amd64: add tsc_delay(), a delay(9) implementation based on the TSC

In preparation for running the lapic timer in oneshot mode on amd64 we
need a replacement for lapic_delay().

Using the lapic timer itself to implement delay(9) when the timer is
not running in periodic mode is complicated if not outright impossible.

Meanwhile, the i8254 provides our only other amd64 delay(9) implementation
and it is an extremely slow clock. On my 2GHz machine, gettick() takes
~20 microseconds to complete *without* mutex contention. On a VM it is
even slower, as you must exit the VM for each inb() and outb().

So, add tsc_delay() and use it when we have a constant/invariant TSC.
The TSC is a 64-bit "up-counter" so the implementation is simple.

Given how slow the i8254 is on modern machines, we may want to add an
HPET delay(9) implementation as a fallback for machines where the TSC
drifts. The HPET itself is pretty slow, but not as slow as the i8254.

Discussed with kettenis@, Mike Larkin, and naddy@.

Tweaked by kettenis@.

ok kettenis@

date 2020-09-06T23:42:19Z
author jmatthew
files src/sys/dev/fdt/rkclock.c log diff annotate
src/sys/dev/fdt/rkclock_clocks.h log diff annotate
message Add RK3308 clocks

ok kettenis@