[PATCH-for-10.1 v4 0/4] target/arm/hvf: Correctly set Generic Timer frequency

Philippe Mathieu-Daudé posted 4 patches 3 months, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250723135156.85426-1-philmd@linaro.org
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Cameron Esfahani <dirty@apple.com>, Roman Bolshakov <rbolshakov@ddn.com>, Phil Dennis-Jordan <phil@philjordan.eu>, Mads Ynddal <mads@ynddal.dk>, Peter Maydell <peter.maydell@linaro.org>, Alexander Graf <agraf@csgraf.de>
include/accel/accel-cpu-ops.h |  1 +
include/system/hvf_int.h      |  2 ++
accel/accel-common.c          |  5 +++
accel/hvf/hvf-accel-ops.c     |  2 ++
target/arm/cpu.c              | 65 ++++++++++++++++++-----------------
target/arm/hvf/hvf.c          | 20 ++++++++++-
target/i386/hvf/hvf.c         |  5 +++
7 files changed, 67 insertions(+), 33 deletions(-)
[PATCH-for-10.1 v4 0/4] target/arm/hvf: Correctly set Generic Timer frequency
Posted by Philippe Mathieu-Daudé 3 months, 3 weeks ago
(Series fully reviewed)

When using HVF, the accelerator gets the host Generic Timer
frequency and update cpu->gt_cntfrq_hz; it is however too
late, as the timers have been created in arm_cpu_realizefn()
using the default frequency. Then guest virtualization code
depending on timers ends very slow (experienced on Silicon M1,
timer running at 24MHz but QEMU timer a 1GHz, ~70x slower).

This series fixes that by introducing a cpu_target_realize()
callback for accelerators, creating ARM timers *after* calling
this callback, and correctly setting the per-cpu timer freq
there.

Philippe Mathieu-Daudé (4):
  accel: Introduce AccelOpsClass::cpu_target_realize() hook
  accel/hvf: Add hvf_arch_cpu_realize() stubs
  target/arm: Create GTimers *after* features finalized / accel realized
  target/arm/hvf: Really set Generic Timer counter frequency

 include/accel/accel-cpu-ops.h |  1 +
 include/system/hvf_int.h      |  2 ++
 accel/accel-common.c          |  5 +++
 accel/hvf/hvf-accel-ops.c     |  2 ++
 target/arm/cpu.c              | 65 ++++++++++++++++++-----------------
 target/arm/hvf/hvf.c          | 20 ++++++++++-
 target/i386/hvf/hvf.c         |  5 +++
 7 files changed, 67 insertions(+), 33 deletions(-)

-- 
2.49.0