@@ -9113,6 +9113,30 @@ static void vmx_update_hv_timer(struct kvm_vcpu *vcpu)
9113
9113
vmx -> loaded_vmcs -> hv_timer_armed = false;
9114
9114
}
9115
9115
9116
+ static void nested_sync_from_vmcs12 (struct kvm_vcpu * vcpu )
9117
+ {
9118
+ struct vcpu_vmx * vmx = to_vmx (vcpu );
9119
+
9120
+ /*
9121
+ * hv_evmcs may end up being not mapped after migration (when
9122
+ * L2 was running), map it here to make sure vmcs12 changes are
9123
+ * properly reflected.
9124
+ */
9125
+ if (vmx -> nested .enlightened_vmcs_enabled && !vmx -> nested .hv_evmcs )
9126
+ nested_vmx_handle_enlightened_vmptrld (vcpu , false);
9127
+
9128
+ if (vmx -> nested .hv_evmcs ) {
9129
+ copy_vmcs12_to_enlightened (vmx );
9130
+ /* All fields are clean */
9131
+ vmx -> nested .hv_evmcs -> hv_clean_fields |=
9132
+ HV_VMX_ENLIGHTENED_CLEAN_FIELD_ALL ;
9133
+ } else {
9134
+ copy_vmcs12_to_shadow (vmx );
9135
+ }
9136
+
9137
+ vmx -> nested .need_vmcs12_sync = false;
9138
+ }
9139
+
9116
9140
static void __noclone vmx_vcpu_run (struct kvm_vcpu * vcpu )
9117
9141
{
9118
9142
struct vcpu_vmx * vmx = to_vmx (vcpu );
@@ -9133,26 +9157,8 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
9133
9157
vmcs_write32 (PLE_WINDOW , vmx -> ple_window );
9134
9158
}
9135
9159
9136
- if (vmx -> nested .need_vmcs12_sync ) {
9137
- /*
9138
- * hv_evmcs may end up being not mapped after migration (when
9139
- * L2 was running), map it here to make sure vmcs12 changes are
9140
- * properly reflected.
9141
- */
9142
- if (vmx -> nested .enlightened_vmcs_enabled &&
9143
- !vmx -> nested .hv_evmcs )
9144
- nested_vmx_handle_enlightened_vmptrld (vcpu , false);
9145
-
9146
- if (vmx -> nested .hv_evmcs ) {
9147
- copy_vmcs12_to_enlightened (vmx );
9148
- /* All fields are clean */
9149
- vmx -> nested .hv_evmcs -> hv_clean_fields |=
9150
- HV_VMX_ENLIGHTENED_CLEAN_FIELD_ALL ;
9151
- } else {
9152
- copy_vmcs12_to_shadow (vmx );
9153
- }
9154
- vmx -> nested .need_vmcs12_sync = false;
9155
- }
9160
+ if (vmx -> nested .need_vmcs12_sync )
9161
+ nested_sync_from_vmcs12 (vcpu );
9156
9162
9157
9163
if (test_bit (VCPU_REGS_RSP , (unsigned long * )& vcpu -> arch .regs_dirty ))
9158
9164
vmcs_writel (GUEST_RSP , vcpu -> arch .regs [VCPU_REGS_RSP ]);
0 commit comments