ia64/xen-unstable

changeset 19801:c3a94ac4c031

P2M: check whether hap mode is enabled before using 2mb pages

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 <clalance@redhat.com>
Cc: Sarathy, Bhavna <Bhavna.Sarathy@amd.com>
Signed-off-by: Wei Huang <wei.huang2@amd.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Jun 19 08:42:58 2009 +0100 (2009-06-19)
parents 78962f85c562
children f3211c71e8f0
files xen/arch/x86/mm/p2m.c
line diff
     1.1 --- a/xen/arch/x86/mm/p2m.c	Fri Jun 19 08:41:50 2009 +0100
     1.2 +++ b/xen/arch/x86/mm/p2m.c	Fri Jun 19 08:42:58 2009 +0100
     1.3 @@ -1499,7 +1499,11 @@ int set_p2m_entry(struct domain *d, unsi
     1.4  
     1.5      while ( todo )
     1.6      {
     1.7 -        order = (((gfn | mfn_x(mfn) | todo) & ((1ul << 9) - 1)) == 0) ? 9 : 0;
     1.8 +        if ( is_hvm_domain(d) && d->arch.hvm_domain.hap_enabled )
     1.9 +            order = (((gfn | mfn_x(mfn) | todo) & ((1ul << 9) - 1)) == 0) ?
    1.10 +                9 : 0;
    1.11 +        else
    1.12 +            order = 0;
    1.13          rc = d->arch.p2m->set_entry(d, gfn, mfn, order, p2mt);
    1.14          gfn += 1ul << order;
    1.15          if ( mfn_x(mfn) != INVALID_MFN )