direct-io.hg

changeset 11381:bc349d862a5d

[XEN][POWERPC] Allocate more memory than RMA for Dom0

The following patch will only effect Dom0 at the moment and allow it
to be created with memory larger than RMA. It works by allocating
extents (AKA chunks) of memory of an order specified by the processor.
The extent size should be a value that is capabable of mapping a
"large page" so we use the 970s large page size. These extents are
tracked by an extents list that simply tracks these page allocations
and what there mapping is. Other sub-systems effected by this:
- Dom0 OFD devtree /memory cleanup
- log_large_page_sizes is now an array
- Config for minumum Dom0 size

Caveats:
- There is a hack around HTAB allocation because we currently
allocate one at domain creation time, this will be correct by a
patch to follow.
- Dom0, or domains capable of mapping mfns byt have their extents be
PFN=MFN

Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author Jimi Xenidis <jimix@watson.ibm.com>
date Sun Aug 27 16:12:00 2006 -0400 (2006-08-27)
parents 6bd1a39dbfc8
children e07281779b88
files xen/arch/powerpc/Makefile xen/arch/powerpc/domain.c xen/arch/powerpc/domain_build.c xen/arch/powerpc/memory.c xen/arch/powerpc/mm.c xen/arch/powerpc/ofd_fixup.c xen/arch/powerpc/ofd_fixup_memory.c xen/arch/powerpc/oftree.h xen/arch/powerpc/powerpc64/ppc970.c xen/include/asm-powerpc/config.h xen/include/asm-powerpc/domain.h xen/include/asm-powerpc/mm.h xen/include/asm-powerpc/processor.h
line diff
     1.1 --- a/xen/arch/powerpc/Makefile	Fri Aug 25 15:09:36 2006 -0500
     1.2 +++ b/xen/arch/powerpc/Makefile	Sun Aug 27 16:12:00 2006 -0400
     1.3 @@ -31,6 +31,7 @@ obj-y += mpic_init.o
     1.4  obj-y += of-devtree.o
     1.5  obj-y += of-devwalk.o
     1.6  obj-y += ofd_fixup.o
     1.7 +obj-y += ofd_fixup_memory.o
     1.8  obj-y += physdev.o
     1.9  obj-y += rtas.o
    1.10  obj-y += setup.o
     2.1 --- a/xen/arch/powerpc/domain.c	Fri Aug 25 15:09:36 2006 -0500
     2.2 +++ b/xen/arch/powerpc/domain.c	Sun Aug 27 16:12:00 2006 -0400
     2.3 @@ -114,6 +114,8 @@ int arch_domain_create(struct domain *d)
     2.4      }
     2.5      htab_alloc(d, htab_order_pages);
     2.6  
     2.7 +    INIT_LIST_HEAD(&d->arch.extent_list);
     2.8 +
     2.9      return 0;
    2.10  }
    2.11  
    2.12 @@ -262,6 +264,7 @@ void sync_vcpu_execstate(struct vcpu *v)
    2.13  void domain_relinquish_resources(struct domain *d)
    2.14  {
    2.15      free_domheap_pages(d->arch.rma_page, d->arch.rma_order);
    2.16 +    free_extents(d);
    2.17  }
    2.18  
    2.19  void arch_dump_domain_info(struct domain *d)
     3.1 --- a/xen/arch/powerpc/domain_build.c	Fri Aug 25 15:09:36 2006 -0500
     3.2 +++ b/xen/arch/powerpc/domain_build.c	Sun Aug 27 16:12:00 2006 -0400
     3.3 @@ -30,6 +30,8 @@
     3.4  #include <asm/papr.h>
     3.5  #include "oftree.h"
     3.6  
     3.7 +#define log2(x) ffz(~(x))
     3.8 +
     3.9  extern int parseelfimage_32(struct domain_setup_info *dsi);
    3.10  extern int loadelfimage_32(struct domain_setup_info *dsi);
    3.11  
    3.12 @@ -109,8 +111,10 @@ int construct_dom0(struct domain *d,
    3.13      struct domain_setup_info dsi;
    3.14      ulong dst;
    3.15      u64 *ofh_tree;
    3.16 +    uint rma_nrpages = 1 << d->arch.rma_order;
    3.17      ulong rma_sz = rma_size(d->arch.rma_order);
    3.18      ulong rma = page_to_maddr(d->arch.rma_page);
    3.19 +    uint htab_order;
    3.20      start_info_t *si;
    3.21      ulong eomem;
    3.22      int am64 = 1;
    3.23 @@ -151,13 +155,36 @@ int construct_dom0(struct domain *d,
    3.24      /* By default DOM0 is allocated all available memory. */
    3.25      d->max_pages = ~0U;
    3.26  
    3.27 +    /* default is the max(1/16th of memory, CONFIG_MIN_DOM0_PAGES) */
    3.28      if (dom0_nrpages == 0) {
    3.29 -        dom0_nrpages = 1UL << d->arch.rma_order;
    3.30 +        dom0_nrpages = total_pages >> 4;
    3.31 +
    3.32 +        if (dom0_nrpages < CONFIG_MIN_DOM0_PAGES)
    3.33 +            dom0_nrpages = CONFIG_MIN_DOM0_PAGES;
    3.34      }
    3.35  
    3.36 +    /* make sure we are at least as big as the RMA */
    3.37 +    if (dom0_nrpages < rma_nrpages)
    3.38 +        dom0_nrpages = rma_nrpages;
    3.39 +    else
    3.40 +        dom0_nrpages = allocate_extents(d, dom0_nrpages, rma_nrpages);
    3.41 +
    3.42      d->tot_pages = dom0_nrpages;
    3.43      ASSERT(d->tot_pages > 0);
    3.44      
    3.45 +    htab_order = log2(d->tot_pages) - 6;
    3.46 +    if (d->arch.htab.order > 0) {
    3.47 +        /* we incorrectly allocate this too early so lets adjust if
    3.48 +         * necessary */
    3.49 +        printk("WARNING: htab allocated to early\n");
    3.50 +        if (d->arch.htab.order < htab_order) {
    3.51 +            printk("WARNING: htab reallocated for more memory: 0x%x\n",
    3.52 +                htab_order);
    3.53 +            htab_free(d);
    3.54 +            htab_alloc(d, htab_order);
    3.55 +        }
    3.56 +    }
    3.57 +
    3.58      ASSERT( image_len < rma_sz );
    3.59  
    3.60      si = (start_info_t *)(rma_addr(&d->arch, RMA_START_INFO) + rma);
    3.61 @@ -276,7 +303,7 @@ int construct_dom0(struct domain *d,
    3.62  
    3.63      printk("DOM: pc = 0x%lx, r2 = 0x%lx\n", pc, r2);
    3.64  
    3.65 -    ofd_dom0_fixup(d, *ofh_tree + rma, si, dst - rma);
    3.66 +    ofd_dom0_fixup(d, *ofh_tree + rma, si);
    3.67  
    3.68      set_bit(_VCPUF_initialised, &v->vcpu_flags);
    3.69  
     4.1 --- a/xen/arch/powerpc/memory.c	Fri Aug 25 15:09:36 2006 -0500
     4.2 +++ b/xen/arch/powerpc/memory.c	Sun Aug 27 16:12:00 2006 -0400
     4.3 @@ -64,8 +64,7 @@ static void set_max_page(struct membuf *
     4.4      }
     4.5  }
     4.6  
     4.7 -/* mark all memory from modules onward as unused, skipping hole(s),
     4.8 - * and returning size of hole(s) */
     4.9 +/* mark all memory from modules onward as unused */
    4.10  static void heap_init(struct membuf *mb, uint entries)
    4.11  {
    4.12      int i;
     5.1 --- a/xen/arch/powerpc/mm.c	Fri Aug 25 15:09:36 2006 -0500
     5.2 +++ b/xen/arch/powerpc/mm.c	Sun Aug 27 16:12:00 2006 -0400
     5.3 @@ -239,6 +239,69 @@ static int mfn_in_hole(ulong mfn)
     5.4      return 0;
     5.5  }
     5.6  
     5.7 +static uint add_extent(struct domain *d, struct page_info *pg, uint order)
     5.8 +{
     5.9 +    struct page_extents *pe;
    5.10 +
    5.11 +    pe = xmalloc(struct page_extents);
    5.12 +    if (pe == NULL)
    5.13 +        return 0;
    5.14 +
    5.15 +    pe->pg = pg;
    5.16 +    pe->order = order;
    5.17 +    pe->pfn = page_to_mfn(pg);
    5.18 +
    5.19 +    list_add_tail(&pe->pe_list, &d->arch.extent_list);
    5.20 +
    5.21 +    return pe->pfn;
    5.22 +}
    5.23 +
    5.24 +void free_extents(struct domain *d)
    5.25 +{
    5.26 +    /* we just need to free the memory behind list */
    5.27 +    struct list_head *list;
    5.28 +    struct list_head *ent;
    5.29 +    struct list_head *next;
    5.30 +
    5.31 +    list = &d->arch.extent_list;
    5.32 +    ent = list->next;
    5.33 +
    5.34 +    while (ent != list) {
    5.35 +        next = ent->next;
    5.36 +        xfree(ent);
    5.37 +        ent = next;
    5.38 +    }
    5.39 +}
    5.40 +
    5.41 +uint allocate_extents(struct domain *d, uint nrpages, uint rma_nrpages)
    5.42 +{
    5.43 +    uint ext_order;
    5.44 +    uint ext_nrpages;
    5.45 +    uint total_nrpages;
    5.46 +    struct page_info *pg;
    5.47 +
    5.48 +    ext_order = cpu_extent_order();
    5.49 +    ext_nrpages = 1 << ext_order;
    5.50 +
    5.51 +    total_nrpages = rma_nrpages;
    5.52 +
    5.53 +    /* We only allocate in nr_extsz chunks so if you are not divisible
    5.54 +     * you get more than you asked for */
    5.55 +    while (total_nrpages < nrpages) {
    5.56 +        pg = alloc_domheap_pages(d, ext_order, 0);
    5.57 +        if (pg == NULL)
    5.58 +            return total_nrpages;
    5.59 +
    5.60 +        if (add_extent(d, pg, ext_order) == 0) {
    5.61 +            free_domheap_pages(pg, ext_order);
    5.62 +            return total_nrpages;
    5.63 +        }
    5.64 +        total_nrpages += ext_nrpages;
    5.65 +    }
    5.66 +
    5.67 +    return total_nrpages;
    5.68 +}
    5.69 +        
    5.70  int allocate_rma(struct domain *d, unsigned int order_pages)
    5.71  {
    5.72      ulong rma_base;
    5.73 @@ -266,6 +329,7 @@ ulong pfn2mfn(struct domain *d, long pfn
    5.74  {
    5.75      ulong rma_base_mfn = page_to_mfn(d->arch.rma_page);
    5.76      ulong rma_size_mfn = 1UL << d->arch.rma_order;
    5.77 +    struct page_extents *pe;
    5.78  
    5.79      if (pfn < rma_size_mfn) {
    5.80          if (type)
    5.81 @@ -280,6 +344,17 @@ ulong pfn2mfn(struct domain *d, long pfn
    5.82          return pfn;
    5.83      }
    5.84  
    5.85 +    /* quick tests first */
    5.86 +    list_for_each_entry (pe, &d->arch.extent_list, pe_list) {
    5.87 +        uint end_pfn = pe->pfn + (1 << pe->order);
    5.88 +
    5.89 +        if (pfn >= pe->pfn && pfn < end_pfn) {
    5.90 +            if (type)
    5.91 +                *type = PFN_TYPE_LOGICAL;
    5.92 +            return page_to_mfn(pe->pg) + (pfn - pe->pfn);
    5.93 +        }
    5.94 +    }
    5.95 +
    5.96      /* This hack allows dom0 to map all memory, necessary to
    5.97       * initialize domU state. */
    5.98      if (test_bit(_DOMF_privileged, &d->domain_flags)) {
     6.1 --- a/xen/arch/powerpc/ofd_fixup.c	Fri Aug 25 15:09:36 2006 -0500
     6.2 +++ b/xen/arch/powerpc/ofd_fixup.c	Sun Aug 27 16:12:00 2006 -0400
     6.3 @@ -13,7 +13,7 @@
     6.4   * along with this program; if not, write to the Free Software
     6.5   * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
     6.6   *
     6.7 - * Copyright (C) IBM Corp. 2005
     6.8 + * Copyright (C) IBM Corp. 2005, 2006
     6.9   *
    6.10   * Authors: Jimi Xenidis <jimix@watson.ibm.com>
    6.11   */
    6.12 @@ -317,91 +317,6 @@ static ofdn_t ofd_rtas_props(void *m)
    6.13  }
    6.14  #endif
    6.15  
    6.16 -struct mem_reg {
    6.17 -    u64 addr;
    6.18 -    u64 sz;
    6.19 -};
    6.20 -
    6.21 -static ofdn_t ofd_memory_chunk_create(void *m, ofdn_t p,
    6.22 -        const char *ppath,
    6.23 -        const char *name,
    6.24 -        const char *dt,
    6.25 -        ulong start, ulong size)
    6.26 -{
    6.27 -    struct mem_reg reg;
    6.28 -    char path[128];
    6.29 -    ulong l;
    6.30 -    u32 v;
    6.31 -    ofdn_t n;
    6.32 -    ulong nl = strlen(name) + 1;
    6.33 -    ulong dtl = strlen(dt) + 1;
    6.34 -
    6.35 -    l = snprintf(path, sizeof (path), "%s/%s@%lx", ppath, name, start);
    6.36 -    n = ofd_node_add(m, p, path, l + 1);
    6.37 -    ofd_prop_add(m, n, "name", name, nl);
    6.38 -
    6.39 -    v = 1;
    6.40 -    ofd_prop_add(m, n, "#address-cells", &v, sizeof (v));
    6.41 -    v = 0;
    6.42 -    ofd_prop_add(m, n, "#size-cells", &v, sizeof (v));
    6.43 -
    6.44 -    ofd_prop_add(m, n, "device_type", dt, dtl);
    6.45 -
    6.46 -    /* physical addresses usable without regard to OF */
    6.47 -    reg.addr = start;
    6.48 -    reg.sz = size;
    6.49 -    ofd_prop_add(m, n, "reg", &reg, sizeof (reg));
    6.50 -
    6.51 -    return n;
    6.52 -}
    6.53 -
    6.54 -static ofdn_t ofd_memory_props(void *m, struct domain *d, ulong eoload)
    6.55 -{
    6.56 -    ofdn_t n = -1;
    6.57 -    ulong start = 0;
    6.58 -    static char name[] = "memory";
    6.59 -    ulong mem_size = rma_size(d->arch.rma_order);
    6.60 -    ulong chunk_size = rma_size(d->arch.rma_order);
    6.61 -
    6.62 -    /* Remove all old memory props */
    6.63 -    do {
    6.64 -        ofdn_t old;
    6.65 -
    6.66 -        old = ofd_node_find_by_prop(m, OFD_ROOT, "device_type",
    6.67 -                                    name, sizeof(name));
    6.68 -        if (old <= 0) break;
    6.69 -
    6.70 -        ofd_node_prune(m, old);
    6.71 -    } while (1);
    6.72 -
    6.73 -    while (start < mem_size) {
    6.74 -        ulong size = (mem_size < chunk_size) ? mem_size : chunk_size;
    6.75 -
    6.76 -        n = ofd_memory_chunk_create(m, OFD_ROOT, "", "memory", "memory",
    6.77 -                start, size);
    6.78 -
    6.79 -        if (start == 0) {
    6.80 -            /* We are processing the first and RMA chunk */
    6.81 -
    6.82 -            /* free list of physical addresses available after OF and
    6.83 -             * client program have been accounted for */
    6.84 -            struct mem_reg avail[] = {
    6.85 -                /* 0 til OF @ 32MiB - 16KiB stack */
    6.86 -                { .addr = 0, .sz = ((32 << 20) - (16 << 10)) },
    6.87 -                /* end of loaded material to the end the chunk - 1 page */
    6.88 -                { .addr = eoload, .sz = chunk_size - eoload - PAGE_SIZE },
    6.89 -                /* the last page is reserved for xen_start_info */
    6.90 -            };
    6.91 -            ofd_prop_add(m, n, "available", &avail,
    6.92 -                    sizeof (avail));
    6.93 -        }
    6.94 -
    6.95 -        start += size;
    6.96 -        mem_size -= size;
    6.97 -    }
    6.98 -    return n;
    6.99 -}
   6.100 -
   6.101  static ofdn_t ofd_xen_props(void *m, struct domain *d, start_info_t *si)
   6.102  {
   6.103      ofdn_t n;
   6.104 @@ -442,7 +357,7 @@ static ofdn_t ofd_xen_props(void *m, str
   6.105      return n;
   6.106  }
   6.107  
   6.108 -int ofd_dom0_fixup(struct domain *d, ulong mem, start_info_t *si, ulong eoload)
   6.109 +int ofd_dom0_fixup(struct domain *d, ulong mem, start_info_t *si)
   6.110  {
   6.111      void *m;
   6.112      const ofdn_t n = OFD_ROOT;
   6.113 @@ -470,8 +385,8 @@ int ofd_dom0_fixup(struct domain *d, ulo
   6.114      printk("Add /chosen props\n");
   6.115      ofd_chosen_props(m, (char *)si->cmd_line);
   6.116  
   6.117 -    printk("fix /memory@0 props\n");
   6.118 -    ofd_memory_props(m, d, eoload);
   6.119 +    printk("fix /memory props\n");
   6.120 +    ofd_memory_props(m, d);
   6.121  
   6.122      printk("fix /xen props\n");
   6.123      ofd_xen_props(m, d, si);
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/xen/arch/powerpc/ofd_fixup_memory.c	Sun Aug 27 16:12:00 2006 -0400
     7.3 @@ -0,0 +1,107 @@
     7.4 +/*
     7.5 + * This program is free software; you can redistribute it and/or modify
     7.6 + * it under the terms of the GNU General Public License as published by
     7.7 + * the Free Software Foundation; either version 2 of the License, or
     7.8 + * (at your option) any later version.
     7.9 + *
    7.10 + * This program is distributed in the hope that it will be useful,
    7.11 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    7.12 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7.13 + * GNU General Public License for more details.
    7.14 + *
    7.15 + * You should have received a copy of the GNU General Public License
    7.16 + * along with this program; if not, write to the Free Software
    7.17 + * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    7.18 + *
    7.19 + * Copyright (C) IBM Corp. 2006
    7.20 + *
    7.21 + * Authors: Jimi Xenidis <jimix@watson.ibm.com>
    7.22 + */
    7.23 +
    7.24 +#include <xen/config.h>
    7.25 +#include <xen/lib.h>
    7.26 +#include <xen/sched.h>
    7.27 +#include <public/xen.h>
    7.28 +#include "of-devtree.h"
    7.29 +#include "oftree.h"
    7.30 +
    7.31 +static char memory[] = "memory";
    7.32 +
    7.33 +struct mem_reg {
    7.34 +    u64 addr;
    7.35 +    u64 sz;
    7.36 +};
    7.37 +
    7.38 +static void ofd_memory_clean(void *m)
    7.39 +{
    7.40 +    ofdn_t old;
    7.41 +
    7.42 +    /* Remove all old memory props */
    7.43 +    do {
    7.44 +        old = ofd_node_find_by_prop(m, OFD_ROOT, "device_type",
    7.45 +                                    memory, sizeof(memory));
    7.46 +        if (old <= 0)
    7.47 +            break;
    7.48 +
    7.49 +        ofd_node_prune(m, old);
    7.50 +    } while (1);
    7.51 +}
    7.52 +
    7.53 +static ofdn_t ofd_memory_node_create(
    7.54 +    void *m, ofdn_t p, const char *ppath, const char *name,
    7.55 +    const char *dt, ulong start, ulong size)
    7.56 +{
    7.57 +    struct mem_reg reg;
    7.58 +    char path[128];
    7.59 +    ulong l;
    7.60 +    ofdn_t n;
    7.61 +    ulong nl = strlen(name) + 1;
    7.62 +    ulong dtl = strlen(dt) + 1;
    7.63 +
    7.64 +    l = snprintf(path, sizeof (path), "%s/%s@%lx", ppath, name, start);
    7.65 +    n = ofd_node_add(m, p, path, l + 1);
    7.66 +    ofd_prop_add(m, n, "name", name, nl);
    7.67 +    ofd_prop_add(m, n, "device_type", dt, dtl);
    7.68 +
    7.69 +    /* physical addresses usable without regard to OF */
    7.70 +    reg.addr = start;
    7.71 +    reg.sz = size;
    7.72 +    ofd_prop_add(m, n, "reg", &reg, sizeof (reg));
    7.73 +
    7.74 +    return n;
    7.75 +}
    7.76 +
    7.77 +static void ofd_memory_rma_node(void *m, struct domain *d)
    7.78 +{
    7.79 +    ulong size = rma_size(d->arch.rma_order);
    7.80 +    ofdn_t n;
    7.81 +
    7.82 +    n = ofd_memory_node_create(m, OFD_ROOT, "", memory, memory, 0, size);
    7.83 +    BUG_ON(n <= 0);
    7.84 +}
    7.85 +
    7.86 +static void ofd_memory_extent_nodes(void *m, struct domain *d)
    7.87 +{
    7.88 +    ulong start;
    7.89 +    ulong size;
    7.90 +    ofdn_t n;
    7.91 +    struct page_extents *pe;
    7.92 +
    7.93 +    list_for_each_entry (pe, &d->arch.extent_list, pe_list) {
    7.94 +
    7.95 +        start = pe->pfn << PAGE_SHIFT;
    7.96 +        size = 1UL << (pe->order + PAGE_SHIFT);
    7.97 +
    7.98 +        n = ofd_memory_node_create(m, OFD_ROOT, "", memory, memory,
    7.99 +                                    start, size);
   7.100 +
   7.101 +        BUG_ON(n <= 0);
   7.102 +    }
   7.103 +}
   7.104 +
   7.105 +void ofd_memory_props(void *m, struct domain *d)
   7.106 +{
   7.107 +    ofd_memory_clean(m);
   7.108 +    ofd_memory_rma_node(m, d);
   7.109 +    ofd_memory_extent_nodes(m,d);
   7.110 +}
     8.1 --- a/xen/arch/powerpc/oftree.h	Fri Aug 25 15:09:36 2006 -0500
     8.2 +++ b/xen/arch/powerpc/oftree.h	Sun Aug 27 16:12:00 2006 -0400
     8.3 @@ -26,8 +26,8 @@ extern ulong oftree;
     8.4  extern ulong oftree_len;
     8.5  extern ulong oftree_end;
     8.6  
     8.7 -extern int ofd_dom0_fixup(
     8.8 -    struct domain *d, ulong mem, start_info_t *si, ulong dst);
     8.9 +extern int ofd_dom0_fixup(struct domain *d, ulong mem, start_info_t *si);
    8.10 +extern void ofd_memory_props(void *m, struct domain *d);
    8.11  
    8.12  extern int firmware_image_start[0];
    8.13  extern int firmware_image_size[0];
     9.1 --- a/xen/arch/powerpc/powerpc64/ppc970.c	Fri Aug 25 15:09:36 2006 -0500
     9.2 +++ b/xen/arch/powerpc/powerpc64/ppc970.c	Sun Aug 27 16:12:00 2006 -0400
     9.3 @@ -49,6 +49,10 @@ static struct rma_settings rma_orders[] 
     9.4      { .order = 38, .rmlr0 = 0, .rmlr12 = 0, }, /* 256 GB */
     9.5  };
     9.6  
     9.7 +static uint log_large_page_sizes[] = {
     9.8 +    4 + 20, /* (1 << 4) == 16M */
     9.9 +};
    9.10 +
    9.11  static struct rma_settings *cpu_find_rma(unsigned int order)
    9.12  {
    9.13      int i;
    9.14 @@ -66,14 +70,20 @@ unsigned int cpu_default_rma_order_pages
    9.15  
    9.16  unsigned int cpu_large_page_orders(uint *sizes, uint max)
    9.17  {
    9.18 -    uint lp_log_size = 4 + 20; /* (1 << 4) == 16M */
    9.19 -    if (max < 1)
    9.20 -        return 0;
    9.21 +    uint i = 0;
    9.22  
    9.23 -    sizes[0] = lp_log_size - PAGE_SHIFT;
    9.24 +    while (i < max && i < ARRAY_SIZE(log_large_page_sizes)) {
    9.25 +        sizes[i] = log_large_page_sizes[i] - PAGE_SHIFT;
    9.26 +        ++i;
    9.27 +    }
    9.28  
    9.29 -    return 1;
    9.30 -}    
    9.31 +    return i;
    9.32 +}
    9.33 +
    9.34 +unsigned int cpu_extent_order(void)
    9.35 +{
    9.36 +    return log_large_page_sizes[0] - PAGE_SHIFT;
    9.37 +}
    9.38  
    9.39  void cpu_initialize(int cpuid)
    9.40  {
    10.1 --- a/xen/include/asm-powerpc/config.h	Fri Aug 25 15:09:36 2006 -0500
    10.2 +++ b/xen/include/asm-powerpc/config.h	Sun Aug 27 16:12:00 2006 -0400
    10.3 @@ -47,6 +47,8 @@ extern char __bss_start[];
    10.4  /* this should be per processor, but for now */
    10.5  #define CACHE_LINE_SIZE 128
    10.6  
    10.7 +/* 256M - 64M of Xen space seems like a nice number */
    10.8 +#define CONFIG_MIN_DOM0_PAGES (192 << (20 - PAGE_SHIFT))
    10.9  #define CONFIG_SHADOW 1
   10.10  #define CONFIG_GDB 1
   10.11  #define CONFIG_SMP 1
    11.1 --- a/xen/include/asm-powerpc/domain.h	Fri Aug 25 15:09:36 2006 -0500
    11.2 +++ b/xen/include/asm-powerpc/domain.h	Sun Aug 27 16:12:00 2006 -0400
    11.3 @@ -38,6 +38,9 @@ struct arch_domain {
    11.4      struct page_info *rma_page;
    11.5      uint rma_order;
    11.6  
    11.7 +    /* list of extents beyond RMA */
    11.8 +    struct list_head extent_list;
    11.9 +
   11.10      /* I/O-port access bitmap mask. */
   11.11      u8 *iobmp_mask;       /* Address of IO bitmap mask, or NULL.      */
   11.12  
    12.1 --- a/xen/include/asm-powerpc/mm.h	Fri Aug 25 15:09:36 2006 -0500
    12.2 +++ b/xen/include/asm-powerpc/mm.h	Sun Aug 27 16:12:00 2006 -0400
    12.3 @@ -259,6 +259,8 @@ static inline unsigned long gmfn_to_mfn(
    12.4  #define mfn_to_gmfn(_d, mfn) (mfn)
    12.5  
    12.6  extern int allocate_rma(struct domain *d, unsigned int order_pages);
    12.7 +extern uint allocate_extents(struct domain *d, uint nrpages, uint rma_nrpages);
    12.8 +extern void free_extents(struct domain *d);
    12.9  
   12.10  extern int steal_page(struct domain *d, struct page_info *page,
   12.11                          unsigned int memflags);
    13.1 --- a/xen/include/asm-powerpc/processor.h	Fri Aug 25 15:09:36 2006 -0500
    13.2 +++ b/xen/include/asm-powerpc/processor.h	Sun Aug 27 16:12:00 2006 -0400
    13.3 @@ -40,6 +40,7 @@ struct cpu_user_regs;
    13.4  extern void show_registers(struct cpu_user_regs *);
    13.5  extern void show_execution_state(struct cpu_user_regs *);
    13.6  extern void show_backtrace(ulong sp, ulong lr, ulong pc);
    13.7 +extern unsigned int cpu_extent_order(void);
    13.8  extern unsigned int cpu_default_rma_order_pages(void);
    13.9  extern uint cpu_large_page_orders(uint *sizes, uint max);
   13.10  extern void cpu_initialize(int cpuid);