target/ppc: Implement core timebase state machine and TFMR
authorNicholas Piggin <npiggin@gmail.com>
Sat, 3 Jun 2023 11:43:08 +0000 (21:43 +1000)
committerNicholas Piggin <npiggin@gmail.com>
Fri, 23 Feb 2024 13:24:43 +0000 (23:24 +1000)
commitd8c14411d0bb5f3d5370e74f8e993eb4eb63c55a
tree5dcae7188e0c398ec61803e184aaecdc85dc5d7a
parentcde2ba34a951997f01c184acf6e3a29eb6a81e79
target/ppc: Implement core timebase state machine and TFMR

This implements the core timebase state machine, which is the core side
of the time-of-day system in POWER processors. This facility is operated
by control fields in the TFMR register, which also contains status
fields.

The core timebase interacts with the chiptod hardware, primarily to
receive TOD updates, to synchronise timebase with other cores. This
model does not actually update TB values with TOD or updates received
from the chiptod, as timebases are always synchronised. It does step
through the states required to perform the update.

There are several asynchronous state transitions. These are modelled
using using mfTFMR to drive state changes, because it is expected that
firmware poll the register to wait for those states. This is good enough
to test basic firmware behaviour without adding real timers. The values
chosen are arbitrary.

Acked-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
target/ppc/cpu.h
target/ppc/timebase_helper.c