# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID b04e24db308f2215c6bafaf358d1c10da79f244f
# Parent  965d3e42dddaf5971001f7d172d192f925537644
[XEN][POWERPC] get cpu_*_maps correct so physinfo and affinity is accurate

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/powerpc64/ppc970.c |    7 ++++++-
 xen/arch/powerpc/setup.c            |   19 +++++++++++++------
 xen/arch/powerpc/sysctl.c           |   10 +++++++---
 xen/include/asm-powerpc/processor.h |    1 +
 4 files changed, 27 insertions(+), 10 deletions(-)

diff -r 965d3e42ddda -r b04e24db308f xen/arch/powerpc/powerpc64/ppc970.c
--- a/xen/arch/powerpc/powerpc64/ppc970.c       Sun Dec 17 12:36:31 2006 -0500
+++ b/xen/arch/powerpc/powerpc64/ppc970.c       Sun Dec 17 12:40:10 2006 -0500
@@ -129,7 +129,6 @@ unsigned int cpu_extent_order(void)
     return log_large_page_sizes[0] - PAGE_SHIFT;
 }
 
-
 /* This is more a platform thing than a CPU thing, but we only have
  * one platform now */
 int cpu_io_mfn(ulong mfn)
@@ -141,6 +140,12 @@ int cpu_io_mfn(ulong mfn)
 
     return 0;
 }
+
+int cpu_threads(int cpuid)
+{
+    return 1;
+}
+
 
 static u64 cpu0_hids[6];
 static u64 cpu0_hior;
diff -r 965d3e42ddda -r b04e24db308f xen/arch/powerpc/setup.c
--- a/xen/arch/powerpc/setup.c  Sun Dec 17 12:36:31 2006 -0500
+++ b/xen/arch/powerpc/setup.c  Sun Dec 17 12:40:10 2006 -0500
@@ -179,9 +179,6 @@ static void __init start_of_day(void)
     set_current(idle_domain->vcpu[0]);
     idle_vcpu[0] = current;
 
-    /* for some reason we need to set our own bit in the thread map */
-    cpu_set(0, cpu_sibling_map[0]);
-
     initialize_keytable();
     /* Register another key that will allow for the the Harware Probe
      * to be contacted, this works with RiscWatch probes and should
@@ -247,6 +244,19 @@ static int kick_secondary_cpus(int maxcp
     int cpuid;
 
     for_each_present_cpu(cpuid) {
+        int threads;
+        int i;
+        
+        threads = cpu_threads(cpuid);
+        for (i = 0; i < threads; i++)
+            cpu_set(i, cpu_sibling_map[cpuid]);
+
+        /* For now everything is single core */
+        cpu_set(0, cpu_core_map[cpuid]);
+
+        numa_set_node(cpuid, 0);
+        numa_add_cpu(cpuid);
+
         if (cpuid == 0)
             continue;
         if (cpuid >= maxcpus)
@@ -257,9 +267,6 @@ static int kick_secondary_cpus(int maxcp
         /* wait for it */
         while (!cpu_online(cpuid))
             cpu_relax();
-
-        numa_set_node(cpuid, 0);
-        numa_add_cpu(cpuid);
     }
 
     return 0;
diff -r 965d3e42ddda -r b04e24db308f xen/arch/powerpc/sysctl.c
--- a/xen/arch/powerpc/sysctl.c Sun Dec 17 12:36:31 2006 -0500
+++ b/xen/arch/powerpc/sysctl.c Sun Dec 17 12:40:10 2006 -0500
@@ -41,9 +41,13 @@ long arch_do_sysctl(struct xen_sysctl *s
     {
         xen_sysctl_physinfo_t *pi = &sysctl->u.physinfo;
 
-        pi->threads_per_core = 1;
-        pi->cores_per_socket = 1;
-        pi->sockets_per_node = 1;
+        pi->threads_per_core =
+            cpus_weight(cpu_sibling_map[0]);
+        pi->cores_per_socket =
+            cpus_weight(cpu_core_map[0]) / pi->threads_per_core;
+        pi->sockets_per_node = 
+            num_online_cpus() / cpus_weight(cpu_core_map[0]);
+
         pi->nr_nodes         = 1;
         pi->total_pages      = total_pages;
         pi->free_pages       = avail_domheap_pages();
diff -r 965d3e42ddda -r b04e24db308f xen/include/asm-powerpc/processor.h
--- a/xen/include/asm-powerpc/processor.h       Sun Dec 17 12:36:31 2006 -0500
+++ b/xen/include/asm-powerpc/processor.h       Sun Dec 17 12:40:10 2006 -0500
@@ -125,6 +125,7 @@ extern void cpu_initialize(int cpuid);
 extern void cpu_initialize(int cpuid);
 extern void cpu_init_vcpu(struct vcpu *);
 extern int cpu_io_mfn(ulong mfn);
+extern int cpu_threads(int cpuid);
 extern void save_cpu_sprs(struct vcpu *);
 extern void load_cpu_sprs(struct vcpu *);
 extern void flush_segments(void);

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

Reply via email to