agtimer(4/arm64): call CPU_BUSY_CYCLE() during spin-loop
authorcheloha <cheloha@openbsd.org>
Fri, 11 Aug 2023 01:28:19 +0000 (01:28 +0000)
committercheloha <cheloha@openbsd.org>
Fri, 11 Aug 2023 01:28:19 +0000 (01:28 +0000)
commit284a3223b8d6f2efcc023eea08a50b5615ffd0df
tree793534b8d7aed35e056243bf9172a3a18f4bbc28
parent3e579263924a987ec960e17fa7a587b7f54c62c1
agtimer(4/arm64): call CPU_BUSY_CYCLE() during spin-loop

For consistency with other delay(9) implementations, agtimer(4/arm64)
ought to call CPU_BUSY_CYCLE() as it spins.

kettenis@ notes that we could reduce the power consumed in
agtimer_delay() by enabling CNTKCTL_EL1.EVNTEN and configuring
ENTKCTL_EL1.EVNTI.

kettenis@ also notes that Armv8.7 adds FEAT_WFxT, which will, when the
feature appears in real hardware, make it even easier to save power in
agtimer_delay().

With input from drahn@ and kettenis@.

Thread: https://marc.info/?l=openbsd-tech&m=169146193022516&w=2

ok kettenis@
sys/arch/arm64/dev/agtimer.c