From patchwork Mon Mar 30 08:27:25 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dong, Eddie" X-Patchwork-Id: 15099 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 n2U8T8gn009120 for ; Mon, 30 Mar 2009 08:29:08 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753598AbZC3I3H (ORCPT ); Mon, 30 Mar 2009 04:29:07 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753548AbZC3I3F (ORCPT ); Mon, 30 Mar 2009 04:29:05 -0400 Received: from mga02.intel.com ([134.134.136.20]:57955 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753080AbZC3I3E convert rfc822-to-8bit (ORCPT ); Mon, 30 Mar 2009 04:29:04 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 30 Mar 2009 01:22:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.38,445,1233561600"; d="scan'208";a="398621381" Received: from pgsmsx603.gar.corp.intel.com ([10.221.43.87]) by orsmga002.jf.intel.com with ESMTP; 30 Mar 2009 01:37:19 -0700 Received: from pdsmsx601.ccr.corp.intel.com (172.16.12.94) by pgsmsx603.gar.corp.intel.com (10.221.43.87) with Microsoft SMTP Server (TLS) id 8.1.340.0; Mon, 30 Mar 2009 16:27:26 +0800 Received: from pdsmsx503.ccr.corp.intel.com ([172.16.12.95]) by pdsmsx601.ccr.corp.intel.com ([172.16.12.94]) with mapi; Mon, 30 Mar 2009 16:27:25 +0800 From: "Dong, Eddie" To: "Dong, Eddie" , Avi Kivity CC: "kvm@vger.kernel.org" , "Dong, Eddie" Date: Mon, 30 Mar 2009 16:27:25 +0800 Subject: RE: Use rsvd_bits_mask in load_pdptrs for cleanup and considing EXB bit Thread-Topic: Use rsvd_bits_mask in load_pdptrs for cleanup and considing EXB bit Thread-Index: AcmwWGazNA3uw50+Q6aDKED1Wo3cTQAgRGUgAAIY27AAC9fJYA== Message-ID: <9832F13BD22FB94A829F798DA4A8280501A3C022CF@pdsmsx503.ccr.corp.intel.com> References: <9832F13BD22FB94A829F798DA4A8280501A21068EF@pdsmsx503.ccr.corp.intel.com> <9832F13BD22FB94A829F798DA4A8280501A2106E6A@pdsmsx503.ccr.corp.intel.com> <49CC9DAB.8090802@redhat.com> <9832F13BD22FB94A829F798DA4A8280501A2107197@pdsmsx503.ccr.corp.intel.com> <49CCE275.9070608@redhat.com> <9832F13BD22FB94A829F798DA4A8280501A21071B0@pdsmsx503.ccr.corp.intel.com> <49CF4C1B.3010404@redhat.com> <9832F13BD22FB94A829F798DA4A8280501A3C01DDE@pdsmsx503.ccr.corp.intel.com> <9832F13BD22FB94A829F798DA4A8280501A3C01EB3@pdsmsx503.ccr.corp.intel.com> In-Reply-To: <9832F13BD22FB94A829F798DA4A8280501A3C01EB3@pdsmsx503.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Dong, Eddie wrote: > This is followup of rsvd_bits emulation. > Base on new rsvd_bits emulation patch. thx, eddie commit 2c1472ef2b9fd87a261e8b58a7db11afd6a111dc Author: root Date: Mon Mar 30 17:05:47 2009 +0800 Use rsvd_bits_mask in load_pdptrs for cleanup with EXB bit considered. Signed-off-by: Eddie Dong To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 2eab758..eaf41c0 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -225,11 +225,6 @@ static int is_nx(struct kvm_vcpu *vcpu) return vcpu->arch.shadow_efer & EFER_NX; } -static int is_present_pte(unsigned long pte) -{ - return pte & PT_PRESENT_MASK; -} - static int is_shadow_present_pte(u64 pte) { return pte != shadow_trap_nonpresent_pte @@ -2199,6 +2194,9 @@ void reset_rsvds_bits_mask(struct kvm_vcpu *vcpu, int level) context->rsvd_bits_mask[1][0] = 0; break; case PT32E_ROOT_LEVEL: + context->rsvd_bits_mask[0][2] = exb_bit_rsvd | + rsvd_bits(maxphyaddr, 62) | + rsvd_bits(7, 8) | rsvd_bits(1, 2); /* PDPTE */ context->rsvd_bits_mask[0][1] = exb_bit_rsvd | rsvd_bits(maxphyaddr, 62); /* PDE */ context->rsvd_bits_mask[0][0] = exb_bit_rsvd | diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h index 258e5d5..2a6eb50 100644 --- a/arch/x86/kvm/mmu.h +++ b/arch/x86/kvm/mmu.h @@ -75,4 +75,9 @@ static inline int is_paging(struct kvm_vcpu *vcpu) return vcpu->arch.cr0 & X86_CR0_PG; } +static inline int is_present_pte(unsigned long pte) +{ + return pte & PT_PRESENT_MASK; +} + #endif diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 961bd2b..b449ff0 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -233,7 +233,8 @@ int load_pdptrs(struct kvm_vcpu *vcpu, unsigned long cr3) goto out; } for (i = 0; i < ARRAY_SIZE(pdpte); ++i) { - if ((pdpte[i] & 1) && (pdpte[i] & 0xfffffff0000001e6ull)) { + if (is_present_pte(pdpte[i]) && + (pdpte[i] & vcpu->arch.mmu.rsvd_bits_mask[0][2])) { ret = 0; goto out; }--