Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* smp.c: Sparc SMP support. |
| 2 | * |
| 3 | * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) |
| 4 | * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) |
| 5 | * Copyright (C) 2004 Keith M Wesolowski (wesolows@foobazco.org) |
| 6 | */ |
| 7 | |
| 8 | #include <asm/head.h> |
| 9 | |
| 10 | #include <linux/kernel.h> |
| 11 | #include <linux/sched.h> |
| 12 | #include <linux/threads.h> |
| 13 | #include <linux/smp.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | #include <linux/interrupt.h> |
| 15 | #include <linux/kernel_stat.h> |
| 16 | #include <linux/init.h> |
| 17 | #include <linux/spinlock.h> |
| 18 | #include <linux/mm.h> |
| 19 | #include <linux/fs.h> |
| 20 | #include <linux/seq_file.h> |
| 21 | #include <linux/cache.h> |
| 22 | #include <linux/delay.h> |
Sam Ravnborg | d309129 | 2014-05-16 23:26:05 +0200 | [diff] [blame] | 23 | #include <linux/profile.h> |
Sam Ravnborg | f9fd348 | 2013-02-15 15:52:06 +0100 | [diff] [blame] | 24 | #include <linux/cpu.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | |
| 26 | #include <asm/ptrace.h> |
Arun Sharma | 60063497 | 2011-07-26 16:09:06 -0700 | [diff] [blame] | 27 | #include <linux/atomic.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | |
| 29 | #include <asm/irq.h> |
| 30 | #include <asm/page.h> |
| 31 | #include <asm/pgalloc.h> |
| 32 | #include <asm/pgtable.h> |
| 33 | #include <asm/oplib.h> |
| 34 | #include <asm/cacheflush.h> |
| 35 | #include <asm/tlbflush.h> |
| 36 | #include <asm/cpudata.h> |
Sam Ravnborg | f9fd348 | 2013-02-15 15:52:06 +0100 | [diff] [blame] | 37 | #include <asm/timer.h> |
Konrad Eisele | 8401707 | 2009-08-31 22:08:13 +0000 | [diff] [blame] | 38 | #include <asm/leon.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
Sam Ravnborg | f9fd348 | 2013-02-15 15:52:06 +0100 | [diff] [blame] | 40 | #include "kernel.h" |
Al Viro | 32231a6 | 2007-07-21 19:18:57 -0700 | [diff] [blame] | 41 | #include "irq.h" |
| 42 | |
Paul Gortmaker | 2066aad | 2013-06-17 15:43:14 -0400 | [diff] [blame] | 43 | volatile unsigned long cpu_callin_map[NR_CPUS] = {0,}; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 45 | cpumask_t smp_commenced_mask = CPU_MASK_NONE; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | |
Sam Ravnborg | 4ba22b1 | 2012-05-14 15:14:36 +0200 | [diff] [blame] | 47 | const struct sparc32_ipi_ops *sparc32_ipi_ops; |
| 48 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | /* The only guaranteed locking primitive available on all Sparc |
| 50 | * processors is 'ldstub [%reg + immediate], %dest_reg' which atomically |
| 51 | * places the current byte at the effective address into dest_reg and |
| 52 | * places 0xff there afterwards. Pretty lame locking primitive |
| 53 | * compared to the Alpha and the Intel no? Most Sparcs have 'swap' |
| 54 | * instruction which is much better... |
| 55 | */ |
| 56 | |
Paul Gortmaker | 2066aad | 2013-06-17 15:43:14 -0400 | [diff] [blame] | 57 | void smp_store_cpu_info(int id) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | { |
| 59 | int cpu_node; |
Sam Ravnborg | f486b3d | 2011-04-21 16:35:46 -0700 | [diff] [blame] | 60 | int mid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | |
| 62 | cpu_data(id).udelay_val = loops_per_jiffy; |
| 63 | |
| 64 | cpu_find_by_mid(id, &cpu_node); |
| 65 | cpu_data(id).clock_tick = prom_getintdefault(cpu_node, |
| 66 | "clock-frequency", 0); |
| 67 | cpu_data(id).prom_node = cpu_node; |
Sam Ravnborg | f486b3d | 2011-04-21 16:35:46 -0700 | [diff] [blame] | 68 | mid = cpu_get_hwmid(cpu_node); |
Krzysztof Helt | 650fb83 | 2006-06-10 22:03:43 -0700 | [diff] [blame] | 69 | |
Sam Ravnborg | f486b3d | 2011-04-21 16:35:46 -0700 | [diff] [blame] | 70 | if (mid < 0) { |
Hans Wennborg | 551d57f | 2014-08-05 21:41:36 -0700 | [diff] [blame] | 71 | printk(KERN_NOTICE "No MID found for CPU%d at node 0x%08x", id, cpu_node); |
Sam Ravnborg | f486b3d | 2011-04-21 16:35:46 -0700 | [diff] [blame] | 72 | mid = 0; |
| 73 | } |
| 74 | cpu_data(id).mid = mid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | void __init smp_cpus_done(unsigned int max_cpus) |
| 78 | { |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 79 | unsigned long bogosum = 0; |
Rusty Russell | ec7c14b | 2009-03-16 14:40:24 +1030 | [diff] [blame] | 80 | int cpu, num = 0; |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 81 | |
Rusty Russell | ec7c14b | 2009-03-16 14:40:24 +1030 | [diff] [blame] | 82 | for_each_online_cpu(cpu) { |
| 83 | num++; |
| 84 | bogosum += cpu_data(cpu).udelay_val; |
| 85 | } |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 86 | |
| 87 | printk("Total of %d processors activated (%lu.%02lu BogoMIPS).\n", |
| 88 | num, bogosum/(500000/HZ), |
| 89 | (bogosum/(5000/HZ))%100); |
| 90 | |
Raymond Burns | 8b3c848 | 2006-07-17 21:57:09 -0700 | [diff] [blame] | 91 | switch(sparc_cpu_model) { |
Raymond Burns | 8b3c848 | 2006-07-17 21:57:09 -0700 | [diff] [blame] | 92 | case sun4m: |
| 93 | smp4m_smp_done(); |
| 94 | break; |
| 95 | case sun4d: |
| 96 | smp4d_smp_done(); |
| 97 | break; |
Konrad Eisele | 8401707 | 2009-08-31 22:08:13 +0000 | [diff] [blame] | 98 | case sparc_leon: |
| 99 | leon_smp_done(); |
| 100 | break; |
Raymond Burns | 8b3c848 | 2006-07-17 21:57:09 -0700 | [diff] [blame] | 101 | case sun4e: |
| 102 | printk("SUN4E\n"); |
| 103 | BUG(); |
| 104 | break; |
| 105 | case sun4u: |
| 106 | printk("SUN4U\n"); |
| 107 | BUG(); |
| 108 | break; |
| 109 | default: |
| 110 | printk("UNKNOWN!\n"); |
| 111 | BUG(); |
| 112 | break; |
Joe Perches | 6cb79b3 | 2011-06-03 14:45:23 +0000 | [diff] [blame] | 113 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 | } |
| 115 | |
| 116 | void cpu_panic(void) |
| 117 | { |
| 118 | printk("CPU[%d]: Returns from cpu_idle!\n", smp_processor_id()); |
| 119 | panic("SMP bolixed\n"); |
| 120 | } |
| 121 | |
Paul Gortmaker | 2066aad | 2013-06-17 15:43:14 -0400 | [diff] [blame] | 122 | struct linux_prom_registers smp_penguin_ctable = { 0 }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 123 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 124 | void smp_send_reschedule(int cpu) |
| 125 | { |
Daniel Hellstrom | d6d0481 | 2011-05-02 00:08:51 +0000 | [diff] [blame] | 126 | /* |
| 127 | * CPU model dependent way of implementing IPI generation targeting |
| 128 | * a single CPU. The trap handler needs only to do trap entry/return |
| 129 | * to call schedule. |
| 130 | */ |
Sam Ravnborg | 4ba22b1 | 2012-05-14 15:14:36 +0200 | [diff] [blame] | 131 | sparc32_ipi_ops->resched(cpu); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | } |
| 133 | |
| 134 | void smp_send_stop(void) |
| 135 | { |
| 136 | } |
| 137 | |
Daniel Hellstrom | d6d0481 | 2011-05-02 00:08:51 +0000 | [diff] [blame] | 138 | void arch_send_call_function_single_ipi(int cpu) |
| 139 | { |
| 140 | /* trigger one IPI single call on one CPU */ |
Sam Ravnborg | 4ba22b1 | 2012-05-14 15:14:36 +0200 | [diff] [blame] | 141 | sparc32_ipi_ops->single(cpu); |
Daniel Hellstrom | d6d0481 | 2011-05-02 00:08:51 +0000 | [diff] [blame] | 142 | } |
| 143 | |
| 144 | void arch_send_call_function_ipi_mask(const struct cpumask *mask) |
| 145 | { |
| 146 | int cpu; |
| 147 | |
| 148 | /* trigger IPI mask call on each CPU */ |
| 149 | for_each_cpu(cpu, mask) |
Sam Ravnborg | 4ba22b1 | 2012-05-14 15:14:36 +0200 | [diff] [blame] | 150 | sparc32_ipi_ops->mask_one(cpu); |
Daniel Hellstrom | d6d0481 | 2011-05-02 00:08:51 +0000 | [diff] [blame] | 151 | } |
| 152 | |
| 153 | void smp_resched_interrupt(void) |
| 154 | { |
David S. Miller | 90d3ac1 | 2011-05-20 13:10:22 -0700 | [diff] [blame] | 155 | irq_enter(); |
| 156 | scheduler_ipi(); |
Daniel Hellstrom | d6d0481 | 2011-05-02 00:08:51 +0000 | [diff] [blame] | 157 | local_cpu_data().irq_resched_count++; |
David S. Miller | 90d3ac1 | 2011-05-20 13:10:22 -0700 | [diff] [blame] | 158 | irq_exit(); |
| 159 | /* re-schedule routine called by interrupt return code. */ |
Daniel Hellstrom | d6d0481 | 2011-05-02 00:08:51 +0000 | [diff] [blame] | 160 | } |
| 161 | |
| 162 | void smp_call_function_single_interrupt(void) |
| 163 | { |
| 164 | irq_enter(); |
| 165 | generic_smp_call_function_single_interrupt(); |
| 166 | local_cpu_data().irq_call_count++; |
| 167 | irq_exit(); |
| 168 | } |
| 169 | |
| 170 | void smp_call_function_interrupt(void) |
| 171 | { |
| 172 | irq_enter(); |
| 173 | generic_smp_call_function_interrupt(); |
| 174 | local_cpu_data().irq_call_count++; |
| 175 | irq_exit(); |
| 176 | } |
| 177 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 178 | int setup_profiling_timer(unsigned int multiplier) |
| 179 | { |
Tkhai Kirill | 62f0828 | 2012-04-04 21:49:26 +0200 | [diff] [blame] | 180 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 181 | } |
| 182 | |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 183 | void __init smp_prepare_cpus(unsigned int max_cpus) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 184 | { |
Bob Breuer | 7202fb4 | 2006-06-20 00:30:31 -0700 | [diff] [blame] | 185 | int i, cpuid, extra; |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 186 | |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 187 | printk("Entering SMP Mode...\n"); |
| 188 | |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 189 | extra = 0; |
| 190 | for (i = 0; !cpu_find_by_instance(i, NULL, &cpuid); i++) { |
Bob Breuer | 7202fb4 | 2006-06-20 00:30:31 -0700 | [diff] [blame] | 191 | if (cpuid >= NR_CPUS) |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 192 | extra++; |
| 193 | } |
Bob Breuer | 7202fb4 | 2006-06-20 00:30:31 -0700 | [diff] [blame] | 194 | /* i = number of cpus */ |
| 195 | if (extra && max_cpus > i - extra) |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 196 | printk("Warning: NR_CPUS is too low to start all cpus\n"); |
| 197 | |
| 198 | smp_store_cpu_info(boot_cpu_id); |
| 199 | |
Raymond Burns | 8b3c848 | 2006-07-17 21:57:09 -0700 | [diff] [blame] | 200 | switch(sparc_cpu_model) { |
Raymond Burns | 8b3c848 | 2006-07-17 21:57:09 -0700 | [diff] [blame] | 201 | case sun4m: |
| 202 | smp4m_boot_cpus(); |
| 203 | break; |
| 204 | case sun4d: |
| 205 | smp4d_boot_cpus(); |
| 206 | break; |
Konrad Eisele | 8401707 | 2009-08-31 22:08:13 +0000 | [diff] [blame] | 207 | case sparc_leon: |
| 208 | leon_boot_cpus(); |
| 209 | break; |
Raymond Burns | 8b3c848 | 2006-07-17 21:57:09 -0700 | [diff] [blame] | 210 | case sun4e: |
| 211 | printk("SUN4E\n"); |
| 212 | BUG(); |
| 213 | break; |
| 214 | case sun4u: |
| 215 | printk("SUN4U\n"); |
| 216 | BUG(); |
| 217 | break; |
| 218 | default: |
| 219 | printk("UNKNOWN!\n"); |
| 220 | BUG(); |
| 221 | break; |
Joe Perches | 6cb79b3 | 2011-06-03 14:45:23 +0000 | [diff] [blame] | 222 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 223 | } |
| 224 | |
Bob Breuer | 7202fb4 | 2006-06-20 00:30:31 -0700 | [diff] [blame] | 225 | /* Set this up early so that things like the scheduler can init |
| 226 | * properly. We use the same cpu mask for both the present and |
| 227 | * possible cpu map. |
| 228 | */ |
| 229 | void __init smp_setup_cpu_possible_map(void) |
| 230 | { |
| 231 | int instance, mid; |
| 232 | |
| 233 | instance = 0; |
| 234 | while (!cpu_find_by_instance(instance, NULL, &mid)) { |
| 235 | if (mid < NR_CPUS) { |
Rusty Russell | fe73971 | 2009-03-16 14:40:22 +1030 | [diff] [blame] | 236 | set_cpu_possible(mid, true); |
| 237 | set_cpu_present(mid, true); |
Bob Breuer | 7202fb4 | 2006-06-20 00:30:31 -0700 | [diff] [blame] | 238 | } |
| 239 | instance++; |
| 240 | } |
| 241 | } |
| 242 | |
Bob Breuer | 92d452f | 2006-06-20 00:36:10 -0700 | [diff] [blame] | 243 | void __init smp_prepare_boot_cpu(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 244 | { |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 245 | int cpuid = hard_smp_processor_id(); |
| 246 | |
| 247 | if (cpuid >= NR_CPUS) { |
| 248 | prom_printf("Serious problem, boot cpu id >= NR_CPUS\n"); |
| 249 | prom_halt(); |
| 250 | } |
| 251 | if (cpuid != 0) |
| 252 | printk("boot cpu id != 0, this could work but is untested\n"); |
| 253 | |
| 254 | current_thread_info()->cpu = cpuid; |
Rusty Russell | fe73971 | 2009-03-16 14:40:22 +1030 | [diff] [blame] | 255 | set_cpu_online(cpuid, true); |
| 256 | set_cpu_possible(cpuid, true); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | } |
| 258 | |
Paul Gortmaker | 2066aad | 2013-06-17 15:43:14 -0400 | [diff] [blame] | 259 | int __cpu_up(unsigned int cpu, struct task_struct *tidle) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | { |
Raymond Burns | 8b3c848 | 2006-07-17 21:57:09 -0700 | [diff] [blame] | 261 | int ret=0; |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 262 | |
Raymond Burns | 8b3c848 | 2006-07-17 21:57:09 -0700 | [diff] [blame] | 263 | switch(sparc_cpu_model) { |
Raymond Burns | 8b3c848 | 2006-07-17 21:57:09 -0700 | [diff] [blame] | 264 | case sun4m: |
Thomas Gleixner | f0a2bc7 | 2012-04-20 13:05:56 +0000 | [diff] [blame] | 265 | ret = smp4m_boot_one_cpu(cpu, tidle); |
Raymond Burns | 8b3c848 | 2006-07-17 21:57:09 -0700 | [diff] [blame] | 266 | break; |
| 267 | case sun4d: |
Thomas Gleixner | f0a2bc7 | 2012-04-20 13:05:56 +0000 | [diff] [blame] | 268 | ret = smp4d_boot_one_cpu(cpu, tidle); |
Raymond Burns | 8b3c848 | 2006-07-17 21:57:09 -0700 | [diff] [blame] | 269 | break; |
Konrad Eisele | 8401707 | 2009-08-31 22:08:13 +0000 | [diff] [blame] | 270 | case sparc_leon: |
Thomas Gleixner | f0a2bc7 | 2012-04-20 13:05:56 +0000 | [diff] [blame] | 271 | ret = leon_boot_one_cpu(cpu, tidle); |
Konrad Eisele | 8401707 | 2009-08-31 22:08:13 +0000 | [diff] [blame] | 272 | break; |
Raymond Burns | 8b3c848 | 2006-07-17 21:57:09 -0700 | [diff] [blame] | 273 | case sun4e: |
| 274 | printk("SUN4E\n"); |
| 275 | BUG(); |
| 276 | break; |
| 277 | case sun4u: |
| 278 | printk("SUN4U\n"); |
| 279 | BUG(); |
| 280 | break; |
| 281 | default: |
| 282 | printk("UNKNOWN!\n"); |
| 283 | BUG(); |
| 284 | break; |
Joe Perches | 6cb79b3 | 2011-06-03 14:45:23 +0000 | [diff] [blame] | 285 | } |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 286 | |
| 287 | if (!ret) { |
KOSAKI Motohiro | fb1fece | 2011-05-16 13:38:07 -0700 | [diff] [blame] | 288 | cpumask_set_cpu(cpu, &smp_commenced_mask); |
Bob Breuer | a54123e | 2006-03-23 22:36:19 -0800 | [diff] [blame] | 289 | while (!cpu_online(cpu)) |
| 290 | mb(); |
| 291 | } |
| 292 | return ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 293 | } |
| 294 | |
Sam Ravnborg | c0b0ba8 | 2014-04-21 21:39:36 +0200 | [diff] [blame] | 295 | static void arch_cpu_pre_starting(void *arg) |
Sam Ravnborg | f9fd348 | 2013-02-15 15:52:06 +0100 | [diff] [blame] | 296 | { |
| 297 | local_ops->cache_all(); |
| 298 | local_ops->tlb_all(); |
| 299 | |
| 300 | switch(sparc_cpu_model) { |
| 301 | case sun4m: |
| 302 | sun4m_cpu_pre_starting(arg); |
| 303 | break; |
| 304 | case sun4d: |
| 305 | sun4d_cpu_pre_starting(arg); |
| 306 | break; |
| 307 | case sparc_leon: |
| 308 | leon_cpu_pre_starting(arg); |
| 309 | break; |
| 310 | default: |
| 311 | BUG(); |
| 312 | } |
| 313 | } |
| 314 | |
Sam Ravnborg | c0b0ba8 | 2014-04-21 21:39:36 +0200 | [diff] [blame] | 315 | static void arch_cpu_pre_online(void *arg) |
Sam Ravnborg | f9fd348 | 2013-02-15 15:52:06 +0100 | [diff] [blame] | 316 | { |
| 317 | unsigned int cpuid = hard_smp_processor_id(); |
| 318 | |
| 319 | register_percpu_ce(cpuid); |
| 320 | |
| 321 | calibrate_delay(); |
| 322 | smp_store_cpu_info(cpuid); |
| 323 | |
| 324 | local_ops->cache_all(); |
| 325 | local_ops->tlb_all(); |
| 326 | |
| 327 | switch(sparc_cpu_model) { |
| 328 | case sun4m: |
| 329 | sun4m_cpu_pre_online(arg); |
| 330 | break; |
| 331 | case sun4d: |
| 332 | sun4d_cpu_pre_online(arg); |
| 333 | break; |
| 334 | case sparc_leon: |
| 335 | leon_cpu_pre_online(arg); |
| 336 | break; |
| 337 | default: |
| 338 | BUG(); |
| 339 | } |
| 340 | } |
| 341 | |
Sam Ravnborg | c0b0ba8 | 2014-04-21 21:39:36 +0200 | [diff] [blame] | 342 | static void sparc_start_secondary(void *arg) |
Sam Ravnborg | f9fd348 | 2013-02-15 15:52:06 +0100 | [diff] [blame] | 343 | { |
| 344 | unsigned int cpu; |
| 345 | |
| 346 | /* |
| 347 | * SMP booting is extremely fragile in some architectures. So run |
| 348 | * the cpu initialization code first before anything else. |
| 349 | */ |
| 350 | arch_cpu_pre_starting(arg); |
| 351 | |
| 352 | preempt_disable(); |
| 353 | cpu = smp_processor_id(); |
| 354 | |
| 355 | /* Invoke the CPU_STARTING notifier callbacks */ |
| 356 | notify_cpu_starting(cpu); |
| 357 | |
| 358 | arch_cpu_pre_online(arg); |
| 359 | |
| 360 | /* Set the CPU in the cpu_online_mask */ |
| 361 | set_cpu_online(cpu, true); |
| 362 | |
| 363 | /* Enable local interrupts now */ |
| 364 | local_irq_enable(); |
| 365 | |
| 366 | wmb(); |
Sam Ravnborg | 87fa05a | 2013-04-11 21:38:50 +0200 | [diff] [blame] | 367 | cpu_startup_entry(CPUHP_ONLINE); |
Sam Ravnborg | f9fd348 | 2013-02-15 15:52:06 +0100 | [diff] [blame] | 368 | |
| 369 | /* We should never reach here! */ |
| 370 | BUG(); |
| 371 | } |
| 372 | |
Paul Gortmaker | 2066aad | 2013-06-17 15:43:14 -0400 | [diff] [blame] | 373 | void smp_callin(void) |
Sam Ravnborg | f9fd348 | 2013-02-15 15:52:06 +0100 | [diff] [blame] | 374 | { |
| 375 | sparc_start_secondary(NULL); |
| 376 | } |
| 377 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 378 | void smp_bogo(struct seq_file *m) |
| 379 | { |
| 380 | int i; |
| 381 | |
Andrew Morton | 394e390 | 2006-03-23 03:01:05 -0800 | [diff] [blame] | 382 | for_each_online_cpu(i) { |
| 383 | seq_printf(m, |
| 384 | "Cpu%dBogo\t: %lu.%02lu\n", |
| 385 | i, |
| 386 | cpu_data(i).udelay_val/(500000/HZ), |
| 387 | (cpu_data(i).udelay_val/(5000/HZ))%100); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 388 | } |
| 389 | } |
| 390 | |
| 391 | void smp_info(struct seq_file *m) |
| 392 | { |
| 393 | int i; |
| 394 | |
| 395 | seq_printf(m, "State:\n"); |
Andrew Morton | 394e390 | 2006-03-23 03:01:05 -0800 | [diff] [blame] | 396 | for_each_online_cpu(i) |
| 397 | seq_printf(m, "CPU%d\t\t: online\n", i); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 398 | } |