ia64/xen-unstable

changeset 13921:d1f053ff43d2

[XEN][POWERPC] get cpu_*_maps correct so physinfo and affinity is accurate
Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author Jimi Xenidis <jimix@watson.ibm.com>
date Sun Dec 17 12:40:10 2006 -0500 (2006-12-17)
parents 60515808f591
children 8101efde7493
files xen/arch/powerpc/powerpc64/ppc970.c xen/arch/powerpc/setup.c xen/arch/powerpc/sysctl.c xen/include/asm-powerpc/processor.h
line diff
     1.1 --- a/xen/arch/powerpc/powerpc64/ppc970.c	Sun Dec 17 12:36:31 2006 -0500
     1.2 +++ b/xen/arch/powerpc/powerpc64/ppc970.c	Sun Dec 17 12:40:10 2006 -0500
     1.3 @@ -129,7 +129,6 @@ unsigned int cpu_extent_order(void)
     1.4      return log_large_page_sizes[0] - PAGE_SHIFT;
     1.5  }
     1.6  
     1.7 -
     1.8  /* This is more a platform thing than a CPU thing, but we only have
     1.9   * one platform now */
    1.10  int cpu_io_mfn(ulong mfn)
    1.11 @@ -142,6 +141,12 @@ int cpu_io_mfn(ulong mfn)
    1.12      return 0;
    1.13  }
    1.14  
    1.15 +int cpu_threads(int cpuid)
    1.16 +{
    1.17 +    return 1;
    1.18 +}
    1.19 +
    1.20 +
    1.21  static u64 cpu0_hids[6];
    1.22  static u64 cpu0_hior;
    1.23  
     2.1 --- a/xen/arch/powerpc/setup.c	Sun Dec 17 12:36:31 2006 -0500
     2.2 +++ b/xen/arch/powerpc/setup.c	Sun Dec 17 12:40:10 2006 -0500
     2.3 @@ -179,9 +179,6 @@ static void __init start_of_day(void)
     2.4      set_current(idle_domain->vcpu[0]);
     2.5      idle_vcpu[0] = current;
     2.6  
     2.7 -    /* for some reason we need to set our own bit in the thread map */
     2.8 -    cpu_set(0, cpu_sibling_map[0]);
     2.9 -
    2.10      initialize_keytable();
    2.11      /* Register another key that will allow for the the Harware Probe
    2.12       * to be contacted, this works with RiscWatch probes and should
    2.13 @@ -247,6 +244,19 @@ static int kick_secondary_cpus(int maxcp
    2.14      int cpuid;
    2.15  
    2.16      for_each_present_cpu(cpuid) {
    2.17 +        int threads;
    2.18 +        int i;
    2.19 +        
    2.20 +        threads = cpu_threads(cpuid);
    2.21 +        for (i = 0; i < threads; i++)
    2.22 +            cpu_set(i, cpu_sibling_map[cpuid]);
    2.23 +
    2.24 +        /* For now everything is single core */
    2.25 +        cpu_set(0, cpu_core_map[cpuid]);
    2.26 +
    2.27 +        numa_set_node(cpuid, 0);
    2.28 +        numa_add_cpu(cpuid);
    2.29 +
    2.30          if (cpuid == 0)
    2.31              continue;
    2.32          if (cpuid >= maxcpus)
    2.33 @@ -257,9 +267,6 @@ static int kick_secondary_cpus(int maxcp
    2.34          /* wait for it */
    2.35          while (!cpu_online(cpuid))
    2.36              cpu_relax();
    2.37 -
    2.38 -        numa_set_node(cpuid, 0);
    2.39 -        numa_add_cpu(cpuid);
    2.40      }
    2.41  
    2.42      return 0;
     3.1 --- a/xen/arch/powerpc/sysctl.c	Sun Dec 17 12:36:31 2006 -0500
     3.2 +++ b/xen/arch/powerpc/sysctl.c	Sun Dec 17 12:40:10 2006 -0500
     3.3 @@ -41,9 +41,13 @@ long arch_do_sysctl(struct xen_sysctl *s
     3.4      {
     3.5          xen_sysctl_physinfo_t *pi = &sysctl->u.physinfo;
     3.6  
     3.7 -        pi->threads_per_core = 1;
     3.8 -        pi->cores_per_socket = 1;
     3.9 -        pi->sockets_per_node = 1;
    3.10 +        pi->threads_per_core =
    3.11 +            cpus_weight(cpu_sibling_map[0]);
    3.12 +        pi->cores_per_socket =
    3.13 +            cpus_weight(cpu_core_map[0]) / pi->threads_per_core;
    3.14 +        pi->sockets_per_node = 
    3.15 +            num_online_cpus() / cpus_weight(cpu_core_map[0]);
    3.16 +
    3.17          pi->nr_nodes         = 1;
    3.18          pi->total_pages      = total_pages;
    3.19          pi->free_pages       = avail_domheap_pages();
     4.1 --- a/xen/include/asm-powerpc/processor.h	Sun Dec 17 12:36:31 2006 -0500
     4.2 +++ b/xen/include/asm-powerpc/processor.h	Sun Dec 17 12:40:10 2006 -0500
     4.3 @@ -125,6 +125,7 @@ extern uint cpu_large_page_orders(uint *
     4.4  extern void cpu_initialize(int cpuid);
     4.5  extern void cpu_init_vcpu(struct vcpu *);
     4.6  extern int cpu_io_mfn(ulong mfn);
     4.7 +extern int cpu_threads(int cpuid);
     4.8  extern void save_cpu_sprs(struct vcpu *);
     4.9  extern void load_cpu_sprs(struct vcpu *);
    4.10  extern void flush_segments(void);