From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Leif Lindholm" <leif.lindholm@oss.qualcomm.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Radoslaw Biernacki" <rad@semihalf.com>,
"Alexander Graf" <agraf@csgraf.de>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Phil Dennis-Jordan" <phil@philjordan.eu>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Bernhard Beschow" <shentey@gmail.com>,
"Cleber Rosa" <crosa@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Cameron Esfahani" <dirty@apple.com>,
kvm@vger.kernel.org, qemu-arm@nongnu.org,
"Eric Auger" <eric.auger@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Roman Bolshakov" <rbolshakov@ddn.com>,
"John Snow" <jsnow@redhat.com>
Subject: [PATCH v2 10/26] accel/hvf: Model PhysTimer register
Date: Fri, 20 Jun 2025 15:06:53 +0200 [thread overview]
Message-ID: <20250620130709.31073-11-philmd@linaro.org> (raw)
In-Reply-To: <20250620130709.31073-1-philmd@linaro.org>
Emulate PhysTimer dispatching to TCG, like we do with GIC registers.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/arm/hvf/hvf.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index bf59b17dcb9..5169bf6e23c 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -187,6 +187,7 @@ void hvf_arm_init_debug(void)
#define SYSREG_OSDLR_EL1 SYSREG(2, 0, 1, 3, 4)
#define SYSREG_CNTPCT_EL0 SYSREG(3, 3, 14, 0, 1)
#define SYSREG_CNTP_CTL_EL0 SYSREG(3, 3, 14, 2, 1)
+#define SYSREG_CNTP_CVAL_EL0 SYSREG(3, 3, 14, 2, 2)
#define SYSREG_PMCR_EL0 SYSREG(3, 3, 9, 12, 0)
#define SYSREG_PMUSERENR_EL0 SYSREG(3, 3, 9, 14, 0)
#define SYSREG_PMCNTENSET_EL0 SYSREG(3, 3, 9, 12, 1)
@@ -198,6 +199,7 @@ void hvf_arm_init_debug(void)
#define SYSREG_PMCEID0_EL0 SYSREG(3, 3, 9, 12, 6)
#define SYSREG_PMCEID1_EL0 SYSREG(3, 3, 9, 12, 7)
#define SYSREG_PMCCNTR_EL0 SYSREG(3, 3, 9, 13, 0)
+#define SYSREG_CNTP_TVAL_EL0 SYSREG(3, 3, 14, 2, 0)
#define SYSREG_PMCCFILTR_EL0 SYSREG(3, 3, 14, 15, 7)
#define SYSREG_ICC_AP0R0_EL1 SYSREG(3, 0, 12, 8, 4)
@@ -1326,16 +1328,15 @@ static int hvf_sysreg_read(CPUState *cpu, uint32_t reg, uint64_t *val)
}
switch (reg) {
- case SYSREG_CNTPCT_EL0:
- *val = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) /
- gt_cntfrq_period_ns(arm_cpu);
- return 0;
case SYSREG_OSLSR_EL1:
*val = env->cp15.oslsr_el1;
return 0;
case SYSREG_OSDLR_EL1:
/* Dummy register */
return 0;
+ case SYSREG_CNTP_CTL_EL0:
+ case SYSREG_CNTP_TVAL_EL0:
+ case SYSREG_CNTPCT_EL0:
case SYSREG_ICC_AP0R0_EL1:
case SYSREG_ICC_AP0R1_EL1:
case SYSREG_ICC_AP0R2_EL1:
@@ -1639,16 +1640,12 @@ static int hvf_sysreg_write(CPUState *cpu, uint32_t reg, uint64_t val)
case SYSREG_OSLAR_EL1:
env->cp15.oslsr_el1 = val & 1;
return 0;
- case SYSREG_CNTP_CTL_EL0:
- /*
- * Guests should not rely on the physical counter, but macOS emits
- * disable writes to it. Let it do so, but ignore the requests.
- */
- qemu_log_mask(LOG_UNIMP, "Unsupported write to CNTP_CTL_EL0\n");
- return 0;
case SYSREG_OSDLR_EL1:
/* Dummy register */
return 0;
+ case SYSREG_CNTP_CTL_EL0:
+ case SYSREG_CNTP_CVAL_EL0:
+ case SYSREG_CNTP_TVAL_EL0:
case SYSREG_ICC_AP0R0_EL1:
case SYSREG_ICC_AP0R1_EL1:
case SYSREG_ICC_AP0R2_EL1:
--
2.49.0
next prev parent reply other threads:[~2025-06-20 13:10 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-20 13:06 [PATCH v2 00/26] arm: Fixes and preparatory cleanups for split-accel Philippe Mathieu-Daudé
2025-06-20 13:06 ` [PATCH v2 01/26] target/arm: Remove arm_handle_psci_call() stub Philippe Mathieu-Daudé
2025-06-20 13:06 ` [PATCH v2 02/26] target/arm: Reduce arm_cpu_post_init() declaration scope Philippe Mathieu-Daudé
2025-06-20 13:06 ` [PATCH v2 03/26] target/arm: Unify gen_exception_internal() Philippe Mathieu-Daudé
2025-06-20 13:06 ` [PATCH v2 04/26] target/arm/hvf: Simplify GIC hvf_arch_init_vcpu() Philippe Mathieu-Daudé
2025-06-22 0:40 ` Richard Henderson
2025-06-20 13:06 ` [PATCH v2 05/26] target/arm/hvf: Directly re-lock BQL after hv_vcpu_run() Philippe Mathieu-Daudé
2025-06-22 0:12 ` Richard Henderson
2025-06-20 13:06 ` [PATCH v2 06/26] target/arm/hvf: Trace hv_vcpu_run() failures Philippe Mathieu-Daudé
2025-06-20 13:06 ` [PATCH v2 07/26] accel/hvf: Trace VM memory mapping Philippe Mathieu-Daudé
2025-06-22 0:12 ` Richard Henderson
2025-06-20 13:06 ` [PATCH v2 08/26] target/arm/hvf: Log $pc in hvf_unknown_hvc() trace event Philippe Mathieu-Daudé
2025-06-20 13:06 ` [PATCH v2 09/26] target/arm: Correct KVM & HVF dtb_compatible value Philippe Mathieu-Daudé
2025-06-22 0:17 ` Richard Henderson
2025-06-20 13:06 ` Philippe Mathieu-Daudé [this message]
2025-06-22 0:40 ` [PATCH v2 10/26] accel/hvf: Model PhysTimer register Richard Henderson
2025-06-20 13:06 ` [PATCH v2 11/26] target/arm/hvf: Pass @target_el argument to hvf_raise_exception() Philippe Mathieu-Daudé
2025-06-22 0:19 ` Richard Henderson
2025-06-20 13:06 ` [PATCH v2 12/26] target/arm: Restrict system register properties to system binary Philippe Mathieu-Daudé
2025-06-22 0:20 ` Richard Henderson
2025-06-20 13:06 ` [PATCH v2 13/26] target/arm: Create GTimers *after* features finalized / accel realized Philippe Mathieu-Daudé
2025-06-22 0:22 ` Richard Henderson
2025-06-20 13:06 ` [PATCH v2 14/26] accel: Keep reference to AccelOpsClass in AccelClass Philippe Mathieu-Daudé
2025-06-20 13:06 ` [PATCH v2 15/26] accel: Introduce AccelOpsClass::cpu_target_realize() hook Philippe Mathieu-Daudé
2025-06-22 0:23 ` Richard Henderson
2025-06-20 13:06 ` [PATCH v2 16/26] accel/hvf: Add hvf_arch_cpu_realize() stubs Philippe Mathieu-Daudé
2025-06-22 0:24 ` Richard Henderson
2025-06-20 13:07 ` [PATCH v2 17/26] target/arm/hvf: Really set Generic Timer counter frequency Philippe Mathieu-Daudé
2025-06-20 13:07 ` [PATCH v2 18/26] target/arm/hvf: Trace host processor features Philippe Mathieu-Daudé
2025-06-22 0:29 ` Richard Henderson
2025-06-20 13:07 ` [PATCH v2 19/26] hw/arm/virt: Only require TCG || QTest to use TrustZone Philippe Mathieu-Daudé
2025-06-20 13:07 ` [PATCH v2 20/26] hw/arm/virt: Only require TCG || QTest to use virtualization extension Philippe Mathieu-Daudé
2025-06-20 13:07 ` [PATCH v2 21/26] hw/arm/virt: Rename cpu_post_init() -> post_cpus_gic_realized() Philippe Mathieu-Daudé
2025-06-22 0:30 ` Richard Henderson
2025-06-20 13:07 ` [PATCH v2 22/26] hw/arm/sbsa-ref: Tidy up use of RAMLIMIT_GB definition Philippe Mathieu-Daudé
2025-06-22 0:34 ` Richard Henderson
2025-06-20 13:07 ` [PATCH v2 23/26] tests/functional: Restrict nexted Aarch64 Xen test to TCG Philippe Mathieu-Daudé
2025-06-22 0:35 ` Richard Henderson
2025-06-23 8:11 ` Thomas Huth
2025-06-23 11:59 ` Philippe Mathieu-Daudé
2025-06-23 12:05 ` Philippe Mathieu-Daudé
2025-06-20 13:07 ` [PATCH v2 24/26] tests/functional: Require TCG to run Aarch64 imx8mp-evk test Philippe Mathieu-Daudé
2025-06-22 0:37 ` Richard Henderson
2025-06-23 8:19 ` Thomas Huth
2025-06-23 11:54 ` Philippe Mathieu-Daudé
2025-06-20 13:07 ` [PATCH v2 25/26] tests/functional: Add hvf_available() helper Philippe Mathieu-Daudé
2025-06-22 0:38 ` Richard Henderson
2025-06-23 8:20 ` Thomas Huth
2025-06-20 13:07 ` [PATCH v2 26/26] tests/functional: Expand Aarch64 SMMU tests to run on HVF accelerator Philippe Mathieu-Daudé
2025-06-23 8:23 ` Thomas Huth
2025-06-23 11:53 ` Philippe Mathieu-Daudé
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=20250620130709.31073-11-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=agraf@csgraf.de \
--cc=alex.bennee@linaro.org \
--cc=berrange@redhat.com \
--cc=crosa@redhat.com \
--cc=dirty@apple.com \
--cc=eric.auger@redhat.com \
--cc=jsnow@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=leif.lindholm@oss.qualcomm.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=phil@philjordan.eu \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rad@semihalf.com \
--cc=rbolshakov@ddn.com \
--cc=richard.henderson@linaro.org \
--cc=shentey@gmail.com \
--cc=thuth@redhat.com \
/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).