]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
powerpc: 32-bit CHRP SMP fixes
authorPaul Mackerras <paulus@samba.org>
Thu, 27 Oct 2005 12:42:04 +0000 (22:42 +1000)
committerPaul Mackerras <paulus@samba.org>
Thu, 27 Oct 2005 12:42:04 +0000 (22:42 +1000)
Untested, but "should" work...  at least this way it compiles.

Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/kernel/prom.c
arch/powerpc/kernel/setup_32.c
arch/powerpc/platforms/chrp/smp.c
include/asm-ppc/smp.h

index ab9b291dda54ea75e33a3742560db6d2e6dbabee..6309a1a17c4a5a9027ead4286481f524ccef007c 100644 (file)
@@ -1110,22 +1110,22 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
        }
 #endif
 
-#ifdef CONFIG_PPC64
+       boot_cpuid = 0;
+       boot_cpuid_phys = 0;
        if (initial_boot_params && initial_boot_params->version >= 2) {
                /* version 2 of the kexec param format adds the phys cpuid
                 * of booted proc.
                 */
                boot_cpuid_phys = initial_boot_params->boot_cpuid_phys;
-               boot_cpuid = 0;
        } else {
-               /* Check if it's the boot-cpu, set it's hw index in paca now */
+               /* Check if it's the boot-cpu, set it's hw index now */
                if (get_flat_dt_prop(node, "linux,boot-cpu", NULL) != NULL) {
                        prop = get_flat_dt_prop(node, "reg", NULL);
-                       set_hard_smp_processor_id(0, prop == NULL ? 0 : *prop);
-                       boot_cpuid_phys = get_hard_smp_processor_id(0);
+                       if (prop != NULL)
+                               boot_cpuid_phys = *prop;
                }
        }
-#endif
+       set_hard_smp_processor_id(0, boot_cpuid_phys);
 
 #ifdef CONFIG_ALTIVEC
        /* Check if we have a VMX and eventually update CPU features */
index 150a919269ae64a533c3b409b35220422f8072c4..7c99e6b8c76cd018b6cf4582ac212d045a992f2c 100644 (file)
@@ -59,6 +59,10 @@ struct ide_machdep_calls ppc_ide_md;
 int __irq_offset_value;
 EXPORT_SYMBOL(__irq_offset_value);
 
+int boot_cpuid;
+EXPORT_SYMBOL_GPL(boot_cpuid);
+int boot_cpuid_phys;
+
 unsigned long ISA_DMA_THRESHOLD;
 unsigned int DMA_MODE_READ;
 unsigned int DMA_MODE_WRITE;
index bf68282670dd7f019e8bcd716cd43e0aa7f4ee29..31ee49c250148bc89344c3d76b83641eb7c5f936 100644 (file)
 #include <asm/time.h>
 #include <asm/open_pic.h>
 #include <asm/machdep.h>
+#include <asm/smp.h>
+#include <asm/mpic.h>
 
 extern unsigned long smp_chrp_cpu_nr;
 
 static int __init smp_chrp_probe(void)
 {
-       if (smp_chrp_cpu_nr > 1)
-               openpic_request_IPIs();
+       struct device_node *cpus = NULL;
+       unsigned int *reg;
+       int reglen;
+       int ncpus = 0;
+       int cpuid;
+       unsigned int phys;
+
+       /* Count CPUs in the device-tree */
+       cpuid = 1;      /* the boot cpu is logical cpu 0 */
+       while ((cpus = of_find_node_by_type(cpus, "cpu")) != NULL) {
+               phys = ncpus;
+               reg = (unsigned int *) get_property(cpus, "reg", &reglen);
+               if (reg && reglen >= sizeof(unsigned int))
+                       /* hmmm, not having a reg property would be bad */
+                       phys = *reg;
+               if (phys != boot_cpuid_phys) {
+                       set_hard_smp_processor_id(cpuid, phys);
+                       ++cpuid;
+               }
+               ++ncpus;
+       }
+
+       printk(KERN_INFO "CHRP SMP probe found %d cpus\n", ncpus);
+
+       /* Nothing more to do if less than 2 of them */
+       if (ncpus <= 1)
+               return 1;
+
+       mpic_request_ipis();
 
-       return smp_chrp_cpu_nr;
+       return ncpus;
 }
 
 static void __devinit smp_chrp_kick_cpu(int nr)
@@ -51,8 +80,7 @@ static void __devinit smp_chrp_kick_cpu(int nr)
 
 static void __devinit smp_chrp_setup_cpu(int cpu_nr)
 {
-       if (OpenPIC_Addr)
-               do_openpic_setup_cpu();
+       mpic_setup_this_cpu();
 }
 
 static DEFINE_SPINLOCK(timebase_lock);
@@ -85,7 +113,7 @@ void __devinit smp_chrp_take_timebase(void)
 
 /* CHRP with openpic */
 struct smp_ops_t chrp_smp_ops = {
-       .message_pass = smp_openpic_message_pass,
+       .message_pass = smp_mpic_message_pass,
        .probe = smp_chrp_probe,
        .kick_cpu = smp_chrp_kick_cpu,
        .setup_cpu = smp_chrp_setup_cpu,
index 063d7dedc6918dfe41d7a6c8473262d04c64bd51..30e9268a888c4664f441586630dc1ecf682102cd 100644 (file)
@@ -53,16 +53,24 @@ extern int __cpu_up(unsigned int cpu);
 extern int smp_hw_index[];
 #define hard_smp_processor_id()        (smp_hw_index[smp_processor_id()])
 #define get_hard_smp_processor_id(cpu) (smp_hw_index[(cpu)])
-
+#define set_hard_smp_processor_id(cpu, phys)\
+                                       (smp_hw_index[(cpu)] = (phys))
 #endif /* __ASSEMBLY__ */
 
 #else /* !(CONFIG_SMP) */
 
 static inline void cpu_die(void) { }
 #define get_hard_smp_processor_id(cpu) 0
+#define set_hard_smp_processor_id(cpu, phys)
 #define hard_smp_processor_id() 0
 
 #endif /* !(CONFIG_SMP) */
 
+#ifndef __ASSEMBLY__
+extern int boot_cpuid;
+extern int boot_cpuid_phys;
+#endif
+
 #endif /* !(_PPC_SMP_H) */
 #endif /* __KERNEL__ */