@samitouri / QOSamiQemu / commits / e2840efd97

target/i386/mshv: reconstruct hflags after load

hflags is a cached bitmap derived from standard and special regs. We want to reconstruct this state after regs and sregs have been read from the hypervisor, similar to how it's one in other accelerators. Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com> Link: https://lore.kernel.org/r/20260417105618.3621-33-magnuskulke@linux.microsoft.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Magnus Kulke committed Apr 17, 2026 at 12:56 UTC e2840efd973c8280ccaefb5713dde54f8ee36d5f
1 file changed +13
target/i386/mshv/mshv-cpu.c
+13
@@ -765,6 +765,16 @@ static int set_vcpu_events(const CPUState *cpu)
765 return 0;
766 }
767
768 +static int update_hflags(CPUState *cpu)
769 +{
770 + X86CPU *x86cpu = X86_CPU(cpu);
771 + CPUX86State *env = &x86cpu->env;
772 +
773 + x86_update_hflags(env);
774 +
775 + return 0;
776 +}
777 +
778 int mshv_arch_load_vcpu_state(CPUState *cpu)
779 {
780 int ret;
@@ -779,6 +789,9 @@ int mshv_arch_load_vcpu_state(CPUState *cpu)
789 return ret;
790 }
791
792 + /* INVARIANT: hflags are derived from regs+sregs, need to get both first */
793 + update_hflags(cpu);
794 +
795 ret = get_xc_reg(cpu);
796 if (ret < 0) {
797 return ret;