ia64/xen-unstable

changeset 19769:2d68d518038b

x86: Allow guests to allocate up to 2MB (superpage) memory extents.

Signed-off-by: Keir Fraser <keir.fraser@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jun 16 14:04:15 2009 +0100 (2009-06-16)
parents 67a0ffade665
children 64a932c92a7c
files xen/common/memory.c xen/include/asm-ia64/iocap.h xen/include/asm-x86/iocap.h xen/include/xen/iocap.h
line diff
     1.1 --- a/xen/common/memory.c	Tue Jun 16 13:57:18 2009 +0100
     1.2 +++ b/xen/common/memory.c	Tue Jun 16 14:04:15 2009 +0100
     1.3 @@ -50,8 +50,7 @@ static void increase_reservation(struct 
     1.4                                       a->nr_extents-1) )
     1.5          return;
     1.6  
     1.7 -    if ( (a->extent_order != 0) &&
     1.8 -         !multipage_allocation_permitted(current->domain) )
     1.9 +    if ( !multipage_allocation_permitted(current->domain, a->extent_order) )
    1.10          return;
    1.11  
    1.12      for ( i = a->nr_done; i < a->nr_extents; i++ )
    1.13 @@ -96,8 +95,7 @@ static void populate_physmap(struct memo
    1.14                                       a->nr_extents-1) )
    1.15          return;
    1.16  
    1.17 -    if ( (a->extent_order != 0) &&
    1.18 -         !multipage_allocation_permitted(current->domain) )
    1.19 +    if ( !multipage_allocation_permitted(current->domain, a->extent_order) )
    1.20          return;
    1.21  
    1.22      for ( i = a->nr_done; i < a->nr_extents; i++ )
    1.23 @@ -247,8 +245,10 @@ static long memory_exchange(XEN_GUEST_HA
    1.24      }
    1.25  
    1.26      /* Only privileged guests can allocate multi-page contiguous extents. */
    1.27 -    if ( ((exch.in.extent_order != 0) || (exch.out.extent_order != 0)) &&
    1.28 -         !multipage_allocation_permitted(current->domain) )
    1.29 +    if ( !multipage_allocation_permitted(current->domain,
    1.30 +                                         exch.in.extent_order) ||
    1.31 +         !multipage_allocation_permitted(current->domain,
    1.32 +                                         exch.out.extent_order) )
    1.33      {
    1.34          rc = -EPERM;
    1.35          goto fail_early;
     2.1 --- a/xen/include/asm-ia64/iocap.h	Tue Jun 16 13:57:18 2009 +0100
     2.2 +++ b/xen/include/asm-ia64/iocap.h	Tue Jun 16 14:04:15 2009 +0100
     2.3 @@ -15,4 +15,9 @@ extern int ioports_deny_access(struct do
     2.4  #define ioports_access_permitted(d, s, e)               \
     2.5      rangeset_contains_range((d)->arch.ioport_caps, s, e)
     2.6  
     2.7 +#define multipage_allocation_permitted(d, order)        \
     2.8 +    (((order) == 0) ||                                  \
     2.9 +     !rangeset_is_empty((d)->iomem_caps) ||             \
    2.10 +     !rangeset_is_empty((d)->arch.ioport_caps))
    2.11 +
    2.12  #endif /* __IA64_IOCAP_H__ */
     3.1 --- a/xen/include/asm-x86/iocap.h	Tue Jun 16 13:57:18 2009 +0100
     3.2 +++ b/xen/include/asm-x86/iocap.h	Tue Jun 16 14:04:15 2009 +0100
     3.3 @@ -18,4 +18,9 @@
     3.4      (!rangeset_is_empty((d)->iomem_caps) ||             \
     3.5       !rangeset_is_empty((d)->arch.ioport_caps))
     3.6  
     3.7 +#define multipage_allocation_permitted(d, order)        \
     3.8 +    (((order) <= 9) || /* allow 2MB superpages */       \
     3.9 +     !rangeset_is_empty((d)->iomem_caps) ||             \
    3.10 +     !rangeset_is_empty((d)->arch.ioport_caps))
    3.11 +
    3.12  #endif /* __X86_IOCAP_H__ */
     4.1 --- a/xen/include/xen/iocap.h	Tue Jun 16 13:57:18 2009 +0100
     4.2 +++ b/xen/include/xen/iocap.h	Tue Jun 16 14:04:15 2009 +0100
     4.3 @@ -28,8 +28,4 @@
     4.4  #define irq_access_permitted(d, i)                      \
     4.5      rangeset_contains_singleton((d)->irq_caps, i)
     4.6  
     4.7 -#define multipage_allocation_permitted(d)               \
     4.8 -    (!rangeset_is_empty((d)->iomem_caps) ||             \
     4.9 -     !rangeset_is_empty((d)->arch.ioport_caps))
    4.10 -
    4.11  #endif /* __XEN_IOCAP_H__ */