Commit ff241486 authored by Sean Christopherson's avatar Sean Christopherson Committed by Paolo Bonzini

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: default avatarSean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 3e8eaccc
...@@ -9113,34 +9113,16 @@ static void vmx_update_hv_timer(struct kvm_vcpu *vcpu) ...@@ -9113,34 +9113,16 @@ static void vmx_update_hv_timer(struct kvm_vcpu *vcpu)
vmx->loaded_vmcs->hv_timer_armed = false; vmx->loaded_vmcs->hv_timer_armed = false;
} }
static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu) static void nested_sync_from_vmcs12(struct kvm_vcpu *vcpu)
{ {
struct vcpu_vmx *vmx = to_vmx(vcpu); struct vcpu_vmx *vmx = to_vmx(vcpu);
unsigned long cr3, cr4, evmcs_rsp;
/* Record the guest's net vcpu time for enforced NMI injections. */
if (unlikely(!enable_vnmi &&
vmx->loaded_vmcs->soft_vnmi_blocked))
vmx->loaded_vmcs->entry_time = ktime_get();
/* Don't enter VMX if guest state is invalid, let the exit handler
start emulation until we arrive back to a valid state */
if (vmx->emulation_required)
return;
if (vmx->ple_window_dirty) {
vmx->ple_window_dirty = false;
vmcs_write32(PLE_WINDOW, vmx->ple_window);
}
if (vmx->nested.need_vmcs12_sync) {
/* /*
* hv_evmcs may end up being not mapped after migration (when * hv_evmcs may end up being not mapped after migration (when
* L2 was running), map it here to make sure vmcs12 changes are * L2 was running), map it here to make sure vmcs12 changes are
* properly reflected. * properly reflected.
*/ */
if (vmx->nested.enlightened_vmcs_enabled && if (vmx->nested.enlightened_vmcs_enabled && !vmx->nested.hv_evmcs)
!vmx->nested.hv_evmcs)
nested_vmx_handle_enlightened_vmptrld(vcpu, false); nested_vmx_handle_enlightened_vmptrld(vcpu, false);
if (vmx->nested.hv_evmcs) { if (vmx->nested.hv_evmcs) {
...@@ -9151,9 +9133,33 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu) ...@@ -9151,9 +9133,33 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
} else { } else {
copy_vmcs12_to_shadow(vmx); copy_vmcs12_to_shadow(vmx);
} }
vmx->nested.need_vmcs12_sync = false; vmx->nested.need_vmcs12_sync = false;
}
static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
{
struct vcpu_vmx *vmx = to_vmx(vcpu);
unsigned long cr3, cr4, evmcs_rsp;
/* Record the guest's net vcpu time for enforced NMI injections. */
if (unlikely(!enable_vnmi &&
vmx->loaded_vmcs->soft_vnmi_blocked))
vmx->loaded_vmcs->entry_time = ktime_get();
/* Don't enter VMX if guest state is invalid, let the exit handler
start emulation until we arrive back to a valid state */
if (vmx->emulation_required)
return;
if (vmx->ple_window_dirty) {
vmx->ple_window_dirty = false;
vmcs_write32(PLE_WINDOW, vmx->ple_window);
} }
if (vmx->nested.need_vmcs12_sync)
nested_sync_from_vmcs12(vcpu);
if (test_bit(VCPU_REGS_RSP, (unsigned long *)&vcpu->arch.regs_dirty)) if (test_bit(VCPU_REGS_RSP, (unsigned long *)&vcpu->arch.regs_dirty))
vmcs_writel(GUEST_RSP, vcpu->arch.regs[VCPU_REGS_RSP]); vmcs_writel(GUEST_RSP, vcpu->arch.regs[VCPU_REGS_RSP]);
if (test_bit(VCPU_REGS_RIP, (unsigned long *)&vcpu->arch.regs_dirty)) if (test_bit(VCPU_REGS_RIP, (unsigned long *)&vcpu->arch.regs_dirty))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment