diff options
author | Michael Ellerman <michael@ozlabs.org> | 2011-04-11 17:46:19 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2011-04-20 03:01:18 -0400 |
commit | de300974761d92f71cb583730ac9e1d4eb1b7156 (patch) | |
tree | bfce8daf1dec8dff5af215bcf7647f38632490d4 /arch | |
parent | 6c5b59b913874cae535a324a671b7ed4f17e6397 (diff) |
powerpc/smp: smp_ops->kick_cpu() should be able to fail
When we start a cpu we use smp_ops->kick_cpu(), which currently
returns void, it should be able to fail. Convert it to return
int, and update all uses.
Convert all the current error cases to return -ENOENT, which is
what would eventually be returned by __cpu_up() currently when
it doesn't detect the cpu as coming up in time.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/include/asm/machdep.h | 2 | ||||
-rw-r--r-- | arch/powerpc/include/asm/smp.h | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/smp.c | 10 | ||||
-rw-r--r-- | arch/powerpc/platforms/44x/iss4xx.c | 6 | ||||
-rw-r--r-- | arch/powerpc/platforms/85xx/smp.c | 6 | ||||
-rw-r--r-- | arch/powerpc/platforms/86xx/mpc86xx_smp.c | 6 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/beat_smp.c | 5 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/smp.c | 6 | ||||
-rw-r--r-- | arch/powerpc/platforms/chrp/smp.c | 4 | ||||
-rw-r--r-- | arch/powerpc/platforms/iseries/smp.c | 6 | ||||
-rw-r--r-- | arch/powerpc/platforms/powermac/smp.c | 10 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/smp.c | 6 |
12 files changed, 46 insertions, 23 deletions
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h index 493dbb38e1ba..c6345acf166f 100644 --- a/arch/powerpc/include/asm/machdep.h +++ b/arch/powerpc/include/asm/machdep.h | |||
@@ -33,7 +33,7 @@ struct kimage; | |||
33 | struct smp_ops_t { | 33 | struct smp_ops_t { |
34 | void (*message_pass)(int target, int msg); | 34 | void (*message_pass)(int target, int msg); |
35 | int (*probe)(void); | 35 | int (*probe)(void); |
36 | void (*kick_cpu)(int nr); | 36 | int (*kick_cpu)(int nr); |
37 | void (*setup_cpu)(int nr); | 37 | void (*setup_cpu)(int nr); |
38 | void (*bringup_done)(void); | 38 | void (*bringup_done)(void); |
39 | void (*take_timebase)(void); | 39 | void (*take_timebase)(void); |
diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h index bb4c033a8fb0..50873493a97c 100644 --- a/arch/powerpc/include/asm/smp.h +++ b/arch/powerpc/include/asm/smp.h | |||
@@ -150,7 +150,7 @@ extern int smt_enabled_at_boot; | |||
150 | 150 | ||
151 | extern int smp_mpic_probe(void); | 151 | extern int smp_mpic_probe(void); |
152 | extern void smp_mpic_setup_cpu(int cpu); | 152 | extern void smp_mpic_setup_cpu(int cpu); |
153 | extern void smp_generic_kick_cpu(int nr); | 153 | extern int smp_generic_kick_cpu(int nr); |
154 | 154 | ||
155 | extern void smp_generic_give_timebase(void); | 155 | extern void smp_generic_give_timebase(void); |
156 | extern void smp_generic_take_timebase(void); | 156 | extern void smp_generic_take_timebase(void); |
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index cbdbb14be4b0..b6083f4f39b1 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c | |||
@@ -95,7 +95,7 @@ int smt_enabled_at_boot = 1; | |||
95 | static void (*crash_ipi_function_ptr)(struct pt_regs *) = NULL; | 95 | static void (*crash_ipi_function_ptr)(struct pt_regs *) = NULL; |
96 | 96 | ||
97 | #ifdef CONFIG_PPC64 | 97 | #ifdef CONFIG_PPC64 |
98 | void __devinit smp_generic_kick_cpu(int nr) | 98 | int __devinit smp_generic_kick_cpu(int nr) |
99 | { | 99 | { |
100 | BUG_ON(nr < 0 || nr >= NR_CPUS); | 100 | BUG_ON(nr < 0 || nr >= NR_CPUS); |
101 | 101 | ||
@@ -106,6 +106,8 @@ void __devinit smp_generic_kick_cpu(int nr) | |||
106 | */ | 106 | */ |
107 | paca[nr].cpu_start = 1; | 107 | paca[nr].cpu_start = 1; |
108 | smp_mb(); | 108 | smp_mb(); |
109 | |||
110 | return 0; | ||
109 | } | 111 | } |
110 | #endif | 112 | #endif |
111 | 113 | ||
@@ -434,7 +436,11 @@ int __cpuinit __cpu_up(unsigned int cpu) | |||
434 | 436 | ||
435 | /* wake up cpus */ | 437 | /* wake up cpus */ |
436 | DBG("smp: kicking cpu %d\n", cpu); | 438 | DBG("smp: kicking cpu %d\n", cpu); |
437 | smp_ops->kick_cpu(cpu); | 439 | rc = smp_ops->kick_cpu(cpu); |
440 | if (rc) { | ||
441 | pr_err("smp: failed starting cpu %d (rc %d)\n", cpu, rc); | ||
442 | return rc; | ||
443 | } | ||
438 | 444 | ||
439 | /* | 445 | /* |
440 | * wait to see if the cpu made a callin (is actually up). | 446 | * wait to see if the cpu made a callin (is actually up). |
diff --git a/arch/powerpc/platforms/44x/iss4xx.c b/arch/powerpc/platforms/44x/iss4xx.c index aa46e9d1e771..19395f18b1db 100644 --- a/arch/powerpc/platforms/44x/iss4xx.c +++ b/arch/powerpc/platforms/44x/iss4xx.c | |||
@@ -87,7 +87,7 @@ static void __cpuinit smp_iss4xx_setup_cpu(int cpu) | |||
87 | mpic_setup_this_cpu(); | 87 | mpic_setup_this_cpu(); |
88 | } | 88 | } |
89 | 89 | ||
90 | static void __cpuinit smp_iss4xx_kick_cpu(int cpu) | 90 | static int __cpuinit smp_iss4xx_kick_cpu(int cpu) |
91 | { | 91 | { |
92 | struct device_node *cpunode = of_get_cpu_node(cpu, NULL); | 92 | struct device_node *cpunode = of_get_cpu_node(cpu, NULL); |
93 | const u64 *spin_table_addr_prop; | 93 | const u64 *spin_table_addr_prop; |
@@ -104,7 +104,7 @@ static void __cpuinit smp_iss4xx_kick_cpu(int cpu) | |||
104 | NULL); | 104 | NULL); |
105 | if (spin_table_addr_prop == NULL) { | 105 | if (spin_table_addr_prop == NULL) { |
106 | pr_err("CPU%d: Can't start, missing cpu-release-addr !\n", cpu); | 106 | pr_err("CPU%d: Can't start, missing cpu-release-addr !\n", cpu); |
107 | return; | 107 | return -ENOENT; |
108 | } | 108 | } |
109 | 109 | ||
110 | /* Assume it's mapped as part of the linear mapping. This is a bit | 110 | /* Assume it's mapped as part of the linear mapping. This is a bit |
@@ -117,6 +117,8 @@ static void __cpuinit smp_iss4xx_kick_cpu(int cpu) | |||
117 | smp_wmb(); | 117 | smp_wmb(); |
118 | spin_table[1] = __pa(start_secondary_47x); | 118 | spin_table[1] = __pa(start_secondary_47x); |
119 | mb(); | 119 | mb(); |
120 | |||
121 | return 0; | ||
120 | } | 122 | } |
121 | 123 | ||
122 | static struct smp_ops_t iss_smp_ops = { | 124 | static struct smp_ops_t iss_smp_ops = { |
diff --git a/arch/powerpc/platforms/85xx/smp.c b/arch/powerpc/platforms/85xx/smp.c index 0d00ff9d05a0..fe3f6a3a5307 100644 --- a/arch/powerpc/platforms/85xx/smp.c +++ b/arch/powerpc/platforms/85xx/smp.c | |||
@@ -41,7 +41,7 @@ extern void __early_start(void); | |||
41 | #define NUM_BOOT_ENTRY 8 | 41 | #define NUM_BOOT_ENTRY 8 |
42 | #define SIZE_BOOT_ENTRY (NUM_BOOT_ENTRY * sizeof(u32)) | 42 | #define SIZE_BOOT_ENTRY (NUM_BOOT_ENTRY * sizeof(u32)) |
43 | 43 | ||
44 | static void __init | 44 | static int __init |
45 | smp_85xx_kick_cpu(int nr) | 45 | smp_85xx_kick_cpu(int nr) |
46 | { | 46 | { |
47 | unsigned long flags; | 47 | unsigned long flags; |
@@ -60,7 +60,7 @@ smp_85xx_kick_cpu(int nr) | |||
60 | 60 | ||
61 | if (cpu_rel_addr == NULL) { | 61 | if (cpu_rel_addr == NULL) { |
62 | printk(KERN_ERR "No cpu-release-addr for cpu %d\n", nr); | 62 | printk(KERN_ERR "No cpu-release-addr for cpu %d\n", nr); |
63 | return; | 63 | return -ENOENT; |
64 | } | 64 | } |
65 | 65 | ||
66 | /* | 66 | /* |
@@ -107,6 +107,8 @@ smp_85xx_kick_cpu(int nr) | |||
107 | iounmap(bptr_vaddr); | 107 | iounmap(bptr_vaddr); |
108 | 108 | ||
109 | pr_debug("waited %d msecs for CPU #%d.\n", n, nr); | 109 | pr_debug("waited %d msecs for CPU #%d.\n", n, nr); |
110 | |||
111 | return 0; | ||
110 | } | 112 | } |
111 | 113 | ||
112 | static void __init | 114 | static void __init |
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_smp.c b/arch/powerpc/platforms/86xx/mpc86xx_smp.c index eacea0e3fcc8..af09baee22cb 100644 --- a/arch/powerpc/platforms/86xx/mpc86xx_smp.c +++ b/arch/powerpc/platforms/86xx/mpc86xx_smp.c | |||
@@ -56,7 +56,7 @@ smp_86xx_release_core(int nr) | |||
56 | } | 56 | } |
57 | 57 | ||
58 | 58 | ||
59 | static void __init | 59 | static int __init |
60 | smp_86xx_kick_cpu(int nr) | 60 | smp_86xx_kick_cpu(int nr) |
61 | { | 61 | { |
62 | unsigned int save_vector; | 62 | unsigned int save_vector; |
@@ -65,7 +65,7 @@ smp_86xx_kick_cpu(int nr) | |||
65 | unsigned int *vector = (unsigned int *)(KERNELBASE + 0x100); | 65 | unsigned int *vector = (unsigned int *)(KERNELBASE + 0x100); |
66 | 66 | ||
67 | if (nr < 0 || nr >= NR_CPUS) | 67 | if (nr < 0 || nr >= NR_CPUS) |
68 | return; | 68 | return -ENOENT; |
69 | 69 | ||
70 | pr_debug("smp_86xx_kick_cpu: kick CPU #%d\n", nr); | 70 | pr_debug("smp_86xx_kick_cpu: kick CPU #%d\n", nr); |
71 | 71 | ||
@@ -92,6 +92,8 @@ smp_86xx_kick_cpu(int nr) | |||
92 | local_irq_restore(flags); | 92 | local_irq_restore(flags); |
93 | 93 | ||
94 | pr_debug("wait CPU #%d for %d msecs.\n", nr, n); | 94 | pr_debug("wait CPU #%d for %d msecs.\n", nr, n); |
95 | |||
96 | return 0; | ||
95 | } | 97 | } |
96 | 98 | ||
97 | 99 | ||
diff --git a/arch/powerpc/platforms/cell/beat_smp.c b/arch/powerpc/platforms/cell/beat_smp.c index 26efc204c47f..996df33165f1 100644 --- a/arch/powerpc/platforms/cell/beat_smp.c +++ b/arch/powerpc/platforms/cell/beat_smp.c | |||
@@ -93,12 +93,11 @@ static void __devinit smp_beatic_setup_cpu(int cpu) | |||
93 | beatic_setup_cpu(cpu); | 93 | beatic_setup_cpu(cpu); |
94 | } | 94 | } |
95 | 95 | ||
96 | static void __devinit smp_celleb_kick_cpu(int nr) | 96 | static int __devinit smp_celleb_kick_cpu(int nr) |
97 | { | 97 | { |
98 | BUG_ON(nr < 0 || nr >= NR_CPUS); | 98 | BUG_ON(nr < 0 || nr >= NR_CPUS); |
99 | 99 | ||
100 | if (!smp_startup_cpu(nr)) | 100 | return smp_startup_cpu(nr); |
101 | return; | ||
102 | } | 101 | } |
103 | 102 | ||
104 | static int smp_celleb_cpu_bootable(unsigned int nr) | 103 | static int smp_celleb_cpu_bootable(unsigned int nr) |
diff --git a/arch/powerpc/platforms/cell/smp.c b/arch/powerpc/platforms/cell/smp.c index f774530075b7..03d638e2f44f 100644 --- a/arch/powerpc/platforms/cell/smp.c +++ b/arch/powerpc/platforms/cell/smp.c | |||
@@ -137,12 +137,12 @@ static void __devinit smp_cell_setup_cpu(int cpu) | |||
137 | mtspr(SPRN_DABRX, DABRX_KERNEL | DABRX_USER); | 137 | mtspr(SPRN_DABRX, DABRX_KERNEL | DABRX_USER); |
138 | } | 138 | } |
139 | 139 | ||
140 | static void __devinit smp_cell_kick_cpu(int nr) | 140 | static int __devinit smp_cell_kick_cpu(int nr) |
141 | { | 141 | { |
142 | BUG_ON(nr < 0 || nr >= NR_CPUS); | 142 | BUG_ON(nr < 0 || nr >= NR_CPUS); |
143 | 143 | ||
144 | if (!smp_startup_cpu(nr)) | 144 | if (!smp_startup_cpu(nr)) |
145 | return; | 145 | return -ENOENT; |
146 | 146 | ||
147 | /* | 147 | /* |
148 | * The processor is currently spinning, waiting for the | 148 | * The processor is currently spinning, waiting for the |
@@ -150,6 +150,8 @@ static void __devinit smp_cell_kick_cpu(int nr) | |||
150 | * the processor will continue on to secondary_start | 150 | * the processor will continue on to secondary_start |
151 | */ | 151 | */ |
152 | paca[nr].cpu_start = 1; | 152 | paca[nr].cpu_start = 1; |
153 | |||
154 | return 0; | ||
153 | } | 155 | } |
154 | 156 | ||
155 | static int smp_cell_cpu_bootable(unsigned int nr) | 157 | static int smp_cell_cpu_bootable(unsigned int nr) |
diff --git a/arch/powerpc/platforms/chrp/smp.c b/arch/powerpc/platforms/chrp/smp.c index 02cafecc90e3..a800122e4dda 100644 --- a/arch/powerpc/platforms/chrp/smp.c +++ b/arch/powerpc/platforms/chrp/smp.c | |||
@@ -30,10 +30,12 @@ | |||
30 | #include <asm/mpic.h> | 30 | #include <asm/mpic.h> |
31 | #include <asm/rtas.h> | 31 | #include <asm/rtas.h> |
32 | 32 | ||
33 | static void __devinit smp_chrp_kick_cpu(int nr) | 33 | static int __devinit smp_chrp_kick_cpu(int nr) |
34 | { | 34 | { |
35 | *(unsigned long *)KERNELBASE = nr; | 35 | *(unsigned long *)KERNELBASE = nr; |
36 | asm volatile("dcbf 0,%0"::"r"(KERNELBASE):"memory"); | 36 | asm volatile("dcbf 0,%0"::"r"(KERNELBASE):"memory"); |
37 | |||
38 | return 0; | ||
37 | } | 39 | } |
38 | 40 | ||
39 | static void __devinit smp_chrp_setup_cpu(int cpu_nr) | 41 | static void __devinit smp_chrp_setup_cpu(int cpu_nr) |
diff --git a/arch/powerpc/platforms/iseries/smp.c b/arch/powerpc/platforms/iseries/smp.c index 6c6029914dbc..02a677a1f912 100644 --- a/arch/powerpc/platforms/iseries/smp.c +++ b/arch/powerpc/platforms/iseries/smp.c | |||
@@ -86,13 +86,13 @@ static int smp_iSeries_probe(void) | |||
86 | return cpumask_weight(cpu_possible_mask); | 86 | return cpumask_weight(cpu_possible_mask); |
87 | } | 87 | } |
88 | 88 | ||
89 | static void smp_iSeries_kick_cpu(int nr) | 89 | static int smp_iSeries_kick_cpu(int nr) |
90 | { | 90 | { |
91 | BUG_ON((nr < 0) || (nr >= NR_CPUS)); | 91 | BUG_ON((nr < 0) || (nr >= NR_CPUS)); |
92 | 92 | ||
93 | /* Verify that our partition has a processor nr */ | 93 | /* Verify that our partition has a processor nr */ |
94 | if (lppaca_of(nr).dyn_proc_status >= 2) | 94 | if (lppaca_of(nr).dyn_proc_status >= 2) |
95 | return; | 95 | return -ENOENT; |
96 | 96 | ||
97 | /* The processor is currently spinning, waiting | 97 | /* The processor is currently spinning, waiting |
98 | * for the cpu_start field to become non-zero | 98 | * for the cpu_start field to become non-zero |
@@ -100,6 +100,8 @@ static void smp_iSeries_kick_cpu(int nr) | |||
100 | * continue on to secondary_start in iSeries_head.S | 100 | * continue on to secondary_start in iSeries_head.S |
101 | */ | 101 | */ |
102 | paca[nr].cpu_start = 1; | 102 | paca[nr].cpu_start = 1; |
103 | |||
104 | return 0; | ||
103 | } | 105 | } |
104 | 106 | ||
105 | static void __devinit smp_iSeries_setup_cpu(int nr) | 107 | static void __devinit smp_iSeries_setup_cpu(int nr) |
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c index bc5f0dc6ae1e..621d4b7755f2 100644 --- a/arch/powerpc/platforms/powermac/smp.c +++ b/arch/powerpc/platforms/powermac/smp.c | |||
@@ -329,7 +329,7 @@ static int __init smp_psurge_probe(void) | |||
329 | return ncpus; | 329 | return ncpus; |
330 | } | 330 | } |
331 | 331 | ||
332 | static void __init smp_psurge_kick_cpu(int nr) | 332 | static int __init smp_psurge_kick_cpu(int nr) |
333 | { | 333 | { |
334 | unsigned long start = __pa(__secondary_start_pmac_0) + nr * 8; | 334 | unsigned long start = __pa(__secondary_start_pmac_0) + nr * 8; |
335 | unsigned long a, flags; | 335 | unsigned long a, flags; |
@@ -394,6 +394,8 @@ static void __init smp_psurge_kick_cpu(int nr) | |||
394 | psurge_set_ipi(1); | 394 | psurge_set_ipi(1); |
395 | 395 | ||
396 | if (ppc_md.progress) ppc_md.progress("smp_psurge_kick_cpu - done", 0x354); | 396 | if (ppc_md.progress) ppc_md.progress("smp_psurge_kick_cpu - done", 0x354); |
397 | |||
398 | return 0; | ||
397 | } | 399 | } |
398 | 400 | ||
399 | static struct irqaction psurge_irqaction = { | 401 | static struct irqaction psurge_irqaction = { |
@@ -791,14 +793,14 @@ static int __init smp_core99_probe(void) | |||
791 | return ncpus; | 793 | return ncpus; |
792 | } | 794 | } |
793 | 795 | ||
794 | static void __devinit smp_core99_kick_cpu(int nr) | 796 | static int __devinit smp_core99_kick_cpu(int nr) |
795 | { | 797 | { |
796 | unsigned int save_vector; | 798 | unsigned int save_vector; |
797 | unsigned long target, flags; | 799 | unsigned long target, flags; |
798 | unsigned int *vector = (unsigned int *)(PAGE_OFFSET+0x100); | 800 | unsigned int *vector = (unsigned int *)(PAGE_OFFSET+0x100); |
799 | 801 | ||
800 | if (nr < 0 || nr > 3) | 802 | if (nr < 0 || nr > 3) |
801 | return; | 803 | return -ENOENT; |
802 | 804 | ||
803 | if (ppc_md.progress) | 805 | if (ppc_md.progress) |
804 | ppc_md.progress("smp_core99_kick_cpu", 0x346); | 806 | ppc_md.progress("smp_core99_kick_cpu", 0x346); |
@@ -830,6 +832,8 @@ static void __devinit smp_core99_kick_cpu(int nr) | |||
830 | 832 | ||
831 | local_irq_restore(flags); | 833 | local_irq_restore(flags); |
832 | if (ppc_md.progress) ppc_md.progress("smp_core99_kick_cpu done", 0x347); | 834 | if (ppc_md.progress) ppc_md.progress("smp_core99_kick_cpu done", 0x347); |
835 | |||
836 | return 0; | ||
833 | } | 837 | } |
834 | 838 | ||
835 | static void __devinit smp_core99_setup_cpu(int cpu_nr) | 839 | static void __devinit smp_core99_setup_cpu(int cpu_nr) |
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c index fc72bfce7320..95f578158ff0 100644 --- a/arch/powerpc/platforms/pseries/smp.c +++ b/arch/powerpc/platforms/pseries/smp.c | |||
@@ -152,12 +152,12 @@ static void __devinit smp_xics_setup_cpu(int cpu) | |||
152 | #endif | 152 | #endif |
153 | } | 153 | } |
154 | 154 | ||
155 | static void __devinit smp_pSeries_kick_cpu(int nr) | 155 | static int __devinit smp_pSeries_kick_cpu(int nr) |
156 | { | 156 | { |
157 | BUG_ON(nr < 0 || nr >= NR_CPUS); | 157 | BUG_ON(nr < 0 || nr >= NR_CPUS); |
158 | 158 | ||
159 | if (!smp_startup_cpu(nr)) | 159 | if (!smp_startup_cpu(nr)) |
160 | return; | 160 | return -ENOENT; |
161 | 161 | ||
162 | /* | 162 | /* |
163 | * The processor is currently spinning, waiting for the | 163 | * The processor is currently spinning, waiting for the |
@@ -179,6 +179,8 @@ static void __devinit smp_pSeries_kick_cpu(int nr) | |||
179 | "Ret= %ld\n", nr, rc); | 179 | "Ret= %ld\n", nr, rc); |
180 | } | 180 | } |
181 | #endif | 181 | #endif |
182 | |||
183 | return 0; | ||
182 | } | 184 | } |
183 | 185 | ||
184 | static int smp_pSeries_cpu_bootable(unsigned int nr) | 186 | static int smp_pSeries_cpu_bootable(unsigned int nr) |