ia64/xen-unstable

changeset 19130:c8962b24fb50

[IA64] remove static-partitioned xenheap

This patch is ia64 counter part of 19054:845aa241e163

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Isaku Yamahata <yamahata@valinux.co.jp>
date Fri Jan 30 11:12:57 2009 +0900 (2009-01-30)
parents 971d2d5cb5cb
children 46b4096813dc 686144ac1951
files xen/arch/ia64/linux-xen/mm_contig.c xen/arch/ia64/vmx/vmx_init.c xen/arch/ia64/xen/machine_kexec.c xen/arch/ia64/xen/mm.c xen/arch/ia64/xen/xensetup.c xen/common/page_alloc.c xen/include/asm-ia64/config.h xen/include/asm-ia64/mm.h
line diff
     1.1 --- a/xen/arch/ia64/linux-xen/mm_contig.c	Fri Jan 30 11:12:44 2009 +0900
     1.2 +++ b/xen/arch/ia64/linux-xen/mm_contig.c	Fri Jan 30 11:12:57 2009 +0900
     1.3 @@ -190,7 +190,7 @@ per_cpu_allocate(void *xen_heap_start, u
     1.4  	unsigned long end = start + size;
     1.5  
     1.6  	if (__pa(end) < end_in_pa) {
     1.7 -		init_xenheap_pages(__pa(xen_heap_start), __pa(start));
     1.8 +		init_boot_pages(__pa(xen_heap_start), __pa(start));
     1.9  		xen_heap_start = (void*)end;
    1.10  		percpu_area = (void*)virt_to_xenva(start);
    1.11  		printk("allocate percpu area 0x%lx@0x%lx 0x%p\n",
     2.1 --- a/xen/arch/ia64/vmx/vmx_init.c	Fri Jan 30 11:12:44 2009 +0900
     2.2 +++ b/xen/arch/ia64/vmx/vmx_init.c	Fri Jan 30 11:12:57 2009 +0900
     2.3 @@ -146,7 +146,7 @@ vmx_init_env(void *start, unsigned long 
     2.4  			VM_BUFFER_ALIGN_UP((unsigned long)start);
     2.5  		unsigned long e_vm_buffer = s_vm_buffer + buffer_size;
     2.6  		if (__pa(e_vm_buffer) < end_in_pa) {
     2.7 -			init_xenheap_pages(__pa(start), __pa(s_vm_buffer));
     2.8 +			init_boot_pages(__pa(start), __pa(s_vm_buffer));
     2.9  			start = (void*)e_vm_buffer;
    2.10  			vm_buffer = virt_to_xenva(s_vm_buffer);
    2.11  			printk("vm_buffer: 0x%lx\n", vm_buffer);
     3.1 --- a/xen/arch/ia64/xen/machine_kexec.c	Fri Jan 30 11:12:44 2009 +0900
     3.2 +++ b/xen/arch/ia64/xen/machine_kexec.c	Fri Jan 30 11:12:57 2009 +0900
     3.3 @@ -159,8 +159,10 @@ static int machine_kexec_get_xen(xen_kex
     3.4  static int machine_kexec_get_xenheap(xen_kexec_range_t *range)
     3.5  {
     3.6  	range->start = (ia64_tpa(_end) + (ELF_PAGE_SIZE - 1)) & ELF_PAGE_MASK;
     3.7 -	range->size = (unsigned long)xenheap_phys_end -
     3.8 -		      (unsigned long)range->start;
     3.9 +	range->size =
    3.10 +		(((unsigned long)range->start + KERNEL_TR_PAGE_SIZE) &
    3.11 +         ~(KERNEL_TR_PAGE_SIZE - 1))
    3.12 +		- (unsigned long)range->start;
    3.13  	return 0;
    3.14  }
    3.15  
    3.16 @@ -195,7 +197,6 @@ int machine_kexec_get(xen_kexec_range_t 
    3.17  
    3.18  void arch_crash_save_vmcoreinfo(void)
    3.19  {
    3.20 -    VMCOREINFO_SYMBOL(xenheap_phys_end);
    3.21  	VMCOREINFO_SYMBOL(dom_xen);
    3.22  	VMCOREINFO_SYMBOL(dom_io);
    3.23  	VMCOREINFO_SYMBOL(xen_pstart);
     4.1 --- a/xen/arch/ia64/xen/mm.c	Fri Jan 30 11:12:44 2009 +0900
     4.2 +++ b/xen/arch/ia64/xen/mm.c	Fri Jan 30 11:12:57 2009 +0900
     4.3 @@ -466,7 +466,7 @@ share_xen_page_with_guest(struct page_in
     4.4  
     4.5      page_set_owner(page, d);
     4.6      wmb(); /* install valid domain ptr before updating refcnt. */
     4.7 -    ASSERT(page->count_info == 0);
     4.8 +    ASSERT((page->count_info & ~PGC_xen_heap)== 0);
     4.9  
    4.10      /* Only add to the allocation list if the domain isn't dying. */
    4.11      if ( !d->is_dying )
    4.12 @@ -987,7 +987,7 @@ assign_domain_page(struct domain *d,
    4.13      struct page_info* page = mfn_to_page(physaddr >> PAGE_SHIFT);
    4.14  
    4.15      BUG_ON((physaddr & _PAGE_PPN_MASK) != physaddr);
    4.16 -    BUG_ON(page->count_info != (PGC_allocated | 1));
    4.17 +    BUG_ON((page->count_info & ~PGC_xen_heap) != (PGC_allocated | 1));
    4.18      set_gpfn_from_mfn(physaddr >> PAGE_SHIFT, mpaddr >> PAGE_SHIFT);
    4.19      // because __assign_domain_page() uses set_pte_rel() which has
    4.20      // release semantics, smp_mb() isn't needed.
    4.21 @@ -2894,7 +2894,8 @@ guest_physmap_add_page(struct domain *d,
    4.22  
    4.23      for (i = 0; i < (1UL << page_order); i++) {
    4.24          BUG_ON(!mfn_valid(mfn));
    4.25 -        BUG_ON(mfn_to_page(mfn)->count_info != (PGC_allocated | 1));
    4.26 +        BUG_ON((mfn_to_page(mfn)->count_info & ~PGC_xen_heap) !=
    4.27 +               (PGC_allocated | 1));
    4.28          __guest_physmap_add_page(d, gpfn, mfn);
    4.29          mfn++;
    4.30          gpfn++;
     5.1 --- a/xen/arch/ia64/xen/xensetup.c	Fri Jan 30 11:12:44 2009 +0900
     5.2 +++ b/xen/arch/ia64/xen/xensetup.c	Fri Jan 30 11:12:57 2009 +0900
     5.3 @@ -33,7 +33,7 @@
     5.4  #include <asm/sn/simulator.h>
     5.5  #include <asm/sal.h>
     5.6  
     5.7 -unsigned long xenheap_phys_end, total_pages;
     5.8 +unsigned long total_pages;
     5.9  
    5.10  char saved_command_line[COMMAND_LINE_SIZE];
    5.11  char __initdata dom0_command_line[COMMAND_LINE_SIZE];
    5.12 @@ -72,25 +72,11 @@ integer_param("xencons", opt_xencons);
    5.13  static int __initdata opt_xencons_poll;
    5.14  boolean_param("xencons_poll", opt_xencons_poll);
    5.15  
    5.16 +#define XENHEAP_DEFAULT_SIZE    KERNEL_TR_PAGE_SIZE
    5.17 +#define XENHEAP_SIZE_MIN        (16 * 1024 * 1024)      /* 16MBytes */
    5.18  unsigned long xenheap_size = XENHEAP_DEFAULT_SIZE;
    5.19  unsigned long xen_pstart;
    5.20  
    5.21 -static void __init parse_xenheap_megabytes(char *s)
    5.22 -{
    5.23 -    unsigned long megabytes = simple_strtoll(s, NULL, 0);
    5.24 -
    5.25 -#define XENHEAP_MEGABYTES_MIN   16UL
    5.26 -    if (megabytes < XENHEAP_MEGABYTES_MIN)
    5.27 -        megabytes = XENHEAP_MEGABYTES_MIN;
    5.28 -
    5.29 -#define XENHEAP_MEGABYTES_MAX   4096UL  /* need more? */
    5.30 -    if (megabytes > XENHEAP_MEGABYTES_MAX)
    5.31 -        megabytes = XENHEAP_MEGABYTES_MAX;
    5.32 -
    5.33 -    xenheap_size =  megabytes * 1024 * 1024;
    5.34 -}
    5.35 -custom_param("xenheap_megabytes", parse_xenheap_megabytes);
    5.36 -
    5.37  static int __init
    5.38  xen_count_pages(u64 start, u64 end, void *arg)
    5.39  {
    5.40 @@ -315,7 +301,7 @@ init_xenheap_mds(unsigned long start, un
    5.41              unsigned long s = max(start, max(__pa(desc->xen_heap_start),
    5.42                                               md->phys_addr));
    5.43              unsigned long e = min(end, min(md_end, desc->xenheap_phys_end));
    5.44 -            init_xenheap_pages(s, e);
    5.45 +            init_boot_pages(s, e);
    5.46          }
    5.47      }
    5.48  
    5.49 @@ -362,6 +348,7 @@ void __init start_kernel(void)
    5.50      struct domain *idle_domain;
    5.51      struct vcpu *dom0_vcpu0;
    5.52      efi_memory_desc_t *kern_md, *last_md, *md;
    5.53 +    unsigned long xenheap_phys_end;
    5.54      void *xen_heap_start;
    5.55      struct xen_heap_desc heap_desc;
    5.56  #ifdef CONFIG_SMP
    5.57 @@ -422,11 +409,9 @@ void __init start_kernel(void)
    5.58       * for the actual xenheap.
    5.59       */
    5.60      max_page = efi_get_max_addr() >> PAGE_SHIFT;
    5.61 -    while ((max_page >> 3) > xenheap_size - (XENHEAP_MEGABYTES_MIN << 20))
    5.62 +    while ((max_page >> 3) > xenheap_size - XENHEAP_SIZE_MIN)
    5.63          xenheap_size <<= 1;
    5.64  
    5.65 -    BUG_ON(xenheap_size > (XENHEAP_MEGABYTES_MAX << 20));
    5.66 -
    5.67      xenheap_phys_end = xen_pstart + xenheap_size;
    5.68      printk("xen image pstart: 0x%lx, xenheap pend: 0x%lx\n",
    5.69             xen_pstart, xenheap_phys_end);
    5.70 @@ -731,8 +716,8 @@ void arch_get_xen_caps(xen_capabilities_
    5.71  
    5.72  int xen_in_range(paddr_t start, paddr_t end)
    5.73  {
    5.74 -    start = max_t(paddr_t, start, xen_pstart);
    5.75 -    end = min_t(paddr_t, end, xen_pstart + XENHEAP_DEFAULT_SIZE);
    5.76 +    paddr_t xs = __pa(&_start);
    5.77 +    paddr_t xe = __pa(&_end);
    5.78  
    5.79 -    return start < end;
    5.80 +    return (start < xe) && (end > xs);
    5.81  }
     6.1 --- a/xen/common/page_alloc.c	Fri Jan 30 11:12:44 2009 +0900
     6.2 +++ b/xen/common/page_alloc.c	Fri Jan 30 11:12:57 2009 +0900
     6.3 @@ -631,7 +631,7 @@ void __init scrub_heap_pages(void)
     6.4   * XEN-HEAP SUB-ALLOCATOR
     6.5   */
     6.6  
     6.7 -#ifndef __x86_64__
     6.8 +#if !defined(__x86_64__) && !defined(__ia64__)
     6.9  
    6.10  void init_xenheap_pages(paddr_t ps, paddr_t pe)
    6.11  {
     7.1 --- a/xen/include/asm-ia64/config.h	Fri Jan 30 11:12:44 2009 +0900
     7.2 +++ b/xen/include/asm-ia64/config.h	Fri Jan 30 11:12:57 2009 +0900
     7.3 @@ -86,7 +86,6 @@ typedef unsigned long paddr_t;
     7.4  // FIXME?: x86-ism used in xen/mm.h
     7.5  #define LOCK_PREFIX
     7.6  
     7.7 -extern unsigned long xenheap_phys_end;
     7.8  extern unsigned long total_pages;
     7.9  extern unsigned long xen_pstart;
    7.10  extern unsigned long xenheap_size;
    7.11 @@ -119,9 +118,6 @@ extern char _end[]; /* standard ELF symb
    7.12  // FIXME SMP: leave SMP for a later time
    7.13  ///////////////////////////////////////////////////////////////
    7.14  // xen/include/asm/config.h
    7.15 -// Natural boundary upon TR size to define xenheap space
    7.16 -#define XENHEAP_DEFAULT_MB (1 << (KERNEL_TR_PAGE_SHIFT - 20))
    7.17 -#define XENHEAP_DEFAULT_SIZE	(1 << KERNEL_TR_PAGE_SHIFT)
    7.18  #define	ELFSIZE	64
    7.19  
    7.20  ///////////////////////////////////////////////////////////////
     8.1 --- a/xen/include/asm-ia64/mm.h	Fri Jan 30 11:12:44 2009 +0900
     8.2 +++ b/xen/include/asm-ia64/mm.h	Fri Jan 30 11:12:57 2009 +0900
     8.3 @@ -114,16 +114,18 @@ struct page_info
     8.4   /* Cleared when the owning guest 'frees' this page. */
     8.5  #define _PGC_allocated    PG_shift(1)
     8.6  #define PGC_allocated     PG_mask(1, 1)
     8.7 - /* bit PG_shift(2) reserved. See asm-x86/mm.h */
     8.8 + /* Page is Xen heap? */
     8.9 +# define _PGC_xen_heap    PG_shift(2)
    8.10 +# define PGC_xen_heap     PG_mask(1, 2)
    8.11   /* bit PG_shift(3) reserved. See asm-x86/mm.h */
    8.12   /* PG_mask(7, 6) reserved. See asm-x86/mm.h*/
    8.13   /* Count of references to this frame. */
    8.14  #define PGC_count_width   PG_shift(6)
    8.15  #define PGC_count_mask    ((1UL<<PGC_count_width)-1)
    8.16  
    8.17 -#define is_xen_heap_mfn(mfn)   (((mfn) < paddr_to_pfn(xenheap_phys_end)) \
    8.18 -                                && ((mfn) >= paddr_to_pfn(xen_pstart)))
    8.19 -#define is_xen_heap_page(page) is_xen_heap_mfn(page_to_mfn(page))
    8.20 +#define is_xen_heap_page(page)  ((page)->count_info & PGC_xen_heap)
    8.21 +#define is_xen_heap_mfn(mfn)    (mfn_valid(mfn) &&                      \
    8.22 +                                 is_xen_heap_page(mfn_to_page(mfn)))
    8.23  
    8.24  #define page_get_owner(_p)      ((struct domain *)(_p)->u.inuse._domain)
    8.25  #define page_set_owner(_p, _d)	((_p)->u.inuse._domain = (unsigned long)(_d))