ia64/xen-unstable

changeset 14234:6b42b8c08731

[POWERPC][XEN] Don't create a start_info_t structure for dom0.
It's no longer needed now that Linux constructs its own via device tree
properties.
Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author Hollis Blanchard <hollisb@us.ibm.com>
date Thu Mar 01 14:32:58 2007 -0600 (2007-03-01)
parents 7e9dc164b572
children 9f49a53fea30
files tools/libxc/powerpc64/xc_linux_build.c xen/arch/powerpc/domain_build.c xen/arch/powerpc/mm.c xen/arch/powerpc/ofd_fixup.c xen/arch/powerpc/oftree.h xen/include/asm-powerpc/domain.h xen/include/public/arch-powerpc.h
line diff
     1.1 --- a/tools/libxc/powerpc64/xc_linux_build.c	Mon Feb 19 16:49:12 2007 +0900
     1.2 +++ b/tools/libxc/powerpc64/xc_linux_build.c	Thu Mar 01 14:32:58 2007 -0600
     1.3 @@ -33,7 +33,6 @@
     1.4  #include <xc_private.h>
     1.5  #include <xg_private.h>
     1.6  #include <xenctrl.h>
     1.7 -#include <xen/arch-powerpc.h>
     1.8  
     1.9  #include "flatdevtree_env.h"
    1.10  #include "flatdevtree.h"
    1.11 @@ -256,10 +255,9 @@ int xc_linux_build(int xc_handle,
    1.12      }
    1.13  
    1.14      /* determine shared_info, console, and store paddr */
    1.15 -    shared_info_paddr = (rma_pages << PAGE_SHIFT) -
    1.16 -                        (RMA_SHARED_INFO * PAGE_SIZE);
    1.17 -    console_paddr = (rma_pages << PAGE_SHIFT) - (RMA_CONSOLE * PAGE_SIZE);
    1.18 -    store_paddr = (rma_pages << PAGE_SHIFT) - (RMA_STORE * PAGE_SIZE);
    1.19 +    shared_info_paddr = (rma_pages << PAGE_SHIFT) - PAGE_SIZE;
    1.20 +    console_paddr = shared_info_paddr - PAGE_SIZE;
    1.21 +    store_paddr = console_paddr - PAGE_SIZE;
    1.22  
    1.23      /* map paddrs to mfns */
    1.24      *store_mfn = page_array[(xen_pfn_t)(store_paddr >> PAGE_SHIFT)];
     2.1 --- a/xen/arch/powerpc/domain_build.c	Mon Feb 19 16:49:12 2007 +0900
     2.2 +++ b/xen/arch/powerpc/domain_build.c	Thu Mar 01 14:32:58 2007 -0600
     2.3 @@ -67,10 +67,12 @@ int construct_dom0(struct domain *d,
     2.4      uint rma_nrpages = 1 << d->arch.rma_order;
     2.5      ulong rma_sz = rma_size(d->arch.rma_order);
     2.6      ulong rma = page_to_maddr(d->arch.rma_page);
     2.7 -    start_info_t *si;
     2.8      ulong eomem;
     2.9      int preempt = 0;
    2.10      int vcpu;
    2.11 +    ulong mod_start = 0;
    2.12 +    ulong mod_len = 0;
    2.13 +    ulong shared_info_addr;
    2.14  
    2.15      /* Sanity! */
    2.16      BUG_ON(d->domain_id != 0);
    2.17 @@ -134,24 +136,8 @@ int construct_dom0(struct domain *d,
    2.18  
    2.19      ASSERT( image_len < rma_sz );
    2.20  
    2.21 -    si = (start_info_t *)(rma_addr(&d->arch, RMA_START_INFO) + rma);
    2.22 -    printk("xen_start_info: %p\n", si);
    2.23 -
    2.24 -    snprintf(si->magic, sizeof(si->magic), "xen-%i.%i-powerpc%d%s",
    2.25 -            xen_major_version(), xen_minor_version(), BITS_PER_LONG, "HV");
    2.26 -    si->flags = SIF_PRIVILEGED | SIF_INITDOMAIN;
    2.27 -
    2.28 -    si->shared_info = ((ulong)d->shared_info) - rma;
    2.29 -    printk("shared_info: 0x%lx,%p\n", si->shared_info, d->shared_info);
    2.30 -
    2.31 -    eomem = si->shared_info;
    2.32 -
    2.33 -    /* number of pages accessible */
    2.34 -    si->nr_pages = rma_sz >> PAGE_SHIFT;
    2.35 -
    2.36 -    si->pt_base = 0;
    2.37 -    si->nr_pt_frames = 0;
    2.38 -    si->mfn_list = 0;
    2.39 +    eomem = ((ulong)d->shared_info) - rma;
    2.40 +    printk("shared_info: 0x%lx,%p\n", eomem, d->shared_info);
    2.41  
    2.42      /* OF usually sits here:
    2.43       *   - Linux needs it to be loaded before the vmlinux or initrd
    2.44 @@ -217,14 +203,12 @@ int construct_dom0(struct domain *d,
    2.45          printk("loading initrd: 0x%lx, 0x%lx\n", dst, initrd_len);
    2.46          memcpy((void *)dst, (void *)initrd_start, initrd_len);
    2.47  
    2.48 -        si->mod_start = dst - rma;
    2.49 -        si->mod_len = image_len;
    2.50 +        mod_start = dst - rma;
    2.51 +        mod_len = image_len;
    2.52  
    2.53          dst = ALIGN_UP(dst + initrd_len, PAGE_SIZE);
    2.54      } else {
    2.55          printk("no initrd\n");
    2.56 -        si->mod_start = 0;
    2.57 -        si->mod_len = 0;
    2.58      }
    2.59  
    2.60      if (elf_64bit(&elf)) {
    2.61 @@ -233,8 +217,8 @@ int construct_dom0(struct domain *d,
    2.62          v->arch.ctxt.msr = 0;
    2.63      }
    2.64      v->arch.ctxt.gprs[2] = 0;
    2.65 -    v->arch.ctxt.gprs[3] = si->mod_start;
    2.66 -    v->arch.ctxt.gprs[4] = si->mod_len;
    2.67 +    v->arch.ctxt.gprs[3] = mod_start;
    2.68 +    v->arch.ctxt.gprs[4] = mod_len;
    2.69  
    2.70  	printk("dom0 initial register state:\n"
    2.71  			"    pc %016lx msr %016lx\n"
    2.72 @@ -248,11 +232,10 @@ int construct_dom0(struct domain *d,
    2.73  			v->arch.ctxt.gprs[4],
    2.74  			v->arch.ctxt.gprs[5]);
    2.75  
    2.76 -    memset(si->cmd_line, 0, sizeof(si->cmd_line));
    2.77 -    if ( cmdline != NULL )
    2.78 -        strlcpy((char *)si->cmd_line, cmdline, sizeof(si->cmd_line));
    2.79 +    /* convert xen pointer shared_info into guest physical */
    2.80 +    shared_info_addr = (ulong)d->shared_info - page_to_maddr(d->arch.rma_page);
    2.81  
    2.82 -    ofd_dom0_fixup(d, *ofh_tree + rma, si);
    2.83 +    ofd_dom0_fixup(d, *ofh_tree + rma, cmdline, shared_info_addr);
    2.84  
    2.85      set_bit(_VCPUF_initialised, &v->vcpu_flags);
    2.86  
     3.1 --- a/xen/arch/powerpc/mm.c	Mon Feb 19 16:49:12 2007 +0900
     3.2 +++ b/xen/arch/powerpc/mm.c	Thu Mar 01 14:32:58 2007 -0600
     3.3 @@ -384,8 +384,8 @@ int allocate_rma(struct domain *d, unsig
     3.4          clear_page((void *)page_to_maddr(&d->arch.rma_page[i]));
     3.5      }
     3.6  
     3.7 -    d->shared_info = (shared_info_t *)
     3.8 -        (rma_addr(&d->arch, RMA_SHARED_INFO) + rma_base);
     3.9 +    /* shared_info uses last page of RMA */
    3.10 +    d->shared_info = (shared_info_t *) (rma_base + rma_sz - PAGE_SIZE);
    3.11  
    3.12      /* if there are already running vcpus, adjust v->vcpu_info */
    3.13      /* XXX untested */
     4.1 --- a/xen/arch/powerpc/ofd_fixup.c	Mon Feb 19 16:49:12 2007 +0900
     4.2 +++ b/xen/arch/powerpc/ofd_fixup.c	Thu Mar 01 14:32:58 2007 -0600
     4.3 @@ -326,7 +326,7 @@ static ofdn_t ofd_rtas_props(void *m)
     4.4  }
     4.5  #endif
     4.6  
     4.7 -static ofdn_t ofd_xen_props(void *m, struct domain *d, start_info_t *si)
     4.8 +static ofdn_t ofd_xen_props(void *m, struct domain *d, ulong shared_info)
     4.9  {
    4.10      ofdn_t n;
    4.11      static const char path[] = "/xen";
    4.12 @@ -349,19 +349,25 @@ static ofdn_t ofd_xen_props(void *m, str
    4.13          ASSERT(xl < sizeof (xen));
    4.14          ofd_prop_add(m, n, "version", xen, xl + 1);
    4.15  
    4.16 -        val[0] = (ulong)si - page_to_maddr(d->arch.rma_page);
    4.17 +        /* convert xen pointer to guest physical */
    4.18 +        val[0] = shared_info;
    4.19          val[1] = PAGE_SIZE;
    4.20 -        ofd_prop_add(m, n, "start-info", val, sizeof (val));
    4.21 +        ofd_prop_add(m, n, "shared-info", val, sizeof (val));
    4.22  
    4.23 -        val[1] =  RMA_LAST_DOM0 * PAGE_SIZE;
    4.24 -        val[0] =  rma_size(d->arch.rma_order) - val[1];
    4.25 +        /* reserve PAGE_SIZE @ addr shared info */
    4.26          ofd_prop_add(m, n, "reserved", val, sizeof (val));
    4.27  
    4.28 +        /* flags |= SIF_PROVILEDGED; */
    4.29 +        ofd_prop_add(m, n, "privileged", NULL, 0);
    4.30 +
    4.31 +        /* flags |= SIF_INITDOMAIN; */
    4.32 +        ofd_prop_add(m, n, "initdomain", NULL, 0);
    4.33 +
    4.34          /* tell dom0 that Xen depends on it to have power control */
    4.35          if (!rtas_entry)
    4.36              ofd_prop_add(m, n, "power-control", NULL, 0);
    4.37  
    4.38 -        /* tell dom0 where ranted pages go in the linear map */
    4.39 +        /* tell dom0 where granted pages go in the linear map */
    4.40          val[0] = cpu_foreign_map_order();
    4.41          val[1] = d->arch.foreign_mfn_count;
    4.42          ofd_prop_add(m, n, "foreign-map", val, sizeof (val));
    4.43 @@ -375,7 +381,8 @@ static ofdn_t ofd_xen_props(void *m, str
    4.44      return n;
    4.45  }
    4.46  
    4.47 -int ofd_dom0_fixup(struct domain *d, ulong mem, start_info_t *si)
    4.48 +int ofd_dom0_fixup(struct domain *d, ulong mem, const char *cmdline,
    4.49 +                   ulong shared_info)
    4.50  {
    4.51      void *m;
    4.52      const ofdn_t n = OFD_ROOT;
    4.53 @@ -401,13 +408,13 @@ int ofd_dom0_fixup(struct domain *d, ulo
    4.54      ofd_cpus_props(m, d);
    4.55  
    4.56      printk("Add /chosen props\n");
    4.57 -    ofd_chosen_props(m, (char *)si->cmd_line);
    4.58 +    ofd_chosen_props(m, cmdline);
    4.59  
    4.60      printk("fix /memory props\n");
    4.61      ofd_memory_props(m, d);
    4.62  
    4.63      printk("fix /xen props\n");
    4.64 -    ofd_xen_props(m, d, si);
    4.65 +    ofd_xen_props(m, d, shared_info);
    4.66  
    4.67      printk("Remove original /dart\n");
    4.68      ofd_prune_path(m, "/dart");
     5.1 --- a/xen/arch/powerpc/oftree.h	Mon Feb 19 16:49:12 2007 +0900
     5.2 +++ b/xen/arch/powerpc/oftree.h	Thu Mar 01 14:32:58 2007 -0600
     5.3 @@ -28,7 +28,8 @@ extern ulong oftree_len;
     5.4  extern ulong oftree_end;
     5.5  extern ofdn_t ofd_boot_cpu;
     5.6  
     5.7 -extern int ofd_dom0_fixup(struct domain *d, ulong mem, start_info_t *si);
     5.8 +extern int ofd_dom0_fixup(struct domain *d, ulong mem, const char *cmdline,
     5.9 +                          ulong shared_info);
    5.10  extern void ofd_memory_props(void *m, struct domain *d);
    5.11  
    5.12  extern int firmware_image_start[0];
     6.1 --- a/xen/include/asm-powerpc/domain.h	Mon Feb 19 16:49:12 2007 +0900
     6.2 +++ b/xen/include/asm-powerpc/domain.h	Thu Mar 01 14:32:58 2007 -0600
     6.3 @@ -109,9 +109,4 @@ extern void load_float(struct vcpu *);
     6.4  
     6.5  #define rma_size(rma_order) (1UL << ((rma_order) + PAGE_SHIFT))
     6.6  
     6.7 -static inline ulong rma_addr(struct arch_domain *ad, int type)
     6.8 -{
     6.9 -    return rma_size(ad->rma_order) - (type * PAGE_SIZE);
    6.10 -}
    6.11 -
    6.12  #endif
     7.1 --- a/xen/include/public/arch-powerpc.h	Mon Feb 19 16:49:12 2007 +0900
     7.2 +++ b/xen/include/public/arch-powerpc.h	Thu Mar 01 14:32:58 2007 -0600
     7.3 @@ -118,14 +118,6 @@ struct arch_shared_info {
     7.4  struct arch_vcpu_info {
     7.5  };
     7.6  
     7.7 -#define RMA_SHARED_INFO 1
     7.8 -#define RMA_START_INFO 2
     7.9 -#define RMA_LAST_DOM0 2
    7.10 -/* these are not used for dom0 so they should be last */
    7.11 -#define RMA_CONSOLE 3
    7.12 -#define RMA_STORE 4
    7.13 -#define RMA_LAST_DOMU 4
    7.14 -
    7.15  /* Support for multi-processor guests. */
    7.16  #define MAX_VIRT_CPUS 32
    7.17  #endif