aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/vmx.c
diff options
context:
space:
mode:
authorSheng Yang <sheng@linux.intel.com>2009-02-11 00:50:40 -0500
committerAvi Kivity <avi@redhat.com>2009-03-24 05:03:09 -0400
commit49cd7d2238e44f7ee4269481cd8a1261cc8f93a5 (patch)
treec9940ce470d45acd34f495fc4e0b495b826e9825 /arch/x86/kvm/vmx.c
parent79950e1073150909619b7c0f9a39a2fea83a42d8 (diff)
KVM: VMX: Use kvm_mmu_page_fault() handle EPT violation mmio
Removed duplicated code. Signed-off-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.c30
1 files changed, 1 insertions, 29 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 509b35305402..cb27ffccf466 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -3058,11 +3058,8 @@ static int handle_task_switch(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
3058static int handle_ept_violation(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) 3058static int handle_ept_violation(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
3059{ 3059{
3060 u64 exit_qualification; 3060 u64 exit_qualification;
3061 enum emulation_result er;
3062 gpa_t gpa; 3061 gpa_t gpa;
3063 unsigned long hva;
3064 int gla_validity; 3062 int gla_validity;
3065 int r;
3066 3063
3067 exit_qualification = vmcs_read64(EXIT_QUALIFICATION); 3064 exit_qualification = vmcs_read64(EXIT_QUALIFICATION);
3068 3065
@@ -3085,32 +3082,7 @@ static int handle_ept_violation(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
3085 } 3082 }
3086 3083
3087 gpa = vmcs_read64(GUEST_PHYSICAL_ADDRESS); 3084 gpa = vmcs_read64(GUEST_PHYSICAL_ADDRESS);
3088 hva = gfn_to_hva(vcpu->kvm, gpa >> PAGE_SHIFT); 3085 return kvm_mmu_page_fault(vcpu, gpa & PAGE_MASK, 0);
3089 if (!kvm_is_error_hva(hva)) {
3090 r = kvm_mmu_page_fault(vcpu, gpa & PAGE_MASK, 0);
3091 if (r < 0) {
3092 printk(KERN_ERR "EPT: Not enough memory!\n");
3093 return -ENOMEM;
3094 }
3095 return 1;
3096 } else {
3097 /* must be MMIO */
3098 er = emulate_instruction(vcpu, kvm_run, 0, 0, 0);
3099
3100 if (er == EMULATE_FAIL) {
3101 printk(KERN_ERR
3102 "EPT: Fail to handle EPT violation vmexit!er is %d\n",
3103 er);
3104 printk(KERN_ERR "EPT: GPA: 0x%lx, GVA: 0x%lx\n",
3105 (long unsigned int)vmcs_read64(GUEST_PHYSICAL_ADDRESS),
3106 (long unsigned int)vmcs_read64(GUEST_LINEAR_ADDRESS));
3107 printk(KERN_ERR "EPT: Exit qualification is 0x%lx\n",
3108 (long unsigned int)exit_qualification);
3109 return -ENOTSUPP;
3110 } else if (er == EMULATE_DO_MMIO)
3111 return 0;
3112 }
3113 return 1;
3114} 3086}
3115 3087
3116static int handle_nmi_window(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) 3088static int handle_nmi_window(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)