From patchwork Thu Sep 2 15:29:45 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 149551 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o82FYsVZ010461 for ; Thu, 2 Sep 2010 15:34:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755660Ab0IBPeW (ORCPT ); Thu, 2 Sep 2010 11:34:22 -0400 Received: from va3ehsobe006.messaging.microsoft.com ([216.32.180.16]:57538 "EHLO VA3EHSOBE009.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755450Ab0IBPeV (ORCPT ); Thu, 2 Sep 2010 11:34:21 -0400 Received: from mail33-va3-R.bigfish.com (10.7.14.253) by VA3EHSOBE009.bigfish.com (10.7.40.29) with Microsoft SMTP Server id 8.1.340.0; Thu, 2 Sep 2010 15:34:20 +0000 Received: from mail33-va3 (localhost.localdomain [127.0.0.1]) by mail33-va3-R.bigfish.com (Postfix) with ESMTP id 207A6E07C7; Thu, 2 Sep 2010 15:34:20 +0000 (UTC) X-SpamScore: 1 X-BigFish: VS1(zzzz1202hzz8275bhz32i2a8h87h61h) X-Spam-TCS-SCL: 0:0 X-FB-DOMAIN-IP-MATCH: fail Received: from mail33-va3 (localhost.localdomain [127.0.0.1]) by mail33-va3 (MessageSwitch) id 1283441659883009_31883; Thu, 2 Sep 2010 15:34:19 +0000 (UTC) Received: from VA3EHSMHS006.bigfish.com (unknown [10.7.14.235]) by mail33-va3.bigfish.com (Postfix) with ESMTP id C799364804F; Thu, 2 Sep 2010 15:34:19 +0000 (UTC) Received: from ausb3extmailp02.amd.com (163.181.251.22) by VA3EHSMHS006.bigfish.com (10.7.99.16) with Microsoft SMTP Server (TLS) id 14.0.482.44; Thu, 2 Sep 2010 15:34:15 +0000 Received: from ausb3twp02.amd.com ([163.181.250.38]) by ausb3extmailp02.amd.com (Switch-3.2.7/Switch-3.2.7) with SMTP id o82FVEud011055; Thu, 2 Sep 2010 10:32:25 -0500 X-WSS-ID: 0L84LPJ-02-7LZ-02 X-M-MSG: Received: from sausexhtp01.amd.com (sausexhtp01.amd.com [163.181.3.165]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by ausb3twp02.amd.com (Tumbleweed MailGate 3.7.2) with ESMTP id 2A02AC85E2; Thu, 2 Sep 2010 10:29:41 -0500 (CDT) Received: from storexhtp01.amd.com (172.24.4.3) by sausexhtp01.amd.com (163.181.3.165) with Microsoft SMTP Server (TLS) id 8.3.83.0; Thu, 2 Sep 2010 10:29:45 -0500 Received: from gwo.osrc.amd.com (165.204.16.204) by storexhtp01.amd.com (172.24.4.3) with Microsoft SMTP Server id 8.3.83.0; Thu, 2 Sep 2010 11:29:44 -0400 Received: from lemmy.osrc.amd.com (lemmy.osrc.amd.com [165.204.15.93]) by gwo.osrc.amd.com (Postfix) with ESMTP id 0E6C549C200; Thu, 2 Sep 2010 16:29:44 +0100 (BST) Received: by lemmy.osrc.amd.com (Postfix, from userid 1000) id 14FFEA0509; Thu, 2 Sep 2010 17:29:50 +0200 (CEST) From: Joerg Roedel To: Avi Kivity , Marcelo Tosatti CC: , , Joerg Roedel Subject: [PATCH 1/3] KVM: MMU: Fix 32 bit legacy paging with NPT Date: Thu, 2 Sep 2010 17:29:45 +0200 Message-ID: <1283441387-7378-2-git-send-email-joerg.roedel@amd.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1283441387-7378-1-git-send-email-joerg.roedel@amd.com> References: <1283441387-7378-1-git-send-email-joerg.roedel@amd.com> 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 (demeter1.kernel.org [140.211.167.41]); Thu, 02 Sep 2010 15:34:55 +0000 (UTC) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index d2dad65..b2136f9 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -2387,6 +2387,10 @@ static int mmu_alloc_roots(struct kvm_vcpu *vcpu) return 0; } direct = !is_paging(vcpu); + + if (mmu_check_root(vcpu, root_gfn)) + return 1; + for (i = 0; i < 4; ++i) { hpa_t root = vcpu->arch.mmu.pae_root[i]; @@ -2398,10 +2402,10 @@ static int mmu_alloc_roots(struct kvm_vcpu *vcpu) continue; } root_gfn = pdptr >> PAGE_SHIFT; + if (mmu_check_root(vcpu, root_gfn)) + return 1; } else if (vcpu->arch.mmu.root_level == 0) root_gfn = 0; - if (mmu_check_root(vcpu, root_gfn)) - return 1; if (tdp_enabled) { direct = 1; root_gfn = i << 30;