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][2nd try] xen: remove start_info_t from dom0 buildin

Updated:
 - pass in shared_info guest physical to ofd_dom0_fixup()
 - only reserve shared info page in dom0 devtree
 - kill rma_addr()
 - kill RMA_* defines in public header
 - update xc_linux_build() to use last page of RMA as shared_info
 - update xc_linux_build() to choose a console/store page

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


diffstat output:
 tools/libxc/powerpc64/xc_linux_build.c |    8 ++---
 xen/arch/powerpc/domain_build.c        |   47 ++++++++++-----------------------
 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, 39 insertions(+), 63 deletions(-)

Signed-off-by: Ryan Harper <ryanh@xxxxxxxxxx>
---
diff -r 20e5f508accc tools/libxc/powerpc64/xc_linux_build.c
--- a/tools/libxc/powerpc64/xc_linux_build.c    Tue Feb 06 13:42:19 2007 -0600
+++ b/tools/libxc/powerpc64/xc_linux_build.c    Thu Feb 08 12:21:02 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 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   Thu Feb 08 12:21:02 2007 -0600
@@ -115,13 +115,15 @@ 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;
+    ulong shared_info_addr;
     int vcpu;
 
     /* Sanity! */
@@ -185,24 +187,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 +259,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 +293,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 +302,10 @@ 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);
+    /* 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 20e5f508accc xen/arch/powerpc/mm.c
--- a/xen/arch/powerpc/mm.c     Tue Feb 06 13:42:19 2007 -0600
+++ b/xen/arch/powerpc/mm.c     Thu Feb 08 12:21:02 2007 -0600
@@ -380,8 +380,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 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      Thu Feb 08 12:33: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, 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 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 Thu Feb 08 12:30:32 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 20e5f508accc xen/include/asm-powerpc/domain.h
--- a/xen/include/asm-powerpc/domain.h  Tue Feb 06 13:42:19 2007 -0600
+++ b/xen/include/asm-powerpc/domain.h  Thu Feb 08 12:21:02 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 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 Thu Feb 08 12:21:02 2007 -0600
@@ -117,14 +117,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-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel