aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/vmx.c
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2009-10-26 14:48:33 -0400
committerAvi Kivity <avi@redhat.com>2009-12-03 02:32:22 -0500
commit7c93be44a4790b0fd9dddf29c5503cf86c105304 (patch)
tree1c7b1d315b9e186b286843c30c54ca8c70f168c0 /arch/x86/kvm/vmx.c
parent1655e3a3dc16e21b60d9950e201b38a9894f1bcf (diff)
KVM: VMX: move CR3/PDPTR update to vmx_set_cr3
GUEST_CR3 is updated via kvm_set_cr3 whenever CR3 is modified from outside guest context. Similarly pdptrs are updated via load_pdptrs. Let kvm_set_cr3 perform the update, removing it from the vcpu_run fast path. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Acked-by: Acked-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r--arch/x86/kvm/vmx.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index bf46253149c..a5f3f3ec69e 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -1737,6 +1737,7 @@ static void vmx_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3)
1737 vmcs_write64(EPT_POINTER, eptp); 1737 vmcs_write64(EPT_POINTER, eptp);
1738 guest_cr3 = is_paging(vcpu) ? vcpu->arch.cr3 : 1738 guest_cr3 = is_paging(vcpu) ? vcpu->arch.cr3 :
1739 vcpu->kvm->arch.ept_identity_map_addr; 1739 vcpu->kvm->arch.ept_identity_map_addr;
1740 ept_load_pdptrs(vcpu);
1740 } 1741 }
1741 1742
1742 vmx_flush_tlb(vcpu); 1743 vmx_flush_tlb(vcpu);
@@ -3625,10 +3626,6 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu)
3625{ 3626{
3626 struct vcpu_vmx *vmx = to_vmx(vcpu); 3627 struct vcpu_vmx *vmx = to_vmx(vcpu);
3627 3628
3628 if (enable_ept && is_paging(vcpu)) {
3629 vmcs_writel(GUEST_CR3, vcpu->arch.cr3);
3630 ept_load_pdptrs(vcpu);
3631 }
3632 /* Record the guest's net vcpu time for enforced NMI injections. */ 3629 /* Record the guest's net vcpu time for enforced NMI injections. */
3633 if (unlikely(!cpu_has_virtual_nmis() && vmx->soft_vnmi_blocked)) 3630 if (unlikely(!cpu_has_virtual_nmis() && vmx->soft_vnmi_blocked))
3634 vmx->entry_time = ktime_get(); 3631 vmx->entry_time = ktime_get();