From patchwork Wed Jul 29 12:56:31 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 38133 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 n6TD1goL014016 for ; Wed, 29 Jul 2009 13:01:43 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754983AbZG2M52 (ORCPT ); Wed, 29 Jul 2009 08:57:28 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754731AbZG2M51 (ORCPT ); Wed, 29 Jul 2009 08:57:27 -0400 Received: from sg2ehsobe005.messaging.microsoft.com ([207.46.51.79]:18767 "EHLO SG2EHSOBE005.bigfish.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754798AbZG2M5L (ORCPT ); Wed, 29 Jul 2009 08:57:11 -0400 Received: from mail3-sin-R.bigfish.com (10.210.100.242) by SG2EHSOBE005.bigfish.com (10.210.112.25) with Microsoft SMTP Server id 8.1.340.0; Wed, 29 Jul 2009 12:57:10 +0000 Received: from mail3-sin (localhost.localdomain [127.0.0.1]) by mail3-sin-R.bigfish.com (Postfix) with ESMTP id A2B1E1770187; Wed, 29 Jul 2009 12:56:54 +0000 (UTC) X-SpamScore: 13 X-BigFish: VPS13(z1857rzzz1202hzzz32i203h43j63h) X-Spam-TCS-SCL: 2:0 Received: by mail3-sin (MessageSwitch) id 1248872213230148_7964; Wed, 29 Jul 2009 12:56:53 +0000 (UCT) Received: from svlb1extmailp02.amd.com (unknown [139.95.251.11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail3-sin.bigfish.com (Postfix) with ESMTP id 0B5A7131005C; Wed, 29 Jul 2009 12:56:48 +0000 (UTC) Received: from svlb1twp01.amd.com ([139.95.250.34]) by svlb1extmailp02.amd.com (Switch-3.2.7/Switch-3.2.7) with ESMTP id n6TCutiP009033; Wed, 29 Jul 2009 05:56:58 -0700 X-WSS-ID: 0KNJNYG-03-5SS-01 Received: from SSVLEXBH2.amd.com (ssvlexbh2.amd.com [139.95.53.183]) by svlb1twp01.amd.com (Tumbleweed MailGate 3.5.1) with ESMTP id 2E79C88494D; Wed, 29 Jul 2009 05:56:40 -0700 (PDT) Received: from ssvlexmb2.amd.com ([139.95.53.7]) by SSVLEXBH2.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 29 Jul 2009 05:56:45 -0700 Received: from SF30EXMB1.amd.com ([172.20.6.49]) by ssvlexmb2.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 29 Jul 2009 05:56:45 -0700 Received: from seurexmb1.amd.com ([165.204.9.130]) by SF30EXMB1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 29 Jul 2009 14:56:39 +0200 Received: from lemmy.amd.com ([165.204.15.93]) by seurexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 29 Jul 2009 14:56:36 +0200 Received: by lemmy.amd.com (Postfix, from userid 41430) id 884B1CA031; Wed, 29 Jul 2009 14:56:36 +0200 (CEST) From: Joerg Roedel To: Avi Kivity CC: Alexander Graf , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Joerg Roedel Subject: [PATCH 11/12] kvm/svm: handle #pf intercepts in nested_svm_exit_handled directly Date: Wed, 29 Jul 2009 14:56:31 +0200 Message-ID: <1248872192-30881-12-git-send-email-joerg.roedel@amd.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1248872192-30881-1-git-send-email-joerg.roedel@amd.com> References: <1248872192-30881-1-git-send-email-joerg.roedel@amd.com> X-OriginalArrivalTime: 29 Jul 2009 12:56:36.0983 (UTC) FILETIME=[01F45870:01CA104C] MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Signed-off-by: Joerg Roedel Acked-by: Alexander Graf --- arch/x86/kvm/svm.c | 26 ++++++++++++++++++++++++-- 1 files changed, 24 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 1a44e43..381ed38 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -1498,6 +1498,9 @@ static int nested_svm_exit_handled_msr(struct vcpu_svm *svm, return 0; } +/* + * If this function returns true, this #vmexit was already handled + */ static int nested_svm_exit_handled(struct vcpu_svm *svm, bool kvm_override) { u32 exit_code = svm->vmcb->control.exit_code; @@ -1515,8 +1518,27 @@ static int nested_svm_exit_handled(struct vcpu_svm *svm, bool kvm_override) break; /* When we're shadowing, trap PFs */ case SVM_EXIT_EXCP_BASE + PF_VECTOR: - if (!npt_enabled) - return 0; + if (!npt_enabled) { + u64 fault_address; + u32 error_code; + + fault_address = svm->vmcb->control.exit_info_2; + error_code = svm->vmcb->control.exit_info_1; + + kvm_mmu_page_fault(&svm->vcpu, + fault_address, + error_code); + + /* + * If we are still nested here the pending + * irqs/exceptions must be reinjected + */ + //if (is_nested(svm)) + // svm_complete_interrupts(svm); + + return true; + } + break; default: break;