]> git.ipfire.org Git - thirdparty/qemu.git/commit
target/arm: Refactor default generic timer frequency handling
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 26 Apr 2024 12:29:10 +0000 (13:29 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 30 Apr 2024 14:14:15 +0000 (15:14 +0100)
commitbd8e9ddf6f6915b8a67909a21e7f46f77a05767d
tree201d08395d719049e7d4704e764f9e0b10d8849f
parentdcc5c018c7e6acddf81951bcbdf1019b9ab45f56
target/arm: Refactor default generic timer frequency handling

The generic timer frequency is settable by board code via a QOM
property "cntfrq", but otherwise defaults to 62.5MHz.  The way this
is done includes some complication resulting from how this was
originally a fixed value with no QOM property.  Clean it up:

 * always set cpu->gt_cntfrq_hz to some sensible value, whether
   the CPU has the generic timer or not, and whether it's system
   or user-only emulation
 * this means we can always use gt_cntfrq_hz, and never need
   the old GTIMER_SCALE define
 * set the default value in exactly one place, in the realize fn

The aim here is to pave the way for handling the ARMv8.6 requirement
that the generic timer frequency is always 1GHz.  We're going to do
that by having old CPU types keep their legacy-in-QEMU behaviour and
having the default for any new CPU types be a 1GHz rather han 62.5MHz
cntfrq, so we want the point where the default is decided to be in
one place, and in code, not in a DEFINE_PROP_UINT64() initializer.

This commit should have no behavioural changes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20240426122913.3427983-2-peter.maydell@linaro.org
target/arm/cpu.c
target/arm/helper.c
target/arm/internals.h