[PATCH v10 01/14] Revert "target/arm/hvf: Sync CNTV_CTL_EL0 & CNTV_CVAL_EL0"

Mohamed Mediouni posted 14 patches 1 month, 3 weeks ago
Maintainers: Cameron Esfahani <dirty@apple.com>, Roman Bolshakov <rbolshakov@ddn.com>, Phil Dennis-Jordan <phil@philjordan.eu>, Peter Maydell <peter.maydell@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Alexander Graf <agraf@csgraf.de>
There is a newer version of this series
[PATCH v10 01/14] Revert "target/arm/hvf: Sync CNTV_CTL_EL0 & CNTV_CVAL_EL0"
Posted by Mohamed Mediouni 1 month, 3 weeks ago
This reverts commit bfbea371ef2cabc47effac5a286e2644d727a8d6.

This commit breaks VM save/restore:

Assertion failed: (b), function hvf_arch_get_registers, file hvf.c, line 667.
zsh: abort      ./qemu-system-aarch64 -m 8192 -M virt,accel=hvf -cdrom  -device virtio-gpu

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

diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index 1b19d9713e..d79469ca27 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -200,9 +200,6 @@ 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_CNTV_CTL_EL0   SYSREG(3, 3, 14, 3, 1)
-#define SYSREG_CNTV_CVAL_EL0  SYSREG(3, 3, 14, 3, 2)
 #define SYSREG_PMCCFILTR_EL0  SYSREG(3, 3, 14, 15, 7)
 
 #define SYSREG_ICC_AP0R0_EL1     SYSREG(3, 0, 12, 8, 4)
@@ -505,7 +502,6 @@ int hvf_arch_get_registers(CPUState *cpu)
     uint64_t val;
     hv_simd_fp_uchar16_t fpval;
     int i, n;
-    bool b;
 
     for (i = 0; i < ARRAY_SIZE(hvf_reg_match); i++) {
         ret = hv_vcpu_get_reg(cpu->accel->fd, hvf_reg_match[i].reg, &val);
@@ -635,16 +631,6 @@ int hvf_arch_get_registers(CPUState *cpu)
 
     aarch64_restore_sp(env, arm_current_el(env));
 
-    ret = hv_vcpu_get_sys_reg(cpu->accel->fd, HV_SYS_REG_CNTV_CVAL_EL0, &val);
-    assert_hvf_ok(ret);
-    b = hvf_sysreg_write_cp(cpu, "VTimer", SYSREG_CNTV_CVAL_EL0, val);
-    assert(b);
-
-    ret = hv_vcpu_get_sys_reg(cpu->accel->fd, HV_SYS_REG_CNTV_CTL_EL0, &val);
-    assert_hvf_ok(ret);
-    b = hvf_sysreg_write_cp(cpu, "VTimer", SYSREG_CNTV_CTL_EL0, val);
-    assert(b);
-
     return 0;
 }
 
@@ -656,7 +642,6 @@ int hvf_arch_put_registers(CPUState *cpu)
     uint64_t val;
     hv_simd_fp_uchar16_t fpval;
     int i, n;
-    bool b;
 
     for (i = 0; i < ARRAY_SIZE(hvf_reg_match); i++) {
         val = *(uint64_t *)((void *)env + hvf_reg_match[i].offset);
@@ -771,16 +756,6 @@ int hvf_arch_put_registers(CPUState *cpu)
     ret = hv_vcpu_set_vtimer_offset(cpu->accel->fd, hvf_state->vtimer_offset);
     assert_hvf_ok(ret);
 
-    b = hvf_sysreg_read_cp(cpu, "VTimer", SYSREG_CNTV_CVAL_EL0, &val);
-    assert(b);
-    ret = hv_vcpu_set_sys_reg(cpu->accel->fd, HV_SYS_REG_CNTV_CVAL_EL0, val);
-    assert_hvf_ok(ret);
-
-    b = hvf_sysreg_read_cp(cpu, "VTimer", SYSREG_CNTV_CTL_EL0, &val);
-    assert(b);
-    ret = hv_vcpu_set_sys_reg(cpu->accel->fd, HV_SYS_REG_CNTV_CTL_EL0, val);
-    assert_hvf_ok(ret);
-
     return 0;
 }
 
-- 
2.50.1 (Apple Git-155)
Re: [PATCH v10 01/14] Revert "target/arm/hvf: Sync CNTV_CTL_EL0 & CNTV_CVAL_EL0"
Posted by Peter Maydell 1 month, 2 weeks ago
On Sun, 15 Feb 2026 at 11:25, Mohamed Mediouni <mohamed@unpredictable.fr> wrote:
>
> This reverts commit bfbea371ef2cabc47effac5a286e2644d727a8d6.
>
> This commit breaks VM save/restore:
>
> Assertion failed: (b), function hvf_arch_get_registers, file hvf.c, line 667.
> zsh: abort      ./qemu-system-aarch64 -m 8192 -M virt,accel=hvf -cdrom  -device virtio-gpu
>
> Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
> --

As this patch is a revert to fix a regression, I've picked it
up for target-arm.next so it isn't held up by review of the
rest of this series. Let me know if you'd rather I didn't do that.

-- PMM
Re: [PATCH v10 01/14] Revert "target/arm/hvf: Sync CNTV_CTL_EL0 & CNTV_CVAL_EL0"
Posted by Zenghui Yu 1 month, 3 weeks ago
On 2/15/26 7:25 PM, Mohamed Mediouni wrote:
> This reverts commit bfbea371ef2cabc47effac5a286e2644d727a8d6.
> 
> This commit breaks VM save/restore:
> 
> Assertion failed: (b), function hvf_arch_get_registers, file hvf.c, line 667.
> zsh: abort      ./qemu-system-aarch64 -m 8192 -M virt,accel=hvf -cdrom  -device virtio-gpu
> 
> Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
> ---
>  target/arm/hvf/hvf.c | 25 -------------------------
>  1 file changed, 25 deletions(-)

Tested-by: Zenghui Yu <zenghui.yu@linux.dev>

Thanks,
Zenghui