[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [POWERPC][XEN] Don't create a start_info_t structure for dom0.



# HG changeset patch
# User Hollis Blanchard <hollisb@xxxxxxxxxx>
# Date 1172781178 21600
# Node ID 6b42b8c08731d7bc1abedac2239707e14ae8599d
# Parent  7e9dc164b5720dbf60929333d33f8d94e981fe5b
[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@xxxxxxxxxx>
Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>
---
 tools/libxc/powerpc64/xc_linux_build.c |    8 ++----
 xen/arch/powerpc/domain_build.c        |   43 +++++++++------------------------
 xen/arch/powerpc/mm.c                  |    4 +--
 xen/arch/powerpc/ofd_fixup.c           |   27 +++++++++++++-------
 xen/arch/powerpc/oftree.h              |    3 +-
 xen/include/asm-powerpc/domain.h       |    5 ---
 xen/include/public/arch-powerpc.h      |    8 ------
 7 files changed, 37 insertions(+), 61 deletions(-)

diff -r 7e9dc164b572 -r 6b42b8c08731 tools/libxc/powerpc64/xc_linux_build.c
--- a/tools/libxc/powerpc64/xc_linux_build.c    Mon Feb 19 16:49:12 2007 +0900
+++ b/tools/libxc/powerpc64/xc_linux_build.c    Thu Mar 01 14:32:58 2007 -0600
@@ -33,7 +33,6 @@
 #include <xc_private.h>
 #include <xg_private.h>
 #include <xenctrl.h>
-#include <xen/arch-powerpc.h>
 
 #include "flatdevtree_env.h"
 #include "flatdevtree.h"
@@ -256,10 +255,9 @@ int xc_linux_build(int xc_handle,
     }
 
     /* determine shared_info, console, and store paddr */
-    shared_info_paddr = (rma_pages << PAGE_SHIFT) -
-                        (RMA_SHARED_INFO * PAGE_SIZE);
-    console_paddr = (rma_pages << PAGE_SHIFT) - (RMA_CONSOLE * PAGE_SIZE);
-    store_paddr = (rma_pages << PAGE_SHIFT) - (RMA_STORE * PAGE_SIZE);
+    shared_info_paddr = (rma_pages << PAGE_SHIFT) - PAGE_SIZE;
+    console_paddr = shared_info_paddr - PAGE_SIZE;
+    store_paddr = console_paddr - PAGE_SIZE;
 
     /* map paddrs to mfns */
     *store_mfn = page_array[(xen_pfn_t)(store_paddr >> PAGE_SHIFT)];
diff -r 7e9dc164b572 -r 6b42b8c08731 xen/arch/powerpc/domain_build.c
--- a/xen/arch/powerpc/domain_build.c   Mon Feb 19 16:49:12 2007 +0900
+++ b/xen/arch/powerpc/domain_build.c   Thu Mar 01 14:32:58 2007 -0600
@@ -67,10 +67,12 @@ int construct_dom0(struct domain *d,
     uint rma_nrpages = 1 << d->arch.rma_order;
     ulong rma_sz = rma_size(d->arch.rma_order);
     ulong rma = page_to_maddr(d->arch.rma_page);
-    start_info_t *si;
     ulong eomem;
     int preempt = 0;
     int vcpu;
+    ulong mod_start = 0;
+    ulong mod_len = 0;
+    ulong shared_info_addr;
 
     /* Sanity! */
     BUG_ON(d->domain_id != 0);
@@ -134,24 +136,8 @@ int construct_dom0(struct domain *d,
 
     ASSERT( image_len < rma_sz );
 
-    si = (start_info_t *)(rma_addr(&d->arch, RMA_START_INFO) + rma);
-    printk("xen_start_info: %p\n", si);
-
-    snprintf(si->magic, sizeof(si->magic), "xen-%i.%i-powerpc%d%s",
-            xen_major_version(), xen_minor_version(), BITS_PER_LONG, "HV");
-    si->flags = SIF_PRIVILEGED | SIF_INITDOMAIN;
-
-    si->shared_info = ((ulong)d->shared_info) - rma;
-    printk("shared_info: 0x%lx,%p\n", si->shared_info, d->shared_info);
-
-    eomem = si->shared_info;
-
-    /* number of pages accessible */
-    si->nr_pages = rma_sz >> PAGE_SHIFT;
-
-    si->pt_base = 0;
-    si->nr_pt_frames = 0;
-    si->mfn_list = 0;
+    eomem = ((ulong)d->shared_info) - rma;
+    printk("shared_info: 0x%lx,%p\n", eomem, d->shared_info);
 
     /* OF usually sits here:
      *   - Linux needs it to be loaded before the vmlinux or initrd
@@ -217,14 +203,12 @@ int construct_dom0(struct domain *d,
         printk("loading initrd: 0x%lx, 0x%lx\n", dst, initrd_len);
         memcpy((void *)dst, (void *)initrd_start, initrd_len);
 
-        si->mod_start = dst - rma;
-        si->mod_len = image_len;
+        mod_start = dst - rma;
+        mod_len = image_len;
 
         dst = ALIGN_UP(dst + initrd_len, PAGE_SIZE);
     } else {
         printk("no initrd\n");
-        si->mod_start = 0;
-        si->mod_len = 0;
     }
 
     if (elf_64bit(&elf)) {
@@ -233,8 +217,8 @@ int construct_dom0(struct domain *d,
         v->arch.ctxt.msr = 0;
     }
     v->arch.ctxt.gprs[2] = 0;
-    v->arch.ctxt.gprs[3] = si->mod_start;
-    v->arch.ctxt.gprs[4] = si->mod_len;
+    v->arch.ctxt.gprs[3] = mod_start;
+    v->arch.ctxt.gprs[4] = mod_len;
 
        printk("dom0 initial register state:\n"
                        "    pc %016lx msr %016lx\n"
@@ -248,11 +232,10 @@ int construct_dom0(struct domain *d,
                        v->arch.ctxt.gprs[4],
                        v->arch.ctxt.gprs[5]);
 
-    memset(si->cmd_line, 0, sizeof(si->cmd_line));
-    if ( cmdline != NULL )
-        strlcpy((char *)si->cmd_line, cmdline, sizeof(si->cmd_line));
-
-    ofd_dom0_fixup(d, *ofh_tree + rma, si);
+    /* convert xen pointer shared_info into guest physical */
+    shared_info_addr = (ulong)d->shared_info - page_to_maddr(d->arch.rma_page);
+
+    ofd_dom0_fixup(d, *ofh_tree + rma, cmdline, shared_info_addr);
 
     set_bit(_VCPUF_initialised, &v->vcpu_flags);
 
diff -r 7e9dc164b572 -r 6b42b8c08731 xen/arch/powerpc/mm.c
--- a/xen/arch/powerpc/mm.c     Mon Feb 19 16:49:12 2007 +0900
+++ b/xen/arch/powerpc/mm.c     Thu Mar 01 14:32:58 2007 -0600
@@ -384,8 +384,8 @@ int allocate_rma(struct domain *d, unsig
         clear_page((void *)page_to_maddr(&d->arch.rma_page[i]));
     }
 
-    d->shared_info = (shared_info_t *)
-        (rma_addr(&d->arch, RMA_SHARED_INFO) + rma_base);
+    /* shared_info uses last page of RMA */
+    d->shared_info = (shared_info_t *) (rma_base + rma_sz - PAGE_SIZE);
 
     /* if there are already running vcpus, adjust v->vcpu_info */
     /* XXX untested */
diff -r 7e9dc164b572 -r 6b42b8c08731 xen/arch/powerpc/ofd_fixup.c
--- a/xen/arch/powerpc/ofd_fixup.c      Mon Feb 19 16:49:12 2007 +0900
+++ b/xen/arch/powerpc/ofd_fixup.c      Thu Mar 01 14:32:58 2007 -0600
@@ -326,7 +326,7 @@ static ofdn_t ofd_rtas_props(void *m)
 }
 #endif
 
-static ofdn_t ofd_xen_props(void *m, struct domain *d, start_info_t *si)
+static ofdn_t ofd_xen_props(void *m, struct domain *d, ulong shared_info)
 {
     ofdn_t n;
     static const char path[] = "/xen";
@@ -349,19 +349,25 @@ static ofdn_t ofd_xen_props(void *m, str
         ASSERT(xl < sizeof (xen));
         ofd_prop_add(m, n, "version", xen, xl + 1);
 
-        val[0] = (ulong)si - page_to_maddr(d->arch.rma_page);
+        /* convert xen pointer to guest physical */
+        val[0] = shared_info;
         val[1] = PAGE_SIZE;
-        ofd_prop_add(m, n, "start-info", val, sizeof (val));
-
-        val[1] =  RMA_LAST_DOM0 * PAGE_SIZE;
-        val[0] =  rma_size(d->arch.rma_order) - val[1];
+        ofd_prop_add(m, n, "shared-info", val, sizeof (val));
+
+        /* reserve PAGE_SIZE @ addr shared info */
         ofd_prop_add(m, n, "reserved", val, sizeof (val));
+
+        /* flags |= SIF_PROVILEDGED; */
+        ofd_prop_add(m, n, "privileged", NULL, 0);
+
+        /* flags |= SIF_INITDOMAIN; */
+        ofd_prop_add(m, n, "initdomain", NULL, 0);
 
         /* tell dom0 that Xen depends on it to have power control */
         if (!rtas_entry)
             ofd_prop_add(m, n, "power-control", NULL, 0);
 
-        /* tell dom0 where ranted pages go in the linear map */
+        /* tell dom0 where granted pages go in the linear map */
         val[0] = cpu_foreign_map_order();
         val[1] = d->arch.foreign_mfn_count;
         ofd_prop_add(m, n, "foreign-map", val, sizeof (val));
@@ -375,7 +381,8 @@ static ofdn_t ofd_xen_props(void *m, str
     return n;
 }
 
-int ofd_dom0_fixup(struct domain *d, ulong mem, start_info_t *si)
+int ofd_dom0_fixup(struct domain *d, ulong mem, const char *cmdline,
+                   ulong shared_info)
 {
     void *m;
     const ofdn_t n = OFD_ROOT;
@@ -401,13 +408,13 @@ int ofd_dom0_fixup(struct domain *d, ulo
     ofd_cpus_props(m, d);
 
     printk("Add /chosen props\n");
-    ofd_chosen_props(m, (char *)si->cmd_line);
+    ofd_chosen_props(m, cmdline);
 
     printk("fix /memory props\n");
     ofd_memory_props(m, d);
 
     printk("fix /xen props\n");
-    ofd_xen_props(m, d, si);
+    ofd_xen_props(m, d, shared_info);
 
     printk("Remove original /dart\n");
     ofd_prune_path(m, "/dart");
diff -r 7e9dc164b572 -r 6b42b8c08731 xen/arch/powerpc/oftree.h
--- a/xen/arch/powerpc/oftree.h Mon Feb 19 16:49:12 2007 +0900
+++ b/xen/arch/powerpc/oftree.h Thu Mar 01 14:32:58 2007 -0600
@@ -28,7 +28,8 @@ extern ulong oftree_end;
 extern ulong oftree_end;
 extern ofdn_t ofd_boot_cpu;
 
-extern int ofd_dom0_fixup(struct domain *d, ulong mem, start_info_t *si);
+extern int ofd_dom0_fixup(struct domain *d, ulong mem, const char *cmdline,
+                          ulong shared_info);
 extern void ofd_memory_props(void *m, struct domain *d);
 
 extern int firmware_image_start[0];
diff -r 7e9dc164b572 -r 6b42b8c08731 xen/include/asm-powerpc/domain.h
--- a/xen/include/asm-powerpc/domain.h  Mon Feb 19 16:49:12 2007 +0900
+++ b/xen/include/asm-powerpc/domain.h  Thu Mar 01 14:32:58 2007 -0600
@@ -109,9 +109,4 @@ extern void load_float(struct vcpu *);
 
 #define rma_size(rma_order) (1UL << ((rma_order) + PAGE_SHIFT))
 
-static inline ulong rma_addr(struct arch_domain *ad, int type)
-{
-    return rma_size(ad->rma_order) - (type * PAGE_SIZE);
-}
-
 #endif
diff -r 7e9dc164b572 -r 6b42b8c08731 xen/include/public/arch-powerpc.h
--- a/xen/include/public/arch-powerpc.h Mon Feb 19 16:49:12 2007 +0900
+++ b/xen/include/public/arch-powerpc.h Thu Mar 01 14:32:58 2007 -0600
@@ -118,14 +118,6 @@ struct arch_vcpu_info {
 struct arch_vcpu_info {
 };
 
-#define RMA_SHARED_INFO 1
-#define RMA_START_INFO 2
-#define RMA_LAST_DOM0 2
-/* these are not used for dom0 so they should be last */
-#define RMA_CONSOLE 3
-#define RMA_STORE 4
-#define RMA_LAST_DOMU 4
-
 /* Support for multi-processor guests. */
 #define MAX_VIRT_CPUS 32
 #endif

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.