[PATCH v4 12/15] target/arm: hvf: when the platform irqchip is used, abort on writes to the ptimer

Mohamed Mediouni posted 15 patches 3 months, 2 weeks ago
Maintainers: Cameron Esfahani <dirty@apple.com>, Roman Bolshakov <rbolshakov@ddn.com>, Phil Dennis-Jordan <phil@philjordan.eu>, Mads Ynddal <mads@ynddal.dk>, Shannon Zhao <shannon.zhaosl@gmail.com>, Peter Maydell <peter.maydell@linaro.org>, "Michael S. Tsirkin" <mst@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Ani Sinha <anisinha@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Alexander Graf <agraf@csgraf.de>
There is a newer version of this series
[PATCH v4 12/15] target/arm: hvf: when the platform irqchip is used, abort on writes to the ptimer
Posted by Mohamed Mediouni 3 months, 2 weeks ago
In that case, this code path should never be triggerable as timer emulation is handled by the platform.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
---
 target/arm/hvf/hvf.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index afe09a216e..64cca9aa18 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -1401,9 +1401,15 @@ static int hvf_sysreg_read(CPUState *cpu, uint32_t reg, uint64_t *val)
         assert_hvf_ok(hv_vcpu_get_sys_reg(cpu->accel->fd, HV_SYS_REG_CNTHCTL_EL2, val));
         return 0;
     case SYSREG_CNTP_CTL_EL0:
+        if (hvf_irqchip_in_kernel()) {
+            abort();
+        }
         qemu_log_mask(LOG_UNIMP, "Unsupported read from CNTP_CTL_EL0\n");
         return 0;
     case SYSREG_CNTP_CVAL_EL0:
+        if (hvf_irqchip_in_kernel()) {
+            abort();
+        }
         qemu_log_mask(LOG_UNIMP, "Unsupported read from CNTP_CVAL_EL0\n");
         return 0;
     case SYSREG_MDCCINT_EL1:
@@ -1720,6 +1726,9 @@ static int hvf_sysreg_write(CPUState *cpu, uint32_t reg, uint64_t val)
         env->cp15.oslsr_el1 = val & 1;
         return 0;
     case SYSREG_CNTP_CTL_EL0:
+        if (hvf_irqchip_in_kernel()) {
+            abort();
+        }
         /*
          * Guests should not rely on the physical counter, but macOS emits
          * disable writes to it. Let it do so, but ignore the requests.
@@ -1727,6 +1736,9 @@ static int hvf_sysreg_write(CPUState *cpu, uint32_t reg, uint64_t val)
         qemu_log_mask(LOG_UNIMP, "Unsupported write to CNTP_CTL_EL0\n");
         return 0;
     case SYSREG_CNTP_CVAL_EL0:
+        if (hvf_irqchip_in_kernel()) {
+            abort();
+        }
         qemu_log_mask(LOG_UNIMP, "Unsupported write to CNTP_CVAL_EL0\n");
         return 0;
     case SYSREG_OSDLR_EL1:
-- 
2.39.5 (Apple Git-154)