WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ppc-devel

[XenPPC] [PATCH 1/2] xen: remove start_info_t from dom0 building

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: [XenPPC] [PATCH 1/2] xen: remove start_info_t from dom0 building
From: Ryan Harper <ryanh@xxxxxxxxxx>
Date: Wed, 7 Feb 2007 17:34:42 -0600
Delivery-date: Wed, 07 Feb 2007 15:34:46 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.6+20040907i
The patch removes the construction of a start_info_t structure for dom0,
no longer needed now that Linux and construct its own start_info_t.
Patch 2 fixes up Linux to not look for /xen/start-info and just create
one from the devtree.

Included in the patch are:
-remove the page allocated for the start_info_t (RMA_START_INFO)
-remove start_info_t from construct_dom0()
-remove start_info_t from ofd_dom0_fixup()
-remove start_info_t from ofd_xen_props()
-add new /xen property "shared-info" in dom0 devtree
-add new /xen property "privileged" in dom0 devtree
-add new /xen property "initdomain" in dom0 devtree

Test booted on JS20, simple guest domU launched successfully.

-- 
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
(512) 838-9253   T/L: 678-9253
ryanh@xxxxxxxxxx


diffstat output:
 arch/powerpc/domain_build.c   |   43 ++++++++++--------------------------------
 arch/powerpc/ofd_fixup.c      |   19 ++++++++++++------
 arch/powerpc/oftree.h         |    2 -
 include/public/arch-powerpc.h |    9 +++-----
 4 files changed, 29 insertions(+), 44 deletions(-)

Signed-off-by: Ryan Harper <ryanh@xxxxxxxxxx>
---
diff -r 20e5f508accc xen/arch/powerpc/domain_build.c
--- a/xen/arch/powerpc/domain_build.c   Tue Feb 06 13:42:19 2007 -0600
+++ b/xen/arch/powerpc/domain_build.c   Wed Feb 07 15:28:28 2007 -0600
@@ -115,13 +115,14 @@ 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 am64 = 1;
     int preempt = 0;
     ulong msr;
     ulong pc;
     ulong r2;
+    ulong mod_start = 0;
+    ulong mod_len = 0;
     int vcpu;
 
     /* Sanity! */
@@ -185,24 +186,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);
-
-    sprintf(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
@@ -273,15 +258,13 @@ 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 {
+        } else
             printk("no initrd\n");
-            si->mod_start = 0;
-            si->mod_len = 0;
-        }
+
         /* it may be a function descriptor */
         fdesc = (ulong *)(dsi.v_kernstart + dsi.v_kernentry + kbase);
 
@@ -309,12 +292,8 @@ int construct_dom0(struct domain *d,
         msr = 0;
     }
 
-    v->arch.ctxt.gprs[3] = si->mod_start;
-    v->arch.ctxt.gprs[4] = si->mod_len;
-
-    memset(si->cmd_line, 0, sizeof(si->cmd_line));
-    if ( cmdline != NULL )
-        strncpy((char *)si->cmd_line, cmdline, sizeof(si->cmd_line)-1);
+    v->arch.ctxt.gprs[3] = mod_start;
+    v->arch.ctxt.gprs[4] = mod_len;
 
     v->arch.ctxt.msr = msr;
     v->arch.ctxt.pc = pc;
@@ -322,7 +301,7 @@ int construct_dom0(struct domain *d,
 
     printk("DOM: pc = 0x%lx, r2 = 0x%lx\n", pc, r2);
 
-    ofd_dom0_fixup(d, *ofh_tree + rma, si);
+    ofd_dom0_fixup(d, *ofh_tree + rma, cmdline);
 
     set_bit(_VCPUF_initialised, &v->vcpu_flags);
 
diff -r 20e5f508accc xen/arch/powerpc/ofd_fixup.c
--- a/xen/arch/powerpc/ofd_fixup.c      Tue Feb 06 13:42:19 2007 -0600
+++ b/xen/arch/powerpc/ofd_fixup.c      Wed Feb 07 15:38:28 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)
 {
     ofdn_t n;
     static const char path[] = "/xen";
@@ -349,9 +349,16 @@ 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] = (ulong)d->shared_info - page_to_maddr(d->arch.rma_page);
         val[1] = PAGE_SIZE;
-        ofd_prop_add(m, n, "start-info", val, sizeof (val));
+        ofd_prop_add(m, n, "shared-info", 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);
 
         val[1] =  RMA_LAST_DOM0 * PAGE_SIZE;
         val[0] =  rma_size(d->arch.rma_order) - val[1];
@@ -375,7 +382,7 @@ 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)
 {
     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);
 
     printk("Remove original /dart\n");
     ofd_prune_path(m, "/dart");
diff -r 20e5f508accc xen/arch/powerpc/oftree.h
--- a/xen/arch/powerpc/oftree.h Tue Feb 06 13:42:19 2007 -0600
+++ b/xen/arch/powerpc/oftree.h Wed Feb 07 15:14:19 2007 -0600
@@ -28,7 +28,7 @@ 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);
 extern void ofd_memory_props(void *m, struct domain *d);
 
 extern int firmware_image_start[0];
diff -r 20e5f508accc xen/include/public/arch-powerpc.h
--- a/xen/include/public/arch-powerpc.h Tue Feb 06 13:42:19 2007 -0600
+++ b/xen/include/public/arch-powerpc.h Wed Feb 07 15:39:09 2007 -0600
@@ -118,12 +118,11 @@ struct arch_vcpu_info {
 };
 
 #define RMA_SHARED_INFO 1
-#define RMA_START_INFO 2
-#define RMA_LAST_DOM0 2
+#define RMA_LAST_DOM0 1
 /* these are not used for dom0 so they should be last */
-#define RMA_CONSOLE 3
-#define RMA_STORE 4
-#define RMA_LAST_DOMU 4
+#define RMA_CONSOLE 2
+#define RMA_STORE 3
+#define RMA_LAST_DOMU 3
 
 /* Support for multi-processor guests. */
 #define MAX_VIRT_CPUS 32

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