ia64/xen-unstable

changeset 16353:5b8730c78454

Replace is_xen_heap_frame() with is_xen_heap_{page,mfn}(). Callers are
changed to use whichever is more convenient.
Signed-off-by: Keir Fraser <keir@xensource.com>
author Keir Fraser <keir@xensource.com>
date Thu Nov 08 10:19:18 2007 +0000 (2007-11-08)
parents d4c5a1cdcf2e
children 03e7f6806adb
files xen/arch/ia64/xen/mm.c xen/arch/x86/mm.c xen/common/grant_table.c xen/common/page_alloc.c xen/include/asm-ia64/mm.h xen/include/asm-powerpc/mm.h xen/include/asm-x86/mm.h
line diff
     1.1 --- a/xen/arch/ia64/xen/mm.c	Wed Nov 07 16:55:13 2007 +0000
     1.2 +++ b/xen/arch/ia64/xen/mm.c	Thu Nov 08 10:19:18 2007 +0000
     1.3 @@ -2832,7 +2832,7 @@ arch_memory_op(int op, XEN_GUEST_HANDLE(
     1.4  
     1.5          /* Remove previously mapped page if it was present. */
     1.6          if (prev_mfn && mfn_valid(prev_mfn)) {
     1.7 -            if (is_xen_heap_frame(mfn_to_page(prev_mfn)))
     1.8 +            if (is_xen_heap_mfn(prev_mfn))
     1.9                  /* Xen heap frames are simply unhooked from this phys slot. */
    1.10                  guest_physmap_remove_page(d, xatp.gpfn, prev_mfn);
    1.11              else
     2.1 --- a/xen/arch/x86/mm.c	Wed Nov 07 16:55:13 2007 +0000
     2.2 +++ b/xen/arch/x86/mm.c	Thu Nov 08 10:19:18 2007 +0000
     2.3 @@ -674,7 +674,7 @@ get_page_from_l1e(
     2.4          uint32_t x, nx, y = page->count_info;
     2.5          uint32_t cacheattr = pte_flags_to_cacheattr(l1f);
     2.6  
     2.7 -        if ( is_xen_heap_frame(page) )
     2.8 +        if ( is_xen_heap_page(page) )
     2.9          {
    2.10              if ( (l1f & _PAGE_RW) &&
    2.11                   !(unlikely(paging_mode_external(d) &&
    2.12 @@ -1866,7 +1866,7 @@ void cleanup_page_cacheattr(struct page_
    2.13  
    2.14      page->count_info &= ~PGC_cacheattr_mask;
    2.15  
    2.16 -    BUG_ON(is_xen_heap_frame(page));
    2.17 +    BUG_ON(is_xen_heap_page(page));
    2.18  
    2.19  #ifdef __x86_64__
    2.20      map_pages_to_xen((unsigned long)page_to_virt(page), page_to_mfn(page),
    2.21 @@ -3200,7 +3200,7 @@ long arch_memory_op(int op, XEN_GUEST_HA
    2.22          prev_mfn = gmfn_to_mfn(d, xatp.gpfn);
    2.23          if ( mfn_valid(prev_mfn) )
    2.24          {
    2.25 -            if ( is_xen_heap_frame(mfn_to_page(prev_mfn)) )
    2.26 +            if ( is_xen_heap_mfn(prev_mfn) )
    2.27                  /* Xen heap frames are simply unhooked from this phys slot. */
    2.28                  guest_physmap_remove_page(d, xatp.gpfn, prev_mfn);
    2.29              else
    2.30 @@ -3583,7 +3583,7 @@ void free_xen_pagetable(void *v)
    2.31  
    2.32      BUG_ON(early_boot);
    2.33      
    2.34 -    if ( is_xen_heap_frame(virt_to_page(v)) )
    2.35 +    if ( is_xen_heap_page(virt_to_page(v)) )
    2.36          free_xenheap_page(v);
    2.37      else
    2.38          free_domheap_page(virt_to_page(v));
     3.1 --- a/xen/common/grant_table.c	Wed Nov 07 16:55:13 2007 +0000
     3.2 +++ b/xen/common/grant_table.c	Thu Nov 08 10:19:18 2007 +0000
     3.3 @@ -1057,7 +1057,7 @@ gnttab_transfer(
     3.4          }
     3.5  
     3.6          page = mfn_to_page(mfn);
     3.7 -        if ( unlikely(is_xen_heap_frame(page)) )
     3.8 +        if ( unlikely(is_xen_heap_page(page)) )
     3.9          { 
    3.10              gdprintk(XENLOG_INFO, "gnttab_transfer: xen frame %lx\n",
    3.11                      (unsigned long)gop.mfn);
     4.1 --- a/xen/common/page_alloc.c	Wed Nov 07 16:55:13 2007 +0000
     4.2 +++ b/xen/common/page_alloc.c	Thu Nov 08 10:19:18 2007 +0000
     4.3 @@ -559,8 +559,7 @@ static unsigned long avail_heap_pages(
     4.4      return free_pages;
     4.5  }
     4.6  
     4.7 -#define avail_for_domheap(mfn) \
     4.8 -    (!allocated_in_map(mfn) && !is_xen_heap_frame(mfn_to_page(mfn)))
     4.9 +#define avail_for_domheap(mfn) !(allocated_in_map(mfn) || is_xen_heap_mfn(mfn))
    4.10  void __init end_boot_allocator(void)
    4.11  {
    4.12      unsigned long i;
    4.13 @@ -615,7 +614,7 @@ void __init scrub_heap_pages(void)
    4.14          /* Re-check page status with lock held. */
    4.15          if ( !allocated_in_map(mfn) )
    4.16          {
    4.17 -            if ( is_xen_heap_frame(mfn_to_page(mfn)) )
    4.18 +            if ( is_xen_heap_mfn(mfn) )
    4.19              {
    4.20                  p = page_to_virt(mfn_to_page(mfn));
    4.21                  memguard_unguard_range(p, PAGE_SIZE);
    4.22 @@ -655,9 +654,9 @@ void init_xenheap_pages(paddr_t ps, padd
    4.23       * Yuk! Ensure there is a one-page buffer between Xen and Dom zones, to
    4.24       * prevent merging of power-of-two blocks across the zone boundary.
    4.25       */
    4.26 -    if ( ps && !is_xen_heap_frame(maddr_to_page(ps)-1) )
    4.27 +    if ( ps && !is_xen_heap_mfn(paddr_to_pfn(ps)-1) )
    4.28          ps += PAGE_SIZE;
    4.29 -    if ( !is_xen_heap_frame(maddr_to_page(pe)) )
    4.30 +    if ( !is_xen_heap_mfn(paddr_to_pfn(pe)) )
    4.31          pe -= PAGE_SIZE;
    4.32  
    4.33      init_heap_pages(MEMZONE_XEN, maddr_to_page(ps), (pe - ps) >> PAGE_SHIFT);
    4.34 @@ -838,7 +837,7 @@ void free_domheap_pages(struct page_info
    4.35  
    4.36      ASSERT(!in_irq());
    4.37  
    4.38 -    if ( unlikely(is_xen_heap_frame(pg)) )
    4.39 +    if ( unlikely(is_xen_heap_page(pg)) )
    4.40      {
    4.41          /* NB. May recursively lock from relinquish_memory(). */
    4.42          spin_lock_recursive(&d->page_alloc_lock);
     5.1 --- a/xen/include/asm-ia64/mm.h	Wed Nov 07 16:55:13 2007 +0000
     5.2 +++ b/xen/include/asm-ia64/mm.h	Thu Nov 08 10:19:18 2007 +0000
     5.3 @@ -115,8 +115,9 @@ struct page_info
     5.4   /* 29-bit count of references to this frame. */
     5.5  #define PGC_count_mask      ((1UL<<29)-1)
     5.6  
     5.7 -#define is_xen_heap_frame(pfn) ((page_to_maddr(pfn) < xenheap_phys_end) \
     5.8 -				 && (page_to_maddr(pfn) >= xen_pstart))
     5.9 +#define is_xen_heap_mfn(mfn)   (((mfn) < paddr_to_pfn(xenheap_phys_end)) \
    5.10 +                                && ((mfn) >= paddr_to_pfn(xen_pstart)))
    5.11 +#define is_xen_heap_page(page) is_xen_heap_mfn(page_to_mfn(page))
    5.12  
    5.13  extern void* xen_pickle_offset;
    5.14  #define __pickle(a)	((unsigned long)a - (unsigned long)xen_pickle_offset)
     6.1 --- a/xen/include/asm-powerpc/mm.h	Wed Nov 07 16:55:13 2007 +0000
     6.2 +++ b/xen/include/asm-powerpc/mm.h	Thu Nov 08 10:19:18 2007 +0000
     6.3 @@ -111,7 +111,8 @@ struct page_info
     6.4   /* 29-bit count of references to this frame. */
     6.5  #define PGC_count_mask      ((1UL<<28)-1)
     6.6  
     6.7 -#define is_xen_heap_frame(pfn) (page_to_maddr(pfn) < xenheap_phys_end)
     6.8 +#define is_xen_heap_mfn(mfn)   ((mfn) < paddr_to_pfn(xenheap_phys_end))
     6.9 +#define is_xen_heap_page(page) (page_to_maddr(page) < xenheap_phys_end)
    6.10  
    6.11  static inline struct domain *unpickle_domptr(u32 _domain)
    6.12  { return ((_domain == 0) || (_domain & 1)) ? NULL : __va(_domain); }
     7.1 --- a/xen/include/asm-x86/mm.h	Wed Nov 07 16:55:13 2007 +0000
     7.2 +++ b/xen/include/asm-x86/mm.h	Thu Nov 08 10:19:18 2007 +0000
     7.3 @@ -102,9 +102,11 @@ struct page_info
     7.4   /* 26-bit count of references to this frame. */
     7.5  #define PGC_count_mask      ((1U<<26)-1)
     7.6  
     7.7 -#define is_xen_heap_frame(pfn) ({                                       \
     7.8 -    paddr_t maddr = page_to_maddr(pfn);                                 \
     7.9 -    ((maddr >= xenheap_phys_start) && (maddr < xenheap_phys_end));      \
    7.10 +#define is_xen_heap_page(page) is_xen_heap_mfn(page_to_mfn(page))
    7.11 +#define is_xen_heap_mfn(mfn) ({                         \
    7.12 +    unsigned long _mfn = (mfn);                         \
    7.13 +    ((_mfn >= paddr_to_pfn(xenheap_phys_start)) &&      \
    7.14 +     (_mfn < paddr_to_pfn(xenheap_phys_end)));          \
    7.15  })
    7.16  
    7.17  #if defined(__i386__)