smp.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705
  1. /*
  2. * SMP support for ppc.
  3. *
  4. * Written by Cort Dougan (cort@cs.nmt.edu) borrowing a great
  5. * deal of code from the sparc and intel versions.
  6. *
  7. * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu>
  8. *
  9. * PowerPC-64 Support added by Dave Engebretsen, Peter Bergner, and
  10. * Mike Corrigan {engebret|bergner|mikec}@us.ibm.com
  11. *
  12. * This program is free software; you can redistribute it and/or
  13. * modify it under the terms of the GNU General Public License
  14. * as published by the Free Software Foundation; either version
  15. * 2 of the License, or (at your option) any later version.
  16. */
  17. #undef DEBUG
  18. #include <linux/kernel.h>
  19. #include <linux/module.h>
  20. #include <linux/sched.h>
  21. #include <linux/smp.h>
  22. #include <linux/interrupt.h>
  23. #include <linux/delay.h>
  24. #include <linux/init.h>
  25. #include <linux/spinlock.h>
  26. #include <linux/cache.h>
  27. #include <linux/err.h>
  28. #include <linux/sysdev.h>
  29. #include <linux/cpu.h>
  30. #include <linux/notifier.h>
  31. #include <linux/topology.h>
  32. #include <asm/ptrace.h>
  33. #include <asm/atomic.h>
  34. #include <asm/irq.h>
  35. #include <asm/page.h>
  36. #include <asm/pgtable.h>
  37. #include <asm/prom.h>
  38. #include <asm/smp.h>
  39. #include <asm/time.h>
  40. #include <asm/machdep.h>
  41. #include <asm/cputhreads.h>
  42. #include <asm/cputable.h>
  43. #include <asm/system.h>
  44. #include <asm/mpic.h>
  45. #include <asm/vdso_datapage.h>
  46. #ifdef CONFIG_PPC64
  47. #include <asm/paca.h>
  48. #endif
  49. #ifdef DEBUG
  50. #include <asm/udbg.h>
  51. #define DBG(fmt...) udbg_printf(fmt)
  52. #else
  53. #define DBG(fmt...)
  54. #endif
  55. /* Store all idle threads, this can be reused instead of creating
  56. * a new thread. Also avoids complicated thread destroy functionality
  57. * for idle threads.
  58. */
  59. #ifdef CONFIG_HOTPLUG_CPU
  60. /*
  61. * Needed only for CONFIG_HOTPLUG_CPU because __cpuinitdata is
  62. * removed after init for !CONFIG_HOTPLUG_CPU.
  63. */
  64. static DEFINE_PER_CPU(struct task_struct *, idle_thread_array);
  65. #define get_idle_for_cpu(x) (per_cpu(idle_thread_array, x))
  66. #define set_idle_for_cpu(x, p) (per_cpu(idle_thread_array, x) = (p))
  67. #else
  68. static struct task_struct *idle_thread_array[NR_CPUS] __cpuinitdata ;
  69. #define get_idle_for_cpu(x) (idle_thread_array[(x)])
  70. #define set_idle_for_cpu(x, p) (idle_thread_array[(x)] = (p))
  71. #endif
  72. struct thread_info *secondary_ti;
  73. DEFINE_PER_CPU(cpumask_var_t, cpu_sibling_map);
  74. DEFINE_PER_CPU(cpumask_var_t, cpu_core_map);
  75. EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
  76. EXPORT_PER_CPU_SYMBOL(cpu_core_map);
  77. /* SMP operations for this machine */
  78. struct smp_ops_t *smp_ops;
  79. /* Can't be static due to PowerMac hackery */
  80. volatile unsigned int cpu_callin_map[NR_CPUS];
  81. int smt_enabled_at_boot = 1;
  82. static void (*crash_ipi_function_ptr)(struct pt_regs *) = NULL;
  83. #ifdef CONFIG_PPC64
  84. void __devinit smp_generic_kick_cpu(int nr)
  85. {
  86. BUG_ON(nr < 0 || nr >= NR_CPUS);
  87. /*
  88. * The processor is currently spinning, waiting for the
  89. * cpu_start field to become non-zero After we set cpu_start,
  90. * the processor will continue on to secondary_start
  91. */
  92. paca[nr].cpu_start = 1;
  93. smp_mb();
  94. }
  95. #endif
  96. void smp_message_recv(int msg)
  97. {
  98. switch(msg) {
  99. case PPC_MSG_CALL_FUNCTION:
  100. generic_smp_call_function_interrupt();
  101. break;
  102. case PPC_MSG_RESCHEDULE:
  103. /* we notice need_resched on exit */
  104. break;
  105. case PPC_MSG_CALL_FUNC_SINGLE:
  106. generic_smp_call_function_single_interrupt();
  107. break;
  108. case PPC_MSG_DEBUGGER_BREAK:
  109. if (crash_ipi_function_ptr) {
  110. crash_ipi_function_ptr(get_irq_regs());
  111. break;
  112. }
  113. #ifdef CONFIG_DEBUGGER
  114. debugger_ipi(get_irq_regs());
  115. break;
  116. #endif /* CONFIG_DEBUGGER */
  117. /* FALLTHROUGH */
  118. default:
  119. printk("SMP %d: smp_message_recv(): unknown msg %d\n",
  120. smp_processor_id(), msg);
  121. break;
  122. }
  123. }
  124. static irqreturn_t call_function_action(int irq, void *data)
  125. {
  126. generic_smp_call_function_interrupt();
  127. return IRQ_HANDLED;
  128. }
  129. static irqreturn_t reschedule_action(int irq, void *data)
  130. {
  131. /* we just need the return path side effect of checking need_resched */
  132. return IRQ_HANDLED;
  133. }
  134. static irqreturn_t call_function_single_action(int irq, void *data)
  135. {
  136. generic_smp_call_function_single_interrupt();
  137. return IRQ_HANDLED;
  138. }
  139. static irqreturn_t debug_ipi_action(int irq, void *data)
  140. {
  141. smp_message_recv(PPC_MSG_DEBUGGER_BREAK);
  142. return IRQ_HANDLED;
  143. }
  144. static irq_handler_t smp_ipi_action[] = {
  145. [PPC_MSG_CALL_FUNCTION] = call_function_action,
  146. [PPC_MSG_RESCHEDULE] = reschedule_action,
  147. [PPC_MSG_CALL_FUNC_SINGLE] = call_function_single_action,
  148. [PPC_MSG_DEBUGGER_BREAK] = debug_ipi_action,
  149. };
  150. const char *smp_ipi_name[] = {
  151. [PPC_MSG_CALL_FUNCTION] = "ipi call function",
  152. [PPC_MSG_RESCHEDULE] = "ipi reschedule",
  153. [PPC_MSG_CALL_FUNC_SINGLE] = "ipi call function single",
  154. [PPC_MSG_DEBUGGER_BREAK] = "ipi debugger",
  155. };
  156. /* optional function to request ipi, for controllers with >= 4 ipis */
  157. int smp_request_message_ipi(int virq, int msg)
  158. {
  159. int err;
  160. if (msg < 0 || msg > PPC_MSG_DEBUGGER_BREAK) {
  161. return -EINVAL;
  162. }
  163. #if !defined(CONFIG_DEBUGGER) && !defined(CONFIG_KEXEC)
  164. if (msg == PPC_MSG_DEBUGGER_BREAK) {
  165. return 1;
  166. }
  167. #endif
  168. err = request_irq(virq, smp_ipi_action[msg], IRQF_DISABLED|IRQF_PERCPU,
  169. smp_ipi_name[msg], 0);
  170. WARN(err < 0, "unable to request_irq %d for %s (rc %d)\n",
  171. virq, smp_ipi_name[msg], err);
  172. return err;
  173. }
  174. void smp_send_reschedule(int cpu)
  175. {
  176. if (likely(smp_ops))
  177. smp_ops->message_pass(cpu, PPC_MSG_RESCHEDULE);
  178. }
  179. void arch_send_call_function_single_ipi(int cpu)
  180. {
  181. smp_ops->message_pass(cpu, PPC_MSG_CALL_FUNC_SINGLE);
  182. }
  183. void arch_send_call_function_ipi_mask(const struct cpumask *mask)
  184. {
  185. unsigned int cpu;
  186. for_each_cpu(cpu, mask)
  187. smp_ops->message_pass(cpu, PPC_MSG_CALL_FUNCTION);
  188. }
  189. #ifdef CONFIG_DEBUGGER
  190. void smp_send_debugger_break(int cpu)
  191. {
  192. if (likely(smp_ops))
  193. smp_ops->message_pass(cpu, PPC_MSG_DEBUGGER_BREAK);
  194. }
  195. #endif
  196. #ifdef CONFIG_KEXEC
  197. void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *))
  198. {
  199. crash_ipi_function_ptr = crash_ipi_callback;
  200. if (crash_ipi_callback && smp_ops) {
  201. mb();
  202. smp_ops->message_pass(MSG_ALL_BUT_SELF, PPC_MSG_DEBUGGER_BREAK);
  203. }
  204. }
  205. #endif
  206. static void stop_this_cpu(void *dummy)
  207. {
  208. /* Remove this CPU */
  209. set_cpu_online(smp_processor_id(), false);
  210. local_irq_disable();
  211. while (1)
  212. ;
  213. }
  214. void smp_send_stop(void)
  215. {
  216. smp_call_function(stop_this_cpu, NULL, 0);
  217. }
  218. struct thread_info *current_set[NR_CPUS];
  219. static void __devinit smp_store_cpu_info(int id)
  220. {
  221. per_cpu(cpu_pvr, id) = mfspr(SPRN_PVR);
  222. }
  223. void __init smp_prepare_cpus(unsigned int max_cpus)
  224. {
  225. unsigned int cpu;
  226. DBG("smp_prepare_cpus\n");
  227. /*
  228. * setup_cpu may need to be called on the boot cpu. We havent
  229. * spun any cpus up but lets be paranoid.
  230. */
  231. BUG_ON(boot_cpuid != smp_processor_id());
  232. /* Fixup boot cpu */
  233. smp_store_cpu_info(boot_cpuid);
  234. cpu_callin_map[boot_cpuid] = 1;
  235. for_each_possible_cpu(cpu) {
  236. zalloc_cpumask_var_node(&per_cpu(cpu_sibling_map, cpu),
  237. GFP_KERNEL, cpu_to_node(cpu));
  238. zalloc_cpumask_var_node(&per_cpu(cpu_core_map, cpu),
  239. GFP_KERNEL, cpu_to_node(cpu));
  240. }
  241. cpumask_set_cpu(boot_cpuid, cpu_sibling_mask(boot_cpuid));
  242. cpumask_set_cpu(boot_cpuid, cpu_core_mask(boot_cpuid));
  243. if (smp_ops)
  244. if (smp_ops->probe)
  245. max_cpus = smp_ops->probe();
  246. else
  247. max_cpus = NR_CPUS;
  248. else
  249. max_cpus = 1;
  250. }
  251. void __devinit smp_prepare_boot_cpu(void)
  252. {
  253. BUG_ON(smp_processor_id() != boot_cpuid);
  254. #ifdef CONFIG_PPC64
  255. paca[boot_cpuid].__current = current;
  256. #endif
  257. current_set[boot_cpuid] = task_thread_info(current);
  258. }
  259. #ifdef CONFIG_HOTPLUG_CPU
  260. /* State of each CPU during hotplug phases */
  261. static DEFINE_PER_CPU(int, cpu_state) = { 0 };
  262. int generic_cpu_disable(void)
  263. {
  264. unsigned int cpu = smp_processor_id();
  265. if (cpu == boot_cpuid)
  266. return -EBUSY;
  267. set_cpu_online(cpu, false);
  268. #ifdef CONFIG_PPC64
  269. vdso_data->processorCount--;
  270. #endif
  271. migrate_irqs();
  272. return 0;
  273. }
  274. void generic_cpu_die(unsigned int cpu)
  275. {
  276. int i;
  277. for (i = 0; i < 100; i++) {
  278. smp_rmb();
  279. if (per_cpu(cpu_state, cpu) == CPU_DEAD)
  280. return;
  281. msleep(100);
  282. }
  283. printk(KERN_ERR "CPU%d didn't die...\n", cpu);
  284. }
  285. void generic_mach_cpu_die(void)
  286. {
  287. unsigned int cpu;
  288. local_irq_disable();
  289. idle_task_exit();
  290. cpu = smp_processor_id();
  291. printk(KERN_DEBUG "CPU%d offline\n", cpu);
  292. __get_cpu_var(cpu_state) = CPU_DEAD;
  293. smp_wmb();
  294. while (__get_cpu_var(cpu_state) != CPU_UP_PREPARE)
  295. cpu_relax();
  296. }
  297. void generic_set_cpu_dead(unsigned int cpu)
  298. {
  299. per_cpu(cpu_state, cpu) = CPU_DEAD;
  300. }
  301. #endif
  302. struct create_idle {
  303. struct work_struct work;
  304. struct task_struct *idle;
  305. struct completion done;
  306. int cpu;
  307. };
  308. static void __cpuinit do_fork_idle(struct work_struct *work)
  309. {
  310. struct create_idle *c_idle =
  311. container_of(work, struct create_idle, work);
  312. c_idle->idle = fork_idle(c_idle->cpu);
  313. complete(&c_idle->done);
  314. }
  315. static int __cpuinit create_idle(unsigned int cpu)
  316. {
  317. struct thread_info *ti;
  318. struct create_idle c_idle = {
  319. .cpu = cpu,
  320. .done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done),
  321. };
  322. INIT_WORK_ONSTACK(&c_idle.work, do_fork_idle);
  323. c_idle.idle = get_idle_for_cpu(cpu);
  324. /* We can't use kernel_thread since we must avoid to
  325. * reschedule the child. We use a workqueue because
  326. * we want to fork from a kernel thread, not whatever
  327. * userspace process happens to be trying to online us.
  328. */
  329. if (!c_idle.idle) {
  330. schedule_work(&c_idle.work);
  331. wait_for_completion(&c_idle.done);
  332. } else
  333. init_idle(c_idle.idle, cpu);
  334. if (IS_ERR(c_idle.idle)) {
  335. pr_err("Failed fork for CPU %u: %li", cpu, PTR_ERR(c_idle.idle));
  336. return PTR_ERR(c_idle.idle);
  337. }
  338. ti = task_thread_info(c_idle.idle);
  339. #ifdef CONFIG_PPC64
  340. paca[cpu].__current = c_idle.idle;
  341. paca[cpu].kstack = (unsigned long)ti + THREAD_SIZE - STACK_FRAME_OVERHEAD;
  342. #endif
  343. ti->cpu = cpu;
  344. current_set[cpu] = ti;
  345. return 0;
  346. }
  347. int __cpuinit __cpu_up(unsigned int cpu)
  348. {
  349. int rc, c;
  350. secondary_ti = current_set[cpu];
  351. if (smp_ops == NULL ||
  352. (smp_ops->cpu_bootable && !smp_ops->cpu_bootable(cpu)))
  353. return -EINVAL;
  354. /* Make sure we have an idle thread */
  355. rc = create_idle(cpu);
  356. if (rc)
  357. return rc;
  358. /* Make sure callin-map entry is 0 (can be leftover a CPU
  359. * hotplug
  360. */
  361. cpu_callin_map[cpu] = 0;
  362. /* The information for processor bringup must
  363. * be written out to main store before we release
  364. * the processor.
  365. */
  366. smp_mb();
  367. /* wake up cpus */
  368. DBG("smp: kicking cpu %d\n", cpu);
  369. smp_ops->kick_cpu(cpu);
  370. /*
  371. * wait to see if the cpu made a callin (is actually up).
  372. * use this value that I found through experimentation.
  373. * -- Cort
  374. */
  375. if (system_state < SYSTEM_RUNNING)
  376. for (c = 50000; c && !cpu_callin_map[cpu]; c--)
  377. udelay(100);
  378. #ifdef CONFIG_HOTPLUG_CPU
  379. else
  380. /*
  381. * CPUs can take much longer to come up in the
  382. * hotplug case. Wait five seconds.
  383. */
  384. for (c = 5000; c && !cpu_callin_map[cpu]; c--)
  385. msleep(1);
  386. #endif
  387. if (!cpu_callin_map[cpu]) {
  388. printk(KERN_ERR "Processor %u is stuck.\n", cpu);
  389. return -ENOENT;
  390. }
  391. DBG("Processor %u found.\n", cpu);
  392. if (smp_ops->give_timebase)
  393. smp_ops->give_timebase();
  394. /* Wait until cpu puts itself in the online map */
  395. while (!cpu_online(cpu))
  396. cpu_relax();
  397. return 0;
  398. }
  399. /* Return the value of the reg property corresponding to the given
  400. * logical cpu.
  401. */
  402. int cpu_to_core_id(int cpu)
  403. {
  404. struct device_node *np;
  405. const int *reg;
  406. int id = -1;
  407. np = of_get_cpu_node(cpu, NULL);
  408. if (!np)
  409. goto out;
  410. reg = of_get_property(np, "reg", NULL);
  411. if (!reg)
  412. goto out;
  413. id = *reg;
  414. out:
  415. of_node_put(np);
  416. return id;
  417. }
  418. /* Helper routines for cpu to core mapping */
  419. int cpu_core_index_of_thread(int cpu)
  420. {
  421. return cpu >> threads_shift;
  422. }
  423. EXPORT_SYMBOL_GPL(cpu_core_index_of_thread);
  424. int cpu_first_thread_of_core(int core)
  425. {
  426. return core << threads_shift;
  427. }
  428. EXPORT_SYMBOL_GPL(cpu_first_thread_of_core);
  429. /* Must be called when no change can occur to cpu_present_map,
  430. * i.e. during cpu online or offline.
  431. */
  432. static struct device_node *cpu_to_l2cache(int cpu)
  433. {
  434. struct device_node *np;
  435. struct device_node *cache;
  436. if (!cpu_present(cpu))
  437. return NULL;
  438. np = of_get_cpu_node(cpu, NULL);
  439. if (np == NULL)
  440. return NULL;
  441. cache = of_find_next_cache_node(np);
  442. of_node_put(np);
  443. return cache;
  444. }
  445. /* Activate a secondary processor. */
  446. void __devinit start_secondary(void *unused)
  447. {
  448. unsigned int cpu = smp_processor_id();
  449. struct device_node *l2_cache;
  450. int i, base;
  451. atomic_inc(&init_mm.mm_count);
  452. current->active_mm = &init_mm;
  453. smp_store_cpu_info(cpu);
  454. set_dec(tb_ticks_per_jiffy);
  455. preempt_disable();
  456. cpu_callin_map[cpu] = 1;
  457. if (smp_ops->setup_cpu)
  458. smp_ops->setup_cpu(cpu);
  459. if (smp_ops->take_timebase)
  460. smp_ops->take_timebase();
  461. secondary_cpu_time_init();
  462. #ifdef CONFIG_PPC64
  463. if (system_state == SYSTEM_RUNNING)
  464. vdso_data->processorCount++;
  465. #endif
  466. ipi_call_lock();
  467. notify_cpu_starting(cpu);
  468. set_cpu_online(cpu, true);
  469. /* Update sibling maps */
  470. base = cpu_first_thread_sibling(cpu);
  471. for (i = 0; i < threads_per_core; i++) {
  472. if (cpu_is_offline(base + i))
  473. continue;
  474. cpumask_set_cpu(cpu, cpu_sibling_mask(base + i));
  475. cpumask_set_cpu(base + i, cpu_sibling_mask(cpu));
  476. /* cpu_core_map should be a superset of
  477. * cpu_sibling_map even if we don't have cache
  478. * information, so update the former here, too.
  479. */
  480. cpumask_set_cpu(cpu, cpu_core_mask(base + i));
  481. cpumask_set_cpu(base + i, cpu_core_mask(cpu));
  482. }
  483. l2_cache = cpu_to_l2cache(cpu);
  484. for_each_online_cpu(i) {
  485. struct device_node *np = cpu_to_l2cache(i);
  486. if (!np)
  487. continue;
  488. if (np == l2_cache) {
  489. cpumask_set_cpu(cpu, cpu_core_mask(i));
  490. cpumask_set_cpu(i, cpu_core_mask(cpu));
  491. }
  492. of_node_put(np);
  493. }
  494. of_node_put(l2_cache);
  495. ipi_call_unlock();
  496. local_irq_enable();
  497. cpu_idle();
  498. BUG();
  499. }
  500. int setup_profiling_timer(unsigned int multiplier)
  501. {
  502. return 0;
  503. }
  504. void __init smp_cpus_done(unsigned int max_cpus)
  505. {
  506. cpumask_var_t old_mask;
  507. /* We want the setup_cpu() here to be called from CPU 0, but our
  508. * init thread may have been "borrowed" by another CPU in the meantime
  509. * se we pin us down to CPU 0 for a short while
  510. */
  511. alloc_cpumask_var(&old_mask, GFP_NOWAIT);
  512. cpumask_copy(old_mask, &current->cpus_allowed);
  513. set_cpus_allowed_ptr(current, cpumask_of(boot_cpuid));
  514. if (smp_ops && smp_ops->setup_cpu)
  515. smp_ops->setup_cpu(boot_cpuid);
  516. set_cpus_allowed_ptr(current, old_mask);
  517. free_cpumask_var(old_mask);
  518. if (smp_ops && smp_ops->bringup_done)
  519. smp_ops->bringup_done();
  520. dump_numa_cpu_topology();
  521. }
  522. int arch_sd_sibling_asym_packing(void)
  523. {
  524. if (cpu_has_feature(CPU_FTR_ASYM_SMT)) {
  525. printk_once(KERN_INFO "Enabling Asymmetric SMT scheduling\n");
  526. return SD_ASYM_PACKING;
  527. }
  528. return 0;
  529. }
  530. #ifdef CONFIG_HOTPLUG_CPU
  531. int __cpu_disable(void)
  532. {
  533. struct device_node *l2_cache;
  534. int cpu = smp_processor_id();
  535. int base, i;
  536. int err;
  537. if (!smp_ops->cpu_disable)
  538. return -ENOSYS;
  539. err = smp_ops->cpu_disable();
  540. if (err)
  541. return err;
  542. /* Update sibling maps */
  543. base = cpu_first_thread_sibling(cpu);
  544. for (i = 0; i < threads_per_core; i++) {
  545. cpumask_clear_cpu(cpu, cpu_sibling_mask(base + i));
  546. cpumask_clear_cpu(base + i, cpu_sibling_mask(cpu));
  547. cpumask_clear_cpu(cpu, cpu_core_mask(base + i));
  548. cpumask_clear_cpu(base + i, cpu_core_mask(cpu));
  549. }
  550. l2_cache = cpu_to_l2cache(cpu);
  551. for_each_present_cpu(i) {
  552. struct device_node *np = cpu_to_l2cache(i);
  553. if (!np)
  554. continue;
  555. if (np == l2_cache) {
  556. cpumask_clear_cpu(cpu, cpu_core_mask(i));
  557. cpumask_clear_cpu(i, cpu_core_mask(cpu));
  558. }
  559. of_node_put(np);
  560. }
  561. of_node_put(l2_cache);
  562. return 0;
  563. }
  564. void __cpu_die(unsigned int cpu)
  565. {
  566. if (smp_ops->cpu_die)
  567. smp_ops->cpu_die(cpu);
  568. }
  569. static DEFINE_MUTEX(powerpc_cpu_hotplug_driver_mutex);
  570. void cpu_hotplug_driver_lock()
  571. {
  572. mutex_lock(&powerpc_cpu_hotplug_driver_mutex);
  573. }
  574. void cpu_hotplug_driver_unlock()
  575. {
  576. mutex_unlock(&powerpc_cpu_hotplug_driver_mutex);
  577. }
  578. void cpu_die(void)
  579. {
  580. if (ppc_md.cpu_die)
  581. ppc_md.cpu_die();
  582. /* If we return, we re-enter start_secondary */
  583. start_secondary_resume();
  584. }
  585. #endif