target/arm: Abstract the generic timer frequency
commit7def87548272f6f3831c7ae5ba713c5ccbd5d547
authorAndrew Jeffery <andrew@aj.id.au>
Fri, 20 Dec 2019 14:02:59 +0000 (20 14:02 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 20 Dec 2019 14:02:59 +0000 (20 14:02 +0000)
tree0cefbe1358746d78f058e62cd67154e3ac6b0771
parent4a0245b62502ee9ca7774712de4bb05d9bf47152
target/arm: Abstract the generic timer frequency

Prepare for SoCs such as the ASPEED AST2600 whose firmware configures
CNTFRQ to values significantly larger than the static 62.5MHz value
currently derived from GTIMER_SCALE. As the OS potentially derives its
timer periods from the CNTFRQ value the lack of support for running
QEMUTimers at the appropriate rate leads to sticky behaviour in the
guest.

Substitute the GTIMER_SCALE constant with use of a helper to derive the
period from gt_cntfrq_hz stored in struct ARMCPU. Initially set
gt_cntfrq_hz to the frequency associated with GTIMER_SCALE so current
behaviour is maintained.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 40bd8df043f66e1ccfb3e9482999d099ac72bb2e.1576215453.git-series.andrew@aj.id.au
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
target/arm/cpu.c
target/arm/cpu.h
target/arm/helper.c