diff options
author | Marcelo Tosatti <mtosatti@redhat.com> | 2008-09-23 12:18:35 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2008-10-15 08:25:21 -0400 |
commit | a7052897b3bcd568a9f5bfaa558957039e7e7ec0 (patch) | |
tree | 5495e806032f0fddf4de1ad4381c9b3f5d49dfbc /arch/x86/kvm/vmx.c | |
parent | 0ba73cdadb8ac172f396df7e23c4a9cebd59b550 (diff) |
KVM: x86: trap invlpg
With pages out of sync invlpg needs to be trapped. For now simply nuke
the entry.
Untested on AMD.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r-- | arch/x86/kvm/vmx.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 025bf4011abc..4556cc3715bb 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -1130,7 +1130,8 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf) | |||
1130 | CPU_BASED_CR3_STORE_EXITING | | 1130 | CPU_BASED_CR3_STORE_EXITING | |
1131 | CPU_BASED_USE_IO_BITMAPS | | 1131 | CPU_BASED_USE_IO_BITMAPS | |
1132 | CPU_BASED_MOV_DR_EXITING | | 1132 | CPU_BASED_MOV_DR_EXITING | |
1133 | CPU_BASED_USE_TSC_OFFSETING; | 1133 | CPU_BASED_USE_TSC_OFFSETING | |
1134 | CPU_BASED_INVLPG_EXITING; | ||
1134 | opt = CPU_BASED_TPR_SHADOW | | 1135 | opt = CPU_BASED_TPR_SHADOW | |
1135 | CPU_BASED_USE_MSR_BITMAPS | | 1136 | CPU_BASED_USE_MSR_BITMAPS | |
1136 | CPU_BASED_ACTIVATE_SECONDARY_CONTROLS; | 1137 | CPU_BASED_ACTIVATE_SECONDARY_CONTROLS; |
@@ -1159,9 +1160,11 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf) | |||
1159 | _cpu_based_exec_control &= ~CPU_BASED_TPR_SHADOW; | 1160 | _cpu_based_exec_control &= ~CPU_BASED_TPR_SHADOW; |
1160 | #endif | 1161 | #endif |
1161 | if (_cpu_based_2nd_exec_control & SECONDARY_EXEC_ENABLE_EPT) { | 1162 | if (_cpu_based_2nd_exec_control & SECONDARY_EXEC_ENABLE_EPT) { |
1162 | /* CR3 accesses don't need to cause VM Exits when EPT enabled */ | 1163 | /* CR3 accesses and invlpg don't need to cause VM Exits when EPT |
1164 | enabled */ | ||
1163 | min &= ~(CPU_BASED_CR3_LOAD_EXITING | | 1165 | min &= ~(CPU_BASED_CR3_LOAD_EXITING | |
1164 | CPU_BASED_CR3_STORE_EXITING); | 1166 | CPU_BASED_CR3_STORE_EXITING | |
1167 | CPU_BASED_INVLPG_EXITING); | ||
1165 | if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_PROCBASED_CTLS, | 1168 | if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_PROCBASED_CTLS, |
1166 | &_cpu_based_exec_control) < 0) | 1169 | &_cpu_based_exec_control) < 0) |
1167 | return -EIO; | 1170 | return -EIO; |
@@ -2790,6 +2793,15 @@ static int handle_vmcall(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
2790 | return 1; | 2793 | return 1; |
2791 | } | 2794 | } |
2792 | 2795 | ||
2796 | static int handle_invlpg(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | ||
2797 | { | ||
2798 | u64 exit_qualification = vmcs_read64(EXIT_QUALIFICATION); | ||
2799 | |||
2800 | kvm_mmu_invlpg(vcpu, exit_qualification); | ||
2801 | skip_emulated_instruction(vcpu); | ||
2802 | return 1; | ||
2803 | } | ||
2804 | |||
2793 | static int handle_wbinvd(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | 2805 | static int handle_wbinvd(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) |
2794 | { | 2806 | { |
2795 | skip_emulated_instruction(vcpu); | 2807 | skip_emulated_instruction(vcpu); |
@@ -2958,6 +2970,7 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu, | |||
2958 | [EXIT_REASON_MSR_WRITE] = handle_wrmsr, | 2970 | [EXIT_REASON_MSR_WRITE] = handle_wrmsr, |
2959 | [EXIT_REASON_PENDING_INTERRUPT] = handle_interrupt_window, | 2971 | [EXIT_REASON_PENDING_INTERRUPT] = handle_interrupt_window, |
2960 | [EXIT_REASON_HLT] = handle_halt, | 2972 | [EXIT_REASON_HLT] = handle_halt, |
2973 | [EXIT_REASON_INVLPG] = handle_invlpg, | ||
2961 | [EXIT_REASON_VMCALL] = handle_vmcall, | 2974 | [EXIT_REASON_VMCALL] = handle_vmcall, |
2962 | [EXIT_REASON_TPR_BELOW_THRESHOLD] = handle_tpr_below_threshold, | 2975 | [EXIT_REASON_TPR_BELOW_THRESHOLD] = handle_tpr_below_threshold, |
2963 | [EXIT_REASON_APIC_ACCESS] = handle_apic_access, | 2976 | [EXIT_REASON_APIC_ACCESS] = handle_apic_access, |