From patchwork Thu Feb 18 11:38:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 80276 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o1IBeHwP027792 for ; Thu, 18 Feb 2010 11:40:18 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757975Ab0BRLjG (ORCPT ); Thu, 18 Feb 2010 06:39:06 -0500 Received: from va3ehsobe003.messaging.microsoft.com ([216.32.180.13]:16507 "EHLO VA3EHSOBE003.bigfish.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757957Ab0BRLjA (ORCPT ); Thu, 18 Feb 2010 06:39:00 -0500 Received: from mail187-va3-R.bigfish.com (10.7.14.247) by VA3EHSOBE003.bigfish.com (10.7.40.23) with Microsoft SMTP Server id 8.1.240.5; Thu, 18 Feb 2010 11:38:59 +0000 Received: from mail187-va3 (localhost [127.0.0.1]) by mail187-va3-R.bigfish.com (Postfix) with ESMTP id BBA5D11E0375; Thu, 18 Feb 2010 11:38:59 +0000 (UTC) X-SpamScore: -4 X-BigFish: VPS-4(zz936eMab9bhzz1202hzzz32i6bh87h62h) X-Spam-TCS-SCL: 1:0 X-FB-DOMAIN-IP-MATCH: fail Received: from mail187-va3 (localhost.localdomain [127.0.0.1]) by mail187-va3 (MessageSwitch) id 1266493139213563_26045; Thu, 18 Feb 2010 11:38:59 +0000 (UTC) Received: from VA3EHSMHS001.bigfish.com (unknown [10.7.14.235]) by mail187-va3.bigfish.com (Postfix) with ESMTP id 2F6BC1BD8054; Thu, 18 Feb 2010 11:38:59 +0000 (UTC) Received: from ausb3extmailp02.amd.com (163.181.251.22) by VA3EHSMHS001.bigfish.com (10.7.99.11) with Microsoft SMTP Server (TLS) id 14.0.482.39; Thu, 18 Feb 2010 11:38:52 +0000 Received: from ausb3twp01.amd.com (ausb3twp01.amd.com [163.181.250.37]) by ausb3extmailp02.amd.com (Switch-3.2.7/Switch-3.2.7) with ESMTP id o1IBfQqq005081; Thu, 18 Feb 2010 05:41:29 -0600 X-WSS-ID: 0KY1CCK-01-N2R-02 X-M-MSG: Received: from sausexbh2.amd.com (SAUSEXBH2.amd.com [163.181.22.102]) by ausb3twp01.amd.com (Tumbleweed MailGate 3.7.2) with ESMTP id 2424F1028B41; Thu, 18 Feb 2010 05:38:44 -0600 (CST) Received: from sausexmb1.amd.com ([163.181.3.156]) by sausexbh2.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 18 Feb 2010 05:38:47 -0600 Received: from seurexmb1.amd.com ([165.204.9.130]) by sausexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 18 Feb 2010 05:38:47 -0600 Received: from lemmy.osrc.amd.com ([165.204.15.93]) by seurexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 18 Feb 2010 12:38:37 +0100 Received: by lemmy.osrc.amd.com (Postfix, from userid 41430) id 6BC49C9B3D; Thu, 18 Feb 2010 12:38:37 +0100 (CET) From: Joerg Roedel To: Avi Kivity , Marcelo Tosatti CC: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Joerg Roedel , stable@kernel.org Subject: [PATCH 06/10] KVM: SVM: Fix nested msr intercept handling Date: Thu, 18 Feb 2010 12:38:31 +0100 Message-ID: <1266493115-28386-7-git-send-email-joerg.roedel@amd.com> X-Mailer: git-send-email 1.6.6 In-Reply-To: <1266493115-28386-1-git-send-email-joerg.roedel@amd.com> References: <1266493115-28386-1-git-send-email-joerg.roedel@amd.com> X-OriginalArrivalTime: 18 Feb 2010 11:38:37.0624 (UTC) FILETIME=[E91BD380:01CAB08E] MIME-Version: 1.0 X-Reverse-DNS: ausb3extmailp02.amd.com Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 18 Feb 2010 11:40:18 +0000 (UTC) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 3f59cbd..cbf798f 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -1457,16 +1457,11 @@ static bool nested_svm_exit_handled_msr(struct vcpu_svm *svm) u32 msr = svm->vcpu.arch.regs[VCPU_REGS_RCX]; bool ret = false; u32 t0, t1; - u8 *msrpm; + u8 val; if (!(svm->nested.intercept & (1ULL << INTERCEPT_MSR_PROT))) return false; - msrpm = nested_svm_map(svm, svm->nested.vmcb_msrpm); - - if (!msrpm) - goto out; - switch (msr) { case 0 ... 0x1fff: t0 = (msr * 2) % 8; @@ -1487,11 +1482,10 @@ static bool nested_svm_exit_handled_msr(struct vcpu_svm *svm) goto out; } - ret = msrpm[t1] & ((1 << param) << t0); + if (!kvm_read_guest(svm->vcpu.kvm, svm->nested.vmcb_msrpm + t1, &val, 1)) + ret = val & ((1 << param) << t0); out: - nested_svm_unmap(msrpm); - return ret; }