From patchwork Wed Feb 11 03:31:11 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sheng Yang X-Patchwork-Id: 6609 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n1B3VM6m030813 for ; Wed, 11 Feb 2009 03:31:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752917AbZBKDbQ (ORCPT ); Tue, 10 Feb 2009 22:31:16 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753287AbZBKDbQ (ORCPT ); Tue, 10 Feb 2009 22:31:16 -0500 Received: from mga14.intel.com ([143.182.124.37]:60156 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752917AbZBKDbQ (ORCPT ); Tue, 10 Feb 2009 22:31:16 -0500 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga102.ch.intel.com with ESMTP; 10 Feb 2009 19:31:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.38,189,1233561600"; d="scan'208";a="109402201" Received: from syang10-desktop.sh.intel.com (HELO syang10-desktop) ([10.239.13.102]) by azsmga001.ch.intel.com with ESMTP; 10 Feb 2009 19:31:14 -0800 Received: from yasker by syang10-desktop with local (Exim 4.69) (envelope-from ) id 1LX5od-0008Li-SS; Wed, 11 Feb 2009 11:31:11 +0800 From: Sheng Yang To: Avi Kivity Cc: Marcelo Tosatti , kvm@vger.kernel.org, Sheng Yang Subject: [PATCH] KVM: VMX: Use kvm_mmu_page_fault() handle EPT violation Date: Wed, 11 Feb 2009 11:31:11 +0800 Message-Id: <1234323071-32076-1-git-send-email-sheng@linux.intel.com> X-Mailer: git-send-email 1.5.6.3 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Removed the unnecessary works. Thanks for Marcelo's reminder. Signed-off-by: Sheng Yang --- arch/x86/kvm/vmx.c | 27 +-------------------------- 1 files changed, 1 insertions(+), 26 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 9913a1d..8704d36 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -3086,32 +3086,7 @@ static int handle_ept_violation(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) } gpa = vmcs_read64(GUEST_PHYSICAL_ADDRESS); - hva = gfn_to_hva(vcpu->kvm, gpa >> PAGE_SHIFT); - if (!kvm_is_error_hva(hva)) { - r = kvm_mmu_page_fault(vcpu, gpa & PAGE_MASK, 0); - if (r < 0) { - printk(KERN_ERR "EPT: Not enough memory!\n"); - return -ENOMEM; - } - return 1; - } else { - /* must be MMIO */ - er = emulate_instruction(vcpu, kvm_run, 0, 0, 0); - - if (er == EMULATE_FAIL) { - printk(KERN_ERR - "EPT: Fail to handle EPT violation vmexit!er is %d\n", - er); - printk(KERN_ERR "EPT: GPA: 0x%lx, GVA: 0x%lx\n", - (long unsigned int)vmcs_read64(GUEST_PHYSICAL_ADDRESS), - (long unsigned int)vmcs_read64(GUEST_LINEAR_ADDRESS)); - printk(KERN_ERR "EPT: Exit qualification is 0x%lx\n", - (long unsigned int)exit_qualification); - return -ENOTSUPP; - } else if (er == EMULATE_DO_MMIO) - return 0; - } - return 1; + return kvm_mmu_page_fault(vcpu, gpa & PAGE_MASK, 0); } static int handle_nmi_window(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)