'need_vmcs12_to_shadow_sync' is used for both shadow and enlightened
VMCS sync when we exit to L1. The comment in nested_vmx_failValid()
validly states why shadow vmcs sync can be omitted but this doesn't
apply to enlightened VMCS as it 'shadows' all VMCS12 fields.
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <
20210526132026.270394-9-vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
                        | X86_EFLAGS_ZF);
        get_vmcs12(vcpu)->vm_instruction_error = vm_instruction_error;
        /*
-        * We don't need to force a shadow sync because
-        * VM_INSTRUCTION_ERROR is not shadowed
+        * We don't need to force sync to shadow VMCS because
+        * VM_INSTRUCTION_ERROR is not shadowed. Enlightened VMCS 'shadows' all
+        * fields and thus must be synced.
         */
+       if (to_vmx(vcpu)->nested.hv_evmcs_vmptr != EVMPTR_INVALID)
+               to_vmx(vcpu)->nested.need_vmcs12_to_shadow_sync = true;
+
        return kvm_skip_emulated_instruction(vcpu);
 }