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

[XenPPC] [xenppc-unstable] [POWERPC][XEN] Make sure we start Dom0 the CPU Xen was booted with



# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID 0ffa1bc4468d7755b2bb6e9cc5bae9e66a2572ab
# Parent  9394204977b66a7e522b39fcdcbfa64874a699a5
[POWERPC][XEN] Make sure we start Dom0 the CPU Xen was booted with

This will simplify MPIC assignements.

Signed-off-by: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
---
 xen/arch/powerpc/boot_of.c   |   46 +++++++++++++++++++++----------------------
 xen/arch/powerpc/ofd_fixup.c |   31 ++++++++++++++--------------
 xen/arch/powerpc/oftree.h    |    2 +
 xen/arch/powerpc/setup.c     |    2 -
 4 files changed, 41 insertions(+), 40 deletions(-)

diff -r 9394204977b6 -r 0ffa1bc4468d xen/arch/powerpc/boot_of.c
--- a/xen/arch/powerpc/boot_of.c        Wed Aug 30 08:51:36 2006 -0400
+++ b/xen/arch/powerpc/boot_of.c        Wed Aug 30 09:08:46 2006 -0400
@@ -31,6 +31,7 @@
 #include <asm/io.h>
 #include "exceptions.h"
 #include "of-devtree.h"
+#include "oftree.h"
 
 /* Secondary processors use this for handshaking with main processor.  */
 volatile unsigned int __spin_ack;
@@ -38,7 +39,6 @@ static ulong of_vec;
 static ulong of_vec;
 static ulong of_msr;
 static int of_out;
-static ofdn_t boot_cpu;
 static char bootargs[256];
 
 #define COMMAND_LINE_SIZE 512
@@ -669,7 +669,7 @@ static int boot_of_fixup_chosen(void *me
             dn = ofd_node_find(mem, ofpath);
             if (dn <= 0) of_panic("no node for: %s\n", ofpath);
 
-            boot_cpu = dn;
+            ofd_boot_cpu = dn;
             val = dn;
 
             dn = ofd_node_find(mem, "/chosen");
@@ -681,7 +681,7 @@ static int boot_of_fixup_chosen(void *me
         } else {
             of_printf("*** can't find path to booting cpu, "
                     "SMP is disabled\n");
-            boot_cpu = -1;
+            ofd_boot_cpu = -1;
         }
     }
     return rc;
@@ -773,7 +773,7 @@ static void __init boot_of_fix_maple(voi
     }
 }
     
-static int __init boot_of_serial(void *oftree)
+static int __init boot_of_serial(void *oft)
 {
     int n;
     int p;
@@ -805,7 +805,7 @@ static int __init boot_of_serial(void *o
             continue;
 
         of_printf("pruning `%s' from devtree\n", buf);
-        rc = ofd_prune_path(oftree, buf);
+        rc = ofd_prune_path(oft, buf);
         if (rc < 0)
             of_panic("prune of `%s' failed\n", buf);
     }
@@ -858,8 +858,8 @@ static void boot_of_module(ulong r3, ulo
 static void boot_of_module(ulong r3, ulong r4, multiboot_info_t *mbi)
 {
     static module_t mods[3];
-    void *oftree;
-    ulong oftree_sz = 48 * PAGE_SIZE;
+    void *oft;
+    ulong oft_sz = 48 * PAGE_SIZE;
     ulong mod0_start;
     ulong mod0_size;
     static const char sepr[] = " -- ";
@@ -922,28 +922,28 @@ static void boot_of_module(ulong r3, ulo
     }
 
     /* snapshot the tree */
-    oftree = (void*)find_space(oftree_sz, PAGE_SIZE, mbi);
-    if (oftree == 0)
+    oft = (void*)find_space(oft_sz, PAGE_SIZE, mbi);
+    if (oft == 0)
         of_panic("Could not allocate OFD tree\n");
 
-    of_printf("creating oftree\n");
+    of_printf("creating oft\n");
     of_test("package-to-path");
-    oftree = ofd_create(oftree, oftree_sz);
-    pkg_save(oftree);
-
-    if (ofd_size(oftree) > oftree_sz)
+    oft = ofd_create(oft, oft_sz);
+    pkg_save(oft);
+
+    if (ofd_size(oft) > oft_sz)
          of_panic("Could not fit all of native devtree\n");
 
-    boot_of_fixup_refs(oftree);
-    boot_of_fixup_chosen(oftree);
-
-    if (ofd_size(oftree) > oftree_sz)
+    boot_of_fixup_refs(oft);
+    boot_of_fixup_chosen(oft);
+
+    if (ofd_size(oft) > oft_sz)
          of_panic("Could not fit all devtree fixups\n");
 
-    ofd_walk(oftree, OFD_ROOT, /* add_hype_props */ NULL, 2);
-
-    mods[1].mod_start = (ulong)oftree;
-    mods[1].mod_end = mods[1].mod_start + oftree_sz;
+    ofd_walk(oft, OFD_ROOT, /* add_hype_props */ NULL, 2);
+
+    mods[1].mod_start = (ulong)oft;
+    mods[1].mod_end = mods[1].mod_start + oft_sz;
     of_printf("%s: mod[1] @ 0x%016x[0x%x]\n", __func__,
               mods[1].mod_start, mods[1].mod_end);
 
@@ -952,7 +952,7 @@ static void boot_of_module(ulong r3, ulo
     mbi->mods_count = 2;
     mbi->mods_addr = (u32)mods;
 
-    boot_of_serial(oftree);
+    boot_of_serial(oft);
 }
 
 static int __init boot_of_cpus(void)
diff -r 9394204977b6 -r 0ffa1bc4468d xen/arch/powerpc/ofd_fixup.c
--- a/xen/arch/powerpc/ofd_fixup.c      Wed Aug 30 08:51:36 2006 -0400
+++ b/xen/arch/powerpc/ofd_fixup.c      Wed Aug 30 09:08:46 2006 -0400
@@ -28,6 +28,8 @@
 
 #undef RTAS
 
+ofdn_t ofd_boot_cpu;
+
 #ifdef PAPR_VTERM
 static ofdn_t ofd_vdevice_vty(void *m, ofdn_t p, struct domain *d)
 {
@@ -172,24 +174,21 @@ static ofdn_t ofd_cpus_props(void *m, st
 #endif
 
     c = ofd_node_find_by_prop(m, n, "device_type", cpu, sizeof (cpu));
+    if (ofd_boot_cpu == -1)
+        ofd_boot_cpu = c;
     while (c > 0) {
-        ibm_pft_size[1] = d->arch.htab.log_num_ptes + LOG_PTE_SIZE;
-        ofd_prop_add(m, c, "ibm,pft-size",
-                     ibm_pft_size, sizeof (ibm_pft_size));
-
-        /* FIXME: Check the the "l2-cache" property who's
-         * contents is an orphaned phandle? */
+        /* Since we are not MP yet we prune all but the booting cpu */
+        if (c == ofd_boot_cpu) {
+            ibm_pft_size[1] = d->arch.htab.log_num_ptes + LOG_PTE_SIZE;
+            ofd_prop_add(m, c, "ibm,pft-size",
+                         ibm_pft_size, sizeof (ibm_pft_size));
+
+            /* FIXME: Check the the "l2-cache" property who's
+             * contents is an orphaned phandle? */
+        } else
+            ofd_node_prune(m, c);
+
         c = ofd_node_find_next(m, c);
-
-        /* Since we are not MP yet we can prune the rest of the CPUs */
-        while (c > 0) {
-            ofdn_t nc;
-
-            nc = ofd_node_find_next(m, c);
-            ofd_node_prune(m, c);
-
-            c = nc;
-        }
     }
 
     return n;
diff -r 9394204977b6 -r 0ffa1bc4468d xen/arch/powerpc/oftree.h
--- a/xen/arch/powerpc/oftree.h Wed Aug 30 08:51:36 2006 -0400
+++ b/xen/arch/powerpc/oftree.h Wed Aug 30 09:08:46 2006 -0400
@@ -21,10 +21,12 @@
 #ifndef _OFTREE_H
 #define _OFTREE_H
 #include <xen/multiboot.h>
+#include "of-devtree.h"
 
 extern ulong oftree;
 extern ulong oftree_len;
 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 void ofd_memory_props(void *m, struct domain *d);
diff -r 9394204977b6 -r 0ffa1bc4468d xen/arch/powerpc/setup.c
--- a/xen/arch/powerpc/setup.c  Wed Aug 30 08:51:36 2006 -0400
+++ b/xen/arch/powerpc/setup.c  Wed Aug 30 09:08:46 2006 -0400
@@ -338,7 +338,7 @@ static void __init __start_xen(multiboot
 #endif
 
     /* Deal with secondary processors.  */
-    if (opt_nosmp) {
+    if (opt_nosmp || ofd_boot_cpu == -1) {
         printk("nosmp: leaving secondary processors spinning forever\n");
     } else {
         printk("spinning up at most %d total processors ...\n", max_cpus);

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


 


Rackspace

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