direct-io.hg

changeset 11379:215d5eae720c

[XEN][POWERPC] restructure RMA code to allow dom0 tools to allocate in the future
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author Hollis Blanchard <hollisb@us.ibm.com>
date Fri Aug 25 14:48:07 2006 -0500 (2006-08-25)
parents 43ec7afa5734
children 6bd1a39dbfc8
files xen/arch/powerpc/boot_of.c xen/arch/powerpc/domain.c xen/arch/powerpc/powerpc64/ppc970.c xen/arch/powerpc/setup.c xen/include/asm-powerpc/processor.h
line diff
     1.1 --- a/xen/arch/powerpc/boot_of.c	Fri Aug 25 15:28:48 2006 -0400
     1.2 +++ b/xen/arch/powerpc/boot_of.c	Fri Aug 25 14:48:07 2006 -0500
     1.3 @@ -727,7 +727,7 @@ static ulong find_space(u32 size, u32 al
     1.4                      __func__, space_base, eomem, size, align);
     1.5      base = ALIGN_UP(space_base, PAGE_SIZE);
     1.6  
     1.7 -    while ((base + size) < rma_size(cpu_rma_order())) {
     1.8 +    while ((base + size) < rma_size(cpu_default_rma_order_pages())) {
     1.9          if (of_claim(base, size, 0) != OF_FAILURE) {
    1.10              space_base = base + size;
    1.11              return base;
     2.1 --- a/xen/arch/powerpc/domain.c	Fri Aug 25 15:28:48 2006 -0400
     2.2 +++ b/xen/arch/powerpc/domain.c	Fri Aug 25 14:48:07 2006 -0500
     2.3 @@ -86,7 +86,7 @@ int arch_domain_create(struct domain *d)
     2.4          return 0;
     2.5      }
     2.6  
     2.7 -    d->arch.rma_order = cpu_rma_order();
     2.8 +    d->arch.rma_order = cpu_default_rma_order_pages();
     2.9      rma_sz = rma_size(d->arch.rma_order);
    2.10  
    2.11      /* allocate the real mode area */
     3.1 --- a/xen/arch/powerpc/powerpc64/ppc970.c	Fri Aug 25 15:28:48 2006 -0400
     3.2 +++ b/xen/arch/powerpc/powerpc64/ppc970.c	Fri Aug 25 14:48:07 2006 -0500
     3.3 @@ -34,11 +34,34 @@
     3.4  
     3.5  extern volatile struct processor_area * volatile global_cpu_table[];
     3.6  
     3.7 -unsigned int cpu_rma_order(void)
     3.8 +struct rma_settings {
     3.9 +    int order;
    3.10 +    int rmlr0;
    3.11 +    int rmlr12;
    3.12 +};
    3.13 +
    3.14 +static struct rma_settings rma_orders[] = {
    3.15 +    { .order = 26, .rmlr0 = 0, .rmlr12 = 3, }, /*  64 MB */
    3.16 +    { .order = 27, .rmlr0 = 1, .rmlr12 = 3, }, /* 128 MB */
    3.17 +    { .order = 28, .rmlr0 = 1, .rmlr12 = 0, }, /* 256 MB */
    3.18 +    { .order = 30, .rmlr0 = 0, .rmlr12 = 2, }, /*   1 GB */
    3.19 +    { .order = 34, .rmlr0 = 0, .rmlr12 = 1, }, /*  16 GB */
    3.20 +    { .order = 38, .rmlr0 = 0, .rmlr12 = 0, }, /* 256 GB */
    3.21 +};
    3.22 +
    3.23 +static struct rma_settings *cpu_find_rma(unsigned int order)
    3.24  {
    3.25 -    /* XXX what about non-HV mode? */
    3.26 -    uint rma_log_size = 6 + 20; /* (1 << 6) == 64 */
    3.27 -    return rma_log_size - PAGE_SHIFT;
    3.28 +    int i;
    3.29 +    for (i = 0; i < ARRAY_SIZE(rma_orders); i++) {
    3.30 +        if (rma_orders[i].order == order)
    3.31 +            return &rma_orders[i];
    3.32 +    }
    3.33 +    return NULL;
    3.34 +}
    3.35 +
    3.36 +unsigned int cpu_default_rma_order_pages(void)
    3.37 +{
    3.38 +    return rma_orders[0].order - PAGE_SHIFT;
    3.39  }
    3.40  
    3.41  unsigned int cpu_large_page_orders(uint *sizes, uint max)
    3.42 @@ -129,45 +152,22 @@ void cpu_init_vcpu(struct vcpu *v)
    3.43  {
    3.44      struct domain *d = v->domain;
    3.45      union hid4 hid4;
    3.46 -    ulong rma_base = page_to_maddr(d->arch.rma_page);
    3.47 -    ulong rma_size = rma_size(d->arch.rma_order);
    3.48 +    struct rma_settings *rma_settings;
    3.49  
    3.50      hid4.word = mfhid4();
    3.51  
    3.52      hid4.bits.lpes0 = 0; /* exceptions set MSR_HV=1 */
    3.53      hid4.bits.lpes1 = 1; /* RMA applies */
    3.54  
    3.55 -    hid4.bits.rmor = rma_base >> 26;
    3.56 +    hid4.bits.rmor = page_to_maddr(d->arch.rma_page) >> 26;
    3.57  
    3.58      hid4.bits.lpid01 = d->domain_id & 3;
    3.59      hid4.bits.lpid25 = (d->domain_id >> 2) & 0xf;
    3.60  
    3.61 -    switch (rma_size) {
    3.62 -        case 256ULL << 30:  /* 256 GB */
    3.63 -            hid4.bits.rmlr0 = 0;
    3.64 -            hid4.bits.rmlr12 = 0;
    3.65 -            break;
    3.66 -        case 16ULL << 30:   /* 16 GB */
    3.67 -            hid4.bits.rmlr0 = 0;
    3.68 -            hid4.bits.rmlr12 = 1;
    3.69 -            break;
    3.70 -        case 1ULL << 30:    /* 1 GB */
    3.71 -            hid4.bits.rmlr0 = 0;
    3.72 -            hid4.bits.rmlr12 = 2;
    3.73 -            break;
    3.74 -        case 64ULL << 20:   /* 64 MB */
    3.75 -            hid4.bits.rmlr0 = 0;
    3.76 -            hid4.bits.rmlr12 = 3;
    3.77 -            break;
    3.78 -        case 256ULL << 20:  /* 256 MB */
    3.79 -            hid4.bits.rmlr0 = 1;
    3.80 -            hid4.bits.rmlr12 = 0;
    3.81 -            break;
    3.82 -        case 128ULL << 20:  /* 128 MB */
    3.83 -            hid4.bits.rmlr0 = 1;
    3.84 -            hid4.bits.rmlr12 = 3;
    3.85 -            break;
    3.86 -    }
    3.87 +    rma_settings = cpu_find_rma(d->arch.rma_order + PAGE_SHIFT);
    3.88 +    ASSERT(rma_settings != NULL);
    3.89 +    hid4.bits.rmlr0 = rma_settings->rmlr0;
    3.90 +    hid4.bits.rmlr12 = rma_settings->rmlr12;
    3.91  
    3.92      v->arch.cpu.hid4.word = hid4.word;
    3.93  }
     4.1 --- a/xen/arch/powerpc/setup.c	Fri Aug 25 15:28:48 2006 -0400
     4.2 +++ b/xen/arch/powerpc/setup.c	Fri Aug 25 14:48:07 2006 -0500
     4.3 @@ -296,7 +296,7 @@ static void __init __start_xen(multiboot
     4.4  #endif
     4.5  
     4.6      /* we give the first RMA to the hypervisor */
     4.7 -    xenheap_phys_end = rma_size(cpu_rma_order());
     4.8 +    xenheap_phys_end = rma_size(cpu_default_rma_order_pages());
     4.9  
    4.10      /* Check that we have at least one Multiboot module. */
    4.11      if (!(mbi->flags & MBI_MODULES) || (mbi->mods_count == 0)) {
     5.1 --- a/xen/include/asm-powerpc/processor.h	Fri Aug 25 15:28:48 2006 -0400
     5.2 +++ b/xen/include/asm-powerpc/processor.h	Fri Aug 25 14:48:07 2006 -0500
     5.3 @@ -40,7 +40,7 @@ struct cpu_user_regs;
     5.4  extern void show_registers(struct cpu_user_regs *);
     5.5  extern void show_execution_state(struct cpu_user_regs *);
     5.6  extern void show_backtrace(ulong sp, ulong lr, ulong pc);
     5.7 -extern uint cpu_rma_order(void);
     5.8 +extern unsigned int cpu_default_rma_order_pages(void);
     5.9  extern uint cpu_large_page_orders(uint *sizes, uint max);
    5.10  extern void cpu_initialize(int cpuid);
    5.11  extern void cpu_init_vcpu(struct vcpu *);