ia64/xen-unstable

changeset 17815:09dd5492651c

Allow older PAE Linux guests to access entire compat m2p.

Older PAE guests (prior to xen-unstable.hg 8924:229c602a075a, Feb
2006, this includes some vendor's kernel in the field) use a limit of
0xf6800000 on their code and data segments (i.e. up to the end of the
read-only m2p table).

Newer kernels use a limit of 4G and rely on the hypervisor to clamp to
the actual maximum allowed. 32on64 mode takes advantage of this to
allow a larger m2p than would fit in the PAEonPAE sized hole.

This means that PAE guests with the hardcoded low limit cannot run on
top of a 64 bit hypervisor on a host machine which has more than 16G
of RAM. Fix this by extending any code or data segment which ends
above the start of the hypervisor hole for that guest.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Jun 09 17:18:27 2008 +0100 (2008-06-09)
parents db466cd3412c
children f769baf14332
files xen/arch/x86/x86_64/mm.c
line diff
     1.1 --- a/xen/arch/x86/x86_64/mm.c	Mon Jun 09 15:06:26 2008 +0100
     1.2 +++ b/xen/arch/x86/x86_64/mm.c	Mon Jun 09 17:18:27 2008 +0100
     1.3 @@ -402,8 +402,33 @@ int check_descriptor(const struct domain
     1.4      /* All code and data segments are okay. No base/limit checking. */
     1.5      if ( (b & _SEGMENT_S) )
     1.6      {
     1.7 -        if ( is_pv_32bit_domain(dom) && (b & _SEGMENT_L) )
     1.8 -            goto bad;
     1.9 +        if ( is_pv_32bit_domain(dom) )
    1.10 +        {
    1.11 +            unsigned long base, limit;
    1.12 +
    1.13 +            if ( b & _SEGMENT_L )
    1.14 +                goto bad;
    1.15 +
    1.16 +            /*
    1.17 +             * Older PAE Linux guests use segments which are limited to
    1.18 +             * 0xf6800000. Extend these to allow access to the larger read-only
    1.19 +             * M2P table available in 32on64 mode.
    1.20 +             */
    1.21 +            base = (b & (0xff << 24)) | ((b & 0xff) << 16) | (a >> 16);
    1.22 +
    1.23 +            limit = (b & 0xf0000) | (a & 0xffff);
    1.24 +            limit++; /* We add one because limit is inclusive. */
    1.25 +
    1.26 +            if ( (b & _SEGMENT_G) )
    1.27 +                limit <<= 12;
    1.28 +
    1.29 +            if ( (base == 0) && (limit > HYPERVISOR_COMPAT_VIRT_START(dom)) )
    1.30 +            {
    1.31 +                a |= 0x0000ffff;
    1.32 +                b |= 0x000f0000;
    1.33 +            }
    1.34 +        }
    1.35 +
    1.36          goto good;
    1.37      }
    1.38