On 4/19/24 11:46, Peter Maydell wrote:
In previous versions of the Arm architecture, the frequency of the
generic timers as reported in CNTFRQ_EL0 could be any IMPDEF value,
and for QEMU we picked 62.5MHz, giving a timer tick period of 16ns.
In Armv8.6, the architecture standardized this frequency to 1GHz.

Because there is no ID register feature field that indicates whether
a CPU is v8.6 or that it ought to have this counter frequency, we
implement this by changing our default CNTFRQ value for all CPUs,
with exceptions for backwards compatibility:

  * CPU types which we already implement will retain the old
    default value. None of these are v8.6 CPUs, so this is
    architecturally OK.
  * CPUs used in versioned machine types with a version of 9.0
    or earlier will retain the old default value.

The upshot is that the only CPU type that changes is 'max'; but any
new type we add in future (whether v8.6 or not) will also get the new
1GHz default.

It remains the case that the machine model can override the default
value via the 'cntfrq' QOM property (regardless of the CPU type).

Signed-off-by: Peter Maydell<peter.mayd...@linaro.org>
---
  target/arm/cpu.h       | 11 +++++++++++
  target/arm/internals.h | 12 ++++++++++--
  hw/core/machine.c      |  4 +++-
  target/arm/cpu.c       | 28 ++++++++++++++++++++++------
  target/arm/cpu64.c     |  2 ++
  target/arm/tcg/cpu32.c |  4 ++++
  target/arm/tcg/cpu64.c | 18 ++++++++++++++++++
  7 files changed, 70 insertions(+), 9 deletions(-)

Reviewed-by: Richard Henderson <richard.hender...@linaro.org>

r~

Reply via email to