From patchwork Mon Mar 1 14:34:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 82939 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 o21EaTFQ018329 for ; Mon, 1 Mar 2010 14:36:29 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751263Ab0CAOfF (ORCPT ); Mon, 1 Mar 2010 09:35:05 -0500 Received: from tx2ehsobe005.messaging.microsoft.com ([65.55.88.15]:20916 "EHLO TX2EHSOBE010.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750865Ab0CAOfA (ORCPT ); Mon, 1 Mar 2010 09:35:00 -0500 Received: from mail55-tx2-R.bigfish.com (10.9.14.246) by TX2EHSOBE010.bigfish.com (10.9.40.30) with Microsoft SMTP Server id 8.1.240.5; Mon, 1 Mar 2010 14:34:59 +0000 Received: from mail55-tx2 (localhost [127.0.0.1]) by mail55-tx2-R.bigfish.com (Postfix) with ESMTP id B4B86A703A6; Mon, 1 Mar 2010 14:34:59 +0000 (UTC) X-SpamScore: -4 X-BigFish: VPS-4(zz936eMab9bhzz1202hzzz32i6bh2a8h87h43h62h) X-Spam-TCS-SCL: 1:0 X-FB-SS: 0, X-FB-DOMAIN-IP-MATCH: fail Received: from mail55-tx2 (localhost.localdomain [127.0.0.1]) by mail55-tx2 (MessageSwitch) id 1267454099349415_31553; Mon, 1 Mar 2010 14:34:59 +0000 (UTC) Received: from TX2EHSMHS037.bigfish.com (unknown [10.9.14.247]) by mail55-tx2.bigfish.com (Postfix) with ESMTP id 44D571910016; Mon, 1 Mar 2010 14:34:59 +0000 (UTC) Received: from ausb3extmailp01.amd.com (163.181.251.8) by TX2EHSMHS037.bigfish.com (10.9.99.137) with Microsoft SMTP Server (TLS) id 14.0.482.39; Mon, 1 Mar 2010 14:34:56 +0000 Received: from ausb3twp01.amd.com ([163.181.250.37]) by ausb3extmailp01.amd.com (Switch-3.2.7/Switch-3.2.7) with ESMTP id o21Ec6w8009710; Mon, 1 Mar 2010 08:38:09 -0600 X-WSS-ID: 0KYLXU0-01-AWC-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 267301028553; Mon, 1 Mar 2010 08:34:47 -0600 (CST) Received: from sausexmb1.amd.com ([163.181.3.156]) by sausexbh2.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 1 Mar 2010 08:34:51 -0600 Received: from seurexmb1.amd.com ([165.204.9.130]) by sausexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 1 Mar 2010 08:34:51 -0600 Received: from lemmy.osrc.amd.com ([165.204.15.93]) by seurexmb1.amd.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 1 Mar 2010 15:34:45 +0100 Received: by lemmy.osrc.amd.com (Postfix, from userid 41430) id F0761C99D3; Mon, 1 Mar 2010 15:34:45 +0100 (CET) From: Joerg Roedel To: Avi Kivity , Marcelo Tosatti CC: Alexander Graf , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Joerg Roedel Subject: [PATCH 1/7] KVM: SVM: Return correct values in nested_svm_exit_handled_msr Date: Mon, 1 Mar 2010 15:34:34 +0100 Message-ID: <1267454080-2513-2-git-send-email-joerg.roedel@amd.com> X-Mailer: git-send-email 1.7.0 In-Reply-To: <1267454080-2513-1-git-send-email-joerg.roedel@amd.com> References: <1267454080-2513-1-git-send-email-joerg.roedel@amd.com> X-OriginalArrivalTime: 01 Mar 2010 14:34:46.0090 (UTC) FILETIME=[56F302A0:01CAB94C] MIME-Version: 1.0 X-Reverse-DNS: unknown 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]); Mon, 01 Mar 2010 14:36:29 +0000 (UTC) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 1397877..9dfbbae 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -1546,16 +1546,16 @@ static void nested_svm_unmap(struct page *page) kvm_release_page_dirty(page); } -static bool nested_svm_exit_handled_msr(struct vcpu_svm *svm) +static int nested_svm_exit_handled_msr(struct vcpu_svm *svm) { u32 param = svm->vmcb->control.exit_info_1 & 1; u32 msr = svm->vcpu.arch.regs[VCPU_REGS_RCX]; - bool ret = false; u32 t0, t1; + int ret; u8 val; if (!(svm->nested.intercept & (1ULL << INTERCEPT_MSR_PROT))) - return false; + return NESTED_EXIT_HOST; switch (msr) { case 0 ... 0x1fff: @@ -1573,12 +1573,12 @@ static bool nested_svm_exit_handled_msr(struct vcpu_svm *svm) t0 %= 8; break; default: - ret = true; + ret = NESTED_EXIT_DONE; goto out; } if (!kvm_read_guest(svm->vcpu.kvm, svm->nested.vmcb_msrpm + t1, &val, 1)) - ret = val & ((1 << param) << t0); + ret = val & ((1 << param) << t0) ? NESTED_EXIT_DONE : NESTED_EXIT_HOST; out: return ret;