From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Huang Subject: [PATCH][P2M] check whether hap mode is enabled before using 2mb pages Date: Thu, 18 Jun 2009 15:51:30 -0500 Message-ID: <4A3AA8D2.6050301@amd.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050205090802070605010906" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "'xen-devel@lists.xensource.com'" , Chris Lalancette , "Sarathy, Bhavna" List-Id: xen-devel@lists.xenproject.org --------------050205090802070605010906 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit This small patch checks whether hap mode is enabled when guest is trying to allocate 2MB pages inside P2M. This prevents potential errors when hap is disabled. Cc: Chris Lalancette Cc: Sarathy, Bhavna Signed-off-by: Wei Huang --------------050205090802070605010906 Content-Type: text/plain; name="superpage_checks_hap_enabled.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="superpage_checks_hap_enabled.txt" diff -r 55ca7ef865b4 xen/arch/x86/mm/p2m.c --- a/xen/arch/x86/mm/p2m.c Tue Jun 16 11:01:17 2009 +0100 +++ b/xen/arch/x86/mm/p2m.c Thu Jun 18 13:07:10 2009 -0500 @@ -1499,7 +1499,11 @@ int set_p2m_entry(struct domain *d, unsi while ( todo ) { - order = (((gfn | mfn_x(mfn) | todo) & ((1ul << 9) - 1)) == 0) ? 9 : 0; + if ( is_hvm_domain(d) && d->arch.hvm_domain.hap_enabled ) + order = (((gfn | mfn_x(mfn) | todo) & ((1ul << 9) - 1)) == 0) ? + 9 : 0; + else + order = 0; rc = d->arch.p2m->set_entry(d, gfn, mfn, order, p2mt); gfn += 1ul << order; if ( mfn_x(mfn) != INVALID_MFN ) --------------050205090802070605010906 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------050205090802070605010906--