On 19/4/24 20:46, Peter Maydell wrote:
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.mayd...@linaro.org>
---
  target/arm/internals.h |  7 ++++---
  target/arm/cpu.c       | 31 +++++++++++++++++--------------
  target/arm/helper.c    | 16 ++++++++--------
  3 files changed, 29 insertions(+), 25 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <phi...@linaro.org>


Reply via email to