From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Subject: [PATCH 0/3] target/arm: Make the counter frequency default 1GHz for new CPUs, machines
Date: Fri, 19 Apr 2024 19:46:05 +0100 [thread overview]
Message-ID: <20240419184608.2675213-1-peter.maydell@linaro.org> (raw)
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 (assuming we spot in code review any attempts to set
the ARM_FEATURE_BACKCOMPAT_CNTFRQ flag on new CPU types as a result
of cut-n-paste from an older CPU initfn ;-)).
It remains the case that the machine model can override the default
value via the 'cntfrq' QOM property (regardless of the CPU type).
Patch 1 is Paolo's "add the new versioned machine types" patch that
he sent out last month; patch 2 is some preliminary cleanup so that
we set the default cntfrq value in exactly one place, and patch 3
is the mechanics to set the default appropriately for the two
back-compat scenarios.
thanks
-- PMM
Paolo Bonzini (1):
hw: Add compat machines for 9.1
Peter Maydell (2):
target/arm: Refactor default generic timer frequency handling
target/arm: Default to 1GHz cntfrq for 'max' and new CPUs
include/hw/boards.h | 3 +++
include/hw/i386/pc.h | 3 +++
target/arm/cpu.h | 11 +++++++++
target/arm/internals.h | 15 +++++++++---
hw/arm/virt.c | 11 +++++++--
hw/core/machine.c | 5 ++++
hw/i386/pc.c | 3 +++
hw/i386/pc_piix.c | 17 +++++++++++---
hw/i386/pc_q35.c | 14 ++++++++++--
hw/m68k/virt.c | 11 +++++++--
hw/ppc/spapr.c | 17 +++++++++++---
hw/s390x/s390-virtio-ccw.c | 14 +++++++++++-
target/arm/cpu.c | 47 ++++++++++++++++++++++++++------------
target/arm/cpu64.c | 2 ++
target/arm/helper.c | 16 ++++++-------
target/arm/tcg/cpu32.c | 4 ++++
target/arm/tcg/cpu64.c | 18 +++++++++++++++
17 files changed, 173 insertions(+), 38 deletions(-)
--
2.34.1
next reply other threads:[~2024-04-19 18:46 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-19 18:46 Peter Maydell [this message]
2024-04-19 18:46 ` [PATCH 1/3] hw: Add compat machines for 9.1 Peter Maydell
2024-04-19 18:46 ` [PATCH 2/3] target/arm: Refactor default generic timer frequency handling Peter Maydell
2024-04-20 16:58 ` Richard Henderson
2024-04-23 12:12 ` Philippe Mathieu-Daudé
2024-04-19 18:46 ` [PATCH 3/3] target/arm: Default to 1GHz cntfrq for 'max' and new CPUs Peter Maydell
2024-04-20 17:04 ` Richard Henderson
2024-04-23 20:47 ` Philippe Mathieu-Daudé
2024-04-22 12:56 ` [PATCH 0/3] target/arm: Make the counter frequency default 1GHz for new CPUs, machines Peter Maydell
2024-04-22 13:38 ` Marcin Juszkiewicz
2024-04-22 14:18 ` Peter Maydell
2024-04-22 15:37 ` Marcin Juszkiewicz
2024-04-23 7:26 ` Marcin Juszkiewicz
2024-04-22 15:57 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240419184608.2675213-1-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).