@samitouri / QOSamiQemu / commits / 28b0ed32b3

Revert "target/arm/hvf: Sync CNTV_CTL_EL0 & CNTV_CVAL_EL0"

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> Tested-by: Zenghui Yu <zenghui.yu@linux.dev> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Mohamed Mediouni committed Feb 26, 2026 at 11:27 UTC 28b0ed32b32c7e5094cf2f1ec9c0645c65fad2aa
1 file changed -25
target/arm/hvf/hvf.c
-25
@@ -200,9 +200,6 @@ void hvf_arm_init_debug(void)
200 #define SYSREG_PMCEID0_EL0 SYSREG(3, 3, 9, 12, 6)
201 #define SYSREG_PMCEID1_EL0 SYSREG(3, 3, 9, 12, 7)
202 #define SYSREG_PMCCNTR_EL0 SYSREG(3, 3, 9, 13, 0)
203 -
204 -#define SYSREG_CNTV_CTL_EL0 SYSREG(3, 3, 14, 3, 1)
205 -#define SYSREG_CNTV_CVAL_EL0 SYSREG(3, 3, 14, 3, 2)
203 #define SYSREG_PMCCFILTR_EL0 SYSREG(3, 3, 14, 15, 7)
204
205 #define SYSREG_ICC_AP0R0_EL1 SYSREG(3, 0, 12, 8, 4)
@@ -505,7 +502,6 @@ int hvf_arch_get_registers(CPUState *cpu)
502 uint64_t val;
503 hv_simd_fp_uchar16_t fpval;
504 int i, n;
508 - bool b;
505
506 for (i = 0; i < ARRAY_SIZE(hvf_reg_match); i++) {
507 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)
631
632 aarch64_restore_sp(env, arm_current_el(env));
633
638 - ret = hv_vcpu_get_sys_reg(cpu->accel->fd, HV_SYS_REG_CNTV_CVAL_EL0, &val);
639 - assert_hvf_ok(ret);
640 - b = hvf_sysreg_write_cp(cpu, "VTimer", SYSREG_CNTV_CVAL_EL0, val);
641 - assert(b);
642 -
643 - ret = hv_vcpu_get_sys_reg(cpu->accel->fd, HV_SYS_REG_CNTV_CTL_EL0, &val);
644 - assert_hvf_ok(ret);
645 - b = hvf_sysreg_write_cp(cpu, "VTimer", SYSREG_CNTV_CTL_EL0, val);
646 - assert(b);
647 -
634 return 0;
635 }
636
@@ -656,7 +642,6 @@ int hvf_arch_put_registers(CPUState *cpu)
642 uint64_t val;
643 hv_simd_fp_uchar16_t fpval;
644 int i, n;
659 - bool b;
645
646 for (i = 0; i < ARRAY_SIZE(hvf_reg_match); i++) {
647 val = *(uint64_t *)((void *)env + hvf_reg_match[i].offset);
@@ -771,16 +756,6 @@ int hvf_arch_put_registers(CPUState *cpu)
756 ret = hv_vcpu_set_vtimer_offset(cpu->accel->fd, hvf_state->vtimer_offset);
757 assert_hvf_ok(ret);
758
774 - b = hvf_sysreg_read_cp(cpu, "VTimer", SYSREG_CNTV_CVAL_EL0, &val);
775 - assert(b);
776 - ret = hv_vcpu_set_sys_reg(cpu->accel->fd, HV_SYS_REG_CNTV_CVAL_EL0, val);
777 - assert_hvf_ok(ret);
778 -
779 - b = hvf_sysreg_read_cp(cpu, "VTimer", SYSREG_CNTV_CTL_EL0, &val);
780 - assert(b);
781 - ret = hv_vcpu_set_sys_reg(cpu->accel->fd, HV_SYS_REG_CNTV_CTL_EL0, val);
782 - assert_hvf_ok(ret);
783 -
759 return 0;
760 }
761