KVM: nVMX: Move "vmcs12 to shadow/evmcs sync" to helper function
...so that the function doesn't need to be created when moving the nested code out of vmx.c. Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Родитель
3e8eacccae
Коммит
ff241486ac
|
@ -9113,6 +9113,30 @@ static void vmx_update_hv_timer(struct kvm_vcpu *vcpu)
|
|||
vmx->loaded_vmcs->hv_timer_armed = false;
|
||||
}
|
||||
|
||||
static void nested_sync_from_vmcs12(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
struct vcpu_vmx *vmx = to_vmx(vcpu);
|
||||
|
||||
/*
|
||||
* hv_evmcs may end up being not mapped after migration (when
|
||||
* L2 was running), map it here to make sure vmcs12 changes are
|
||||
* properly reflected.
|
||||
*/
|
||||
if (vmx->nested.enlightened_vmcs_enabled && !vmx->nested.hv_evmcs)
|
||||
nested_vmx_handle_enlightened_vmptrld(vcpu, false);
|
||||
|
||||
if (vmx->nested.hv_evmcs) {
|
||||
copy_vmcs12_to_enlightened(vmx);
|
||||
/* All fields are clean */
|
||||
vmx->nested.hv_evmcs->hv_clean_fields |=
|
||||
HV_VMX_ENLIGHTENED_CLEAN_FIELD_ALL;
|
||||
} else {
|
||||
copy_vmcs12_to_shadow(vmx);
|
||||
}
|
||||
|
||||
vmx->nested.need_vmcs12_sync = false;
|
||||
}
|
||||
|
||||
static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
struct vcpu_vmx *vmx = to_vmx(vcpu);
|
||||
|
@ -9133,26 +9157,8 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
|
|||
vmcs_write32(PLE_WINDOW, vmx->ple_window);
|
||||
}
|
||||
|
||||
if (vmx->nested.need_vmcs12_sync) {
|
||||
/*
|
||||
* hv_evmcs may end up being not mapped after migration (when
|
||||
* L2 was running), map it here to make sure vmcs12 changes are
|
||||
* properly reflected.
|
||||
*/
|
||||
if (vmx->nested.enlightened_vmcs_enabled &&
|
||||
!vmx->nested.hv_evmcs)
|
||||
nested_vmx_handle_enlightened_vmptrld(vcpu, false);
|
||||
|
||||
if (vmx->nested.hv_evmcs) {
|
||||
copy_vmcs12_to_enlightened(vmx);
|
||||
/* All fields are clean */
|
||||
vmx->nested.hv_evmcs->hv_clean_fields |=
|
||||
HV_VMX_ENLIGHTENED_CLEAN_FIELD_ALL;
|
||||
} else {
|
||||
copy_vmcs12_to_shadow(vmx);
|
||||
}
|
||||
vmx->nested.need_vmcs12_sync = false;
|
||||
}
|
||||
if (vmx->nested.need_vmcs12_sync)
|
||||
nested_sync_from_vmcs12(vcpu);
|
||||
|
||||
if (test_bit(VCPU_REGS_RSP, (unsigned long *)&vcpu->arch.regs_dirty))
|
||||
vmcs_writel(GUEST_RSP, vcpu->arch.regs[VCPU_REGS_RSP]);
|
||||
|
|
Загрузка…
Ссылка в новой задаче