@samitouri / QOSamiQemu / commits / abdd572a43

accel/mshv: Replace @dirty field by generic CPUState::vcpu_dirty field

No need for accel-specific @dirty field when we have a generic one in CPUState. (Other accelerators already did that in commits 6f13a0ada01..36ab216b81d). Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Tested-by: Magnus Kulke <magnuskulke@linux.microsoft.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-ID: <20260705215729.62196-6-philmd@oss.qualcomm.com>

Philippe Mathieu-Daudé committed Jun 30, 2026 at 14:44 UTC abdd572a4380739b8eb8461bda9f720905dcf56c
3 files changed +12 -13
accel/mshv/mshv-all.c
+9 -9
@@ -531,7 +531,7 @@ static int mshv_init_vcpu(CPUState *cpu)
531 }
532
533 mshv_arch_init_vcpu(cpu);
534 - cpu->accel->dirty = true;
534 + cpu->vcpu_dirty = true;
535
536 return 0;
537 }
@@ -617,7 +617,7 @@ static int mshv_cpu_exec(CPUState *cpu)
617 cpu_exec_start(cpu);
618
619 do {
620 - if (cpu->accel->dirty) {
620 + if (cpu->vcpu_dirty) {
621 ret = mshv_arch_store_vcpu_state(cpu);
622 if (ret) {
623 error_report("Failed to put registers after init: %s",
@@ -625,7 +625,7 @@ static int mshv_cpu_exec(CPUState *cpu)
625 ret = -1;
626 break;
627 }
628 - cpu->accel->dirty = false;
628 + cpu->vcpu_dirty = false;
629 }
630
631 ret = mshv_run_vcpu(mshv_state->vm, cpu, &mshv_msg, &exit_reason);
@@ -746,7 +746,7 @@ static void do_mshv_cpu_synchronize_post_init(CPUState *cpu,
746 abort();
747 }
748
749 - cpu->accel->dirty = false;
749 + cpu->vcpu_dirty = false;
750 }
751
752 static void mshv_cpu_synchronize_post_init(CPUState *cpu)
@@ -763,13 +763,13 @@ static void mshv_cpu_synchronize_post_reset(CPUState *cpu)
763 cpu_dump_state(cpu, stderr, CPU_DUMP_CODE);
764 vm_stop(RUN_STATE_INTERNAL_ERROR);
765 }
766 - cpu->accel->dirty = false;
766 + cpu->vcpu_dirty = false;
767 }
768
769 static void do_mshv_cpu_synchronize_pre_loadvm(CPUState *cpu,
770 run_on_cpu_data arg)
771 {
772 - cpu->accel->dirty = true;
772 + cpu->vcpu_dirty = true;
773 }
774
775 static void mshv_cpu_synchronize_pre_loadvm(CPUState *cpu)
@@ -779,7 +779,7 @@ static void mshv_cpu_synchronize_pre_loadvm(CPUState *cpu)
779
780 static void do_mshv_cpu_synchronize(CPUState *cpu, run_on_cpu_data arg)
781 {
782 - if (!cpu->accel->dirty) {
782 + if (!cpu->vcpu_dirty) {
783 int ret = mshv_arch_load_vcpu_state(cpu);
784 if (ret < 0) {
785 error_report("Failed to load registers for vcpu %d",
@@ -789,13 +789,13 @@ static void do_mshv_cpu_synchronize(CPUState *cpu, run_on_cpu_data arg)
789 vm_stop(RUN_STATE_INTERNAL_ERROR);
790 }
791
792 - cpu->accel->dirty = true;
792 + cpu->vcpu_dirty = true;
793 }
794 }
795
796 static void mshv_cpu_synchronize(CPUState *cpu)
797 {
798 - if (!cpu->accel->dirty) {
798 + if (!cpu->vcpu_dirty) {
799 run_on_cpu(cpu, do_mshv_cpu_synchronize, RUN_ON_CPU_NULL);
800 }
801 }
include/system/mshv_int.h
-1
@@ -43,7 +43,6 @@ typedef struct MshvHvCallArgs {
43
44 struct AccelCPUState {
45 int cpufd;
46 - bool dirty;
46 MshvHvCallArgs hvcall_args;
47 };
48
target/i386/mshv/mshv-cpu.c
+3 -3
@@ -1692,7 +1692,7 @@ static int pio_write(uint64_t port, const uint8_t *data, uintptr_t size,
1692 return ret;
1693 }
1694
1695 -static int handle_pio_non_str(const CPUState *cpu,
1695 +static int handle_pio_non_str(CPUState *cpu,
1696 hv_x64_io_port_intercept_message *info)
1697 {
1698 size_t len = info->access_info.access_size;
@@ -1748,7 +1748,7 @@ static int handle_pio_non_str(const CPUState *cpu,
1748 return -1;
1749 }
1750
1751 - cpu->accel->dirty = false;
1751 + cpu->vcpu_dirty = false;
1752
1753 return 0;
1754 }
@@ -1909,7 +1909,7 @@ static int handle_pio_str(CPUState *cpu, hv_x64_io_port_intercept_message *info)
1909 return -1;
1910 }
1911
1912 - cpu->accel->dirty = false;
1912 + cpu->vcpu_dirty = false;
1913
1914 return 0;
1915 }