diff options
author | Sheng Yang <sheng.yang@intel.com> | 2008-07-15 21:25:40 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-07-27 04:34:10 -0400 |
commit | 5fdbcb9dd16f1e89ead127d3ee1a38e3a00cf1ea (patch) | |
tree | 65db37eb2a83a60148c420f76a5b0e2c53b66e38 /arch/x86/kvm/vmx.c | |
parent | 5ec5726a16245138f5d5305b00a752acb5730076 (diff) |
KVM: VMX: Fix undefined beaviour of EPT after reload kvm-intel.ko
As well as move set base/mask ptes to vmx_init().
Signed-off-by: Sheng Yang <sheng.yang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r-- | arch/x86/kvm/vmx.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index f71151d999e4..2a69773e3b26 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -3118,15 +3118,6 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id) | |||
3118 | return ERR_PTR(-ENOMEM); | 3118 | return ERR_PTR(-ENOMEM); |
3119 | 3119 | ||
3120 | allocate_vpid(vmx); | 3120 | allocate_vpid(vmx); |
3121 | if (id == 0 && vm_need_ept()) { | ||
3122 | kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK | | ||
3123 | VMX_EPT_WRITABLE_MASK | | ||
3124 | VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT); | ||
3125 | kvm_mmu_set_mask_ptes(0ull, VMX_EPT_FAKE_ACCESSED_MASK, | ||
3126 | VMX_EPT_FAKE_DIRTY_MASK, 0ull, | ||
3127 | VMX_EPT_EXECUTABLE_MASK); | ||
3128 | kvm_enable_tdp(); | ||
3129 | } | ||
3130 | 3121 | ||
3131 | err = kvm_vcpu_init(&vmx->vcpu, kvm, id); | 3122 | err = kvm_vcpu_init(&vmx->vcpu, kvm, id); |
3132 | if (err) | 3123 | if (err) |
@@ -3305,8 +3296,17 @@ static int __init vmx_init(void) | |||
3305 | vmx_disable_intercept_for_msr(vmx_msr_bitmap, MSR_IA32_SYSENTER_ESP); | 3296 | vmx_disable_intercept_for_msr(vmx_msr_bitmap, MSR_IA32_SYSENTER_ESP); |
3306 | vmx_disable_intercept_for_msr(vmx_msr_bitmap, MSR_IA32_SYSENTER_EIP); | 3297 | vmx_disable_intercept_for_msr(vmx_msr_bitmap, MSR_IA32_SYSENTER_EIP); |
3307 | 3298 | ||
3308 | if (vm_need_ept()) | 3299 | if (vm_need_ept()) { |
3309 | bypass_guest_pf = 0; | 3300 | bypass_guest_pf = 0; |
3301 | kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK | | ||
3302 | VMX_EPT_WRITABLE_MASK | | ||
3303 | VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT); | ||
3304 | kvm_mmu_set_mask_ptes(0ull, VMX_EPT_FAKE_ACCESSED_MASK, | ||
3305 | VMX_EPT_FAKE_DIRTY_MASK, 0ull, | ||
3306 | VMX_EPT_EXECUTABLE_MASK); | ||
3307 | kvm_enable_tdp(); | ||
3308 | } else | ||
3309 | kvm_disable_tdp(); | ||
3310 | 3310 | ||
3311 | if (bypass_guest_pf) | 3311 | if (bypass_guest_pf) |
3312 | kvm_mmu_set_nonpresent_ptes(~0xffeull, 0ull); | 3312 | kvm_mmu_set_nonpresent_ptes(~0xffeull, 0ull); |