aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2005-10-27 08:42:04 -0400
committerPaul Mackerras <paulus@samba.org>2005-10-27 08:42:04 -0400
commit80579e1f4a6b5f5dec92faa6c3e0645961c99091 (patch)
treed8fd5e184b54145811a92914c806544ad745087a
parenteef69e3cfb38d83166dbd8bcb12ededa1b6e78b6 (diff)
powerpc: 32-bit CHRP SMP fixes
Untested, but "should" work... at least this way it compiles. Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r--arch/powerpc/kernel/prom.c12
-rw-r--r--arch/powerpc/kernel/setup_32.c4
-rw-r--r--arch/powerpc/platforms/chrp/smp.c40
-rw-r--r--include/asm-ppc/smp.h10
4 files changed, 53 insertions, 13 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index ab9b291dda54..6309a1a17c4a 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -1110,22 +1110,22 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
1110 } 1110 }
1111#endif 1111#endif
1112 1112
1113#ifdef CONFIG_PPC64 1113 boot_cpuid = 0;
1114 boot_cpuid_phys = 0;
1114 if (initial_boot_params && initial_boot_params->version >= 2) { 1115 if (initial_boot_params && initial_boot_params->version >= 2) {
1115 /* version 2 of the kexec param format adds the phys cpuid 1116 /* version 2 of the kexec param format adds the phys cpuid
1116 * of booted proc. 1117 * of booted proc.
1117 */ 1118 */
1118 boot_cpuid_phys = initial_boot_params->boot_cpuid_phys; 1119 boot_cpuid_phys = initial_boot_params->boot_cpuid_phys;
1119 boot_cpuid = 0;
1120 } else { 1120 } else {
1121 /* Check if it's the boot-cpu, set it's hw index in paca now */ 1121 /* Check if it's the boot-cpu, set it's hw index now */
1122 if (get_flat_dt_prop(node, "linux,boot-cpu", NULL) != NULL) { 1122 if (get_flat_dt_prop(node, "linux,boot-cpu", NULL) != NULL) {
1123 prop = get_flat_dt_prop(node, "reg", NULL); 1123 prop = get_flat_dt_prop(node, "reg", NULL);
1124 set_hard_smp_processor_id(0, prop == NULL ? 0 : *prop); 1124 if (prop != NULL)
1125 boot_cpuid_phys = get_hard_smp_processor_id(0); 1125 boot_cpuid_phys = *prop;
1126 } 1126 }
1127 } 1127 }
1128#endif 1128 set_hard_smp_processor_id(0, boot_cpuid_phys);
1129 1129
1130#ifdef CONFIG_ALTIVEC 1130#ifdef CONFIG_ALTIVEC
1131 /* Check if we have a VMX and eventually update CPU features */ 1131 /* Check if we have a VMX and eventually update CPU features */
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 150a919269ae..7c99e6b8c76c 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -59,6 +59,10 @@ struct ide_machdep_calls ppc_ide_md;
59int __irq_offset_value; 59int __irq_offset_value;
60EXPORT_SYMBOL(__irq_offset_value); 60EXPORT_SYMBOL(__irq_offset_value);
61 61
62int boot_cpuid;
63EXPORT_SYMBOL_GPL(boot_cpuid);
64int boot_cpuid_phys;
65
62unsigned long ISA_DMA_THRESHOLD; 66unsigned long ISA_DMA_THRESHOLD;
63unsigned int DMA_MODE_READ; 67unsigned int DMA_MODE_READ;
64unsigned int DMA_MODE_WRITE; 68unsigned int DMA_MODE_WRITE;
diff --git a/arch/powerpc/platforms/chrp/smp.c b/arch/powerpc/platforms/chrp/smp.c
index bf68282670dd..31ee49c25014 100644
--- a/arch/powerpc/platforms/chrp/smp.c
+++ b/arch/powerpc/platforms/chrp/smp.c
@@ -32,15 +32,44 @@
32#include <asm/time.h> 32#include <asm/time.h>
33#include <asm/open_pic.h> 33#include <asm/open_pic.h>
34#include <asm/machdep.h> 34#include <asm/machdep.h>
35#include <asm/smp.h>
36#include <asm/mpic.h>
35 37
36extern unsigned long smp_chrp_cpu_nr; 38extern unsigned long smp_chrp_cpu_nr;
37 39
38static int __init smp_chrp_probe(void) 40static int __init smp_chrp_probe(void)
39{ 41{
40 if (smp_chrp_cpu_nr > 1) 42 struct device_node *cpus = NULL;
41 openpic_request_IPIs(); 43 unsigned int *reg;
44 int reglen;
45 int ncpus = 0;
46 int cpuid;
47 unsigned int phys;
48
49 /* Count CPUs in the device-tree */
50 cpuid = 1; /* the boot cpu is logical cpu 0 */
51 while ((cpus = of_find_node_by_type(cpus, "cpu")) != NULL) {
52 phys = ncpus;
53 reg = (unsigned int *) get_property(cpus, "reg", &reglen);
54 if (reg && reglen >= sizeof(unsigned int))
55 /* hmmm, not having a reg property would be bad */
56 phys = *reg;
57 if (phys != boot_cpuid_phys) {
58 set_hard_smp_processor_id(cpuid, phys);
59 ++cpuid;
60 }
61 ++ncpus;
62 }
63
64 printk(KERN_INFO "CHRP SMP probe found %d cpus\n", ncpus);
65
66 /* Nothing more to do if less than 2 of them */
67 if (ncpus <= 1)
68 return 1;
69
70 mpic_request_ipis();
42 71
43 return smp_chrp_cpu_nr; 72 return ncpus;
44} 73}
45 74
46static void __devinit smp_chrp_kick_cpu(int nr) 75static void __devinit smp_chrp_kick_cpu(int nr)
@@ -51,8 +80,7 @@ static void __devinit smp_chrp_kick_cpu(int nr)
51 80
52static void __devinit smp_chrp_setup_cpu(int cpu_nr) 81static void __devinit smp_chrp_setup_cpu(int cpu_nr)
53{ 82{
54 if (OpenPIC_Addr) 83 mpic_setup_this_cpu();
55 do_openpic_setup_cpu();
56} 84}
57 85
58static DEFINE_SPINLOCK(timebase_lock); 86static DEFINE_SPINLOCK(timebase_lock);
@@ -85,7 +113,7 @@ void __devinit smp_chrp_take_timebase(void)
85 113
86/* CHRP with openpic */ 114/* CHRP with openpic */
87struct smp_ops_t chrp_smp_ops = { 115struct smp_ops_t chrp_smp_ops = {
88 .message_pass = smp_openpic_message_pass, 116 .message_pass = smp_mpic_message_pass,
89 .probe = smp_chrp_probe, 117 .probe = smp_chrp_probe,
90 .kick_cpu = smp_chrp_kick_cpu, 118 .kick_cpu = smp_chrp_kick_cpu,
91 .setup_cpu = smp_chrp_setup_cpu, 119 .setup_cpu = smp_chrp_setup_cpu,
diff --git a/include/asm-ppc/smp.h b/include/asm-ppc/smp.h
index 063d7dedc691..30e9268a888c 100644
--- a/include/asm-ppc/smp.h
+++ b/include/asm-ppc/smp.h
@@ -53,16 +53,24 @@ extern int __cpu_up(unsigned int cpu);
53extern int smp_hw_index[]; 53extern int smp_hw_index[];
54#define hard_smp_processor_id() (smp_hw_index[smp_processor_id()]) 54#define hard_smp_processor_id() (smp_hw_index[smp_processor_id()])
55#define get_hard_smp_processor_id(cpu) (smp_hw_index[(cpu)]) 55#define get_hard_smp_processor_id(cpu) (smp_hw_index[(cpu)])
56 56#define set_hard_smp_processor_id(cpu, phys)\
57 (smp_hw_index[(cpu)] = (phys))
58
57#endif /* __ASSEMBLY__ */ 59#endif /* __ASSEMBLY__ */
58 60
59#else /* !(CONFIG_SMP) */ 61#else /* !(CONFIG_SMP) */
60 62
61static inline void cpu_die(void) { } 63static inline void cpu_die(void) { }
62#define get_hard_smp_processor_id(cpu) 0 64#define get_hard_smp_processor_id(cpu) 0
65#define set_hard_smp_processor_id(cpu, phys)
63#define hard_smp_processor_id() 0 66#define hard_smp_processor_id() 0
64 67
65#endif /* !(CONFIG_SMP) */ 68#endif /* !(CONFIG_SMP) */
66 69
70#ifndef __ASSEMBLY__
71extern int boot_cpuid;
72extern int boot_cpuid_phys;
73#endif
74
67#endif /* !(_PPC_SMP_H) */ 75#endif /* !(_PPC_SMP_H) */
68#endif /* __KERNEL__ */ 76#endif /* __KERNEL__ */