From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: RFC: Add reserved bits check Date: Sun, 29 Mar 2009 13:23:23 +0300 Message-ID: <49CF4C1B.3010404@redhat.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> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: "kvm@vger.kernel.org" To: "Dong, Eddie" Return-path: Received: from mx2.redhat.com ([66.187.237.31]:56972 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753743AbZC2KXa (ORCPT ); Sun, 29 Mar 2009 06:23:30 -0400 In-Reply-To: <9832F13BD22FB94A829F798DA4A8280501A21071B0@pdsmsx503.ccr.corp.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: Dong, Eddie wrote: > > +static bool is_rsvd_bits_set(struct kvm_vcpu *vcpu, u64 gpte, int level) > +{ > + int ps = 0; > + > + if (level == PT_DIRECTORY_LEVEL) > + ps = !!(gpte & PT_PAGE_SIZE_MASK); > No need for this. If you set rsvd_bits_mask[1][0] == rsvd_bits_mask[0][0], then you get the same behaviour. The first index is not the page size, it's just bit 7. You'll need to fill all the indexes for bit 7 == 1, but it's worth it, with the 1GB pages patch. > + return (gpte & vcpu->arch.mmu.rsvd_bits_mask[ps][level-1]) != 0; > +} > + > #define PTTYPE 64 > #include "paging_tmpl.h" > #undef PTTYPE > > +int cpuid_maxphyaddr(struct kvm_vcpu *vcpu) > +{ > + struct kvm_cpuid_entry2 *best; > + > + best = kvm_find_cpuid_entry(vcpu, 0x80000008, 0); > + if (best) > + return best->eax & 0xff; > + return 32; > +} > + > Best to return 36 if the cpu doesn't support cpuid 80000008 but does support pae. -- error compiling committee.c: too many arguments to function