ia64/xen-unstable

changeset 14944:55d0a5c70986

xen: Fix maximum_gpfn() hypercall to always return max_gpfn not nr_gpfns.
Fix callers to convert this to nr_gpfns (aka p2m_size) if that's what
they actually need.
Signed-off-by: Keir Fraser <keir@xensource.com>
author Keir Fraser <keir@xensource.com>
date Wed Apr 25 22:22:31 2007 +0100 (2007-04-25)
parents 59ea9dadfd07
children bdde5daf056e
files tools/libxc/xc_core_x86.c tools/libxc/xc_domain_save.c xen/arch/x86/mm.c xen/arch/x86/mm/shadow/common.c
line diff
     1.1 --- a/tools/libxc/xc_core_x86.c	Wed Apr 25 22:06:13 2007 +0100
     1.2 +++ b/tools/libxc/xc_core_x86.c	Wed Apr 25 22:22:31 2007 +0100
     1.3 @@ -21,9 +21,9 @@
     1.4  #include "xg_private.h"
     1.5  #include "xc_core.h"
     1.6  
     1.7 -static int max_gpfn(int xc_handle, domid_t domid)
     1.8 +static int nr_gpfns(int xc_handle, domid_t domid)
     1.9  {
    1.10 -    return xc_memory_op(xc_handle, XENMEM_maximum_gpfn, &domid);
    1.11 +    return xc_memory_op(xc_handle, XENMEM_maximum_gpfn, &domid) + 1;
    1.12  }
    1.13  
    1.14  int
    1.15 @@ -38,7 +38,7 @@ xc_core_arch_memory_map_get(int xc_handl
    1.16                              xc_core_memory_map_t **mapp,
    1.17                              unsigned int *nr_entries)
    1.18  {
    1.19 -    unsigned long p2m_size = max_gpfn(xc_handle, info->domid);
    1.20 +    unsigned long p2m_size = nr_gpfns(xc_handle, info->domid);
    1.21      xc_core_memory_map_t *map;
    1.22  
    1.23      map = malloc(sizeof(*map));
    1.24 @@ -65,7 +65,7 @@ xc_core_arch_map_p2m(int xc_handle, xc_d
    1.25      xen_pfn_t *live_p2m_frame_list_list = NULL;
    1.26      xen_pfn_t *live_p2m_frame_list = NULL;
    1.27      uint32_t dom = info->domid;
    1.28 -    unsigned long p2m_size = max_gpfn(xc_handle, info->domid);
    1.29 +    unsigned long p2m_size = nr_gpfns(xc_handle, info->domid);
    1.30      int ret = -1;
    1.31      int err;
    1.32  
     2.1 --- a/tools/libxc/xc_domain_save.c	Wed Apr 25 22:06:13 2007 +0100
     2.2 +++ b/tools/libxc/xc_domain_save.c	Wed Apr 25 22:22:31 2007 +0100
     2.3 @@ -870,7 +870,7 @@ int xc_domain_save(int xc_handle, int io
     2.4      }
     2.5  
     2.6      /* Get the size of the P2M table */
     2.7 -    p2m_size = xc_memory_op(xc_handle, XENMEM_maximum_gpfn, &dom);
     2.8 +    p2m_size = xc_memory_op(xc_handle, XENMEM_maximum_gpfn, &dom) + 1;
     2.9  
    2.10      /* Domain is still running at this point */
    2.11      if ( live )
     3.1 --- a/xen/arch/x86/mm.c	Wed Apr 25 22:06:13 2007 +0100
     3.2 +++ b/xen/arch/x86/mm.c	Wed Apr 25 22:22:31 2007 +0100
     3.3 @@ -249,7 +249,10 @@ int memory_is_conventional_ram(paddr_t p
     3.4  
     3.5  unsigned long domain_get_maximum_gpfn(struct domain *d)
     3.6  {
     3.7 -    return is_hvm_domain(d) ? d->arch.p2m.max_mapped_pfn : arch_get_max_pfn(d);
     3.8 +    if ( is_hvm_domain(d) )
     3.9 +        return d->arch.p2m.max_mapped_pfn;
    3.10 +    /* NB. PV guests specify nr_pfns rather than max_pfn so we adjust here. */
    3.11 +    return arch_get_max_pfn(d) - 1;
    3.12  }
    3.13  
    3.14  void share_xen_page_with_guest(
     4.1 --- a/xen/arch/x86/mm/shadow/common.c	Wed Apr 25 22:06:13 2007 +0100
     4.2 +++ b/xen/arch/x86/mm/shadow/common.c	Wed Apr 25 22:22:31 2007 +0100
     4.3 @@ -2668,8 +2668,7 @@ sh_alloc_log_dirty_bitmap(struct domain 
     4.4  {
     4.5      ASSERT(d->arch.paging.shadow.dirty_bitmap == NULL);
     4.6      d->arch.paging.shadow.dirty_bitmap_size =
     4.7 -        (domain_get_maximum_gpfn(d) + (BITS_PER_LONG - 1)) &
     4.8 -        ~(BITS_PER_LONG - 1);
     4.9 +        (domain_get_maximum_gpfn(d) + BITS_PER_LONG) & ~(BITS_PER_LONG - 1);
    4.10      d->arch.paging.shadow.dirty_bitmap =
    4.11          xmalloc_array(unsigned long,
    4.12                        d->arch.paging.shadow.dirty_bitmap_size / BITS_PER_LONG);