smp.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * SMP support for iSeries machines.
  3. *
  4. * Dave Engebretsen, Peter Bergner, and
  5. * Mike Corrigan {engebret|bergner|mikec}@us.ibm.com
  6. *
  7. * Plus various changes from other IBM teams...
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version
  12. * 2 of the License, or (at your option) any later version.
  13. */
  14. #undef DEBUG
  15. #include <linux/kernel.h>
  16. #include <linux/module.h>
  17. #include <linux/sched.h>
  18. #include <linux/smp.h>
  19. #include <linux/interrupt.h>
  20. #include <linux/kernel_stat.h>
  21. #include <linux/delay.h>
  22. #include <linux/init.h>
  23. #include <linux/spinlock.h>
  24. #include <linux/cache.h>
  25. #include <linux/err.h>
  26. #include <linux/sysdev.h>
  27. #include <linux/cpu.h>
  28. #include <asm/ptrace.h>
  29. #include <asm/atomic.h>
  30. #include <asm/irq.h>
  31. #include <asm/page.h>
  32. #include <asm/pgtable.h>
  33. #include <asm/io.h>
  34. #include <asm/smp.h>
  35. #include <asm/paca.h>
  36. #include <asm/iseries/hv_call.h>
  37. #include <asm/time.h>
  38. #include <asm/machdep.h>
  39. #include <asm/cputable.h>
  40. #include <asm/system.h>
  41. static void smp_iSeries_cause_ipi(int cpu, unsigned long data)
  42. {
  43. HvCall_sendIPI(&(paca[cpu]));
  44. }
  45. static int smp_iSeries_probe(void)
  46. {
  47. return cpumask_weight(cpu_possible_mask);
  48. }
  49. static int smp_iSeries_kick_cpu(int nr)
  50. {
  51. BUG_ON((nr < 0) || (nr >= NR_CPUS));
  52. /* Verify that our partition has a processor nr */
  53. if (lppaca_of(nr).dyn_proc_status >= 2)
  54. return -ENOENT;
  55. /* The processor is currently spinning, waiting
  56. * for the cpu_start field to become non-zero
  57. * After we set cpu_start, the processor will
  58. * continue on to secondary_start in iSeries_head.S
  59. */
  60. paca[nr].cpu_start = 1;
  61. return 0;
  62. }
  63. static void __devinit smp_iSeries_setup_cpu(int nr)
  64. {
  65. }
  66. static struct smp_ops_t iSeries_smp_ops = {
  67. .message_pass = smp_muxed_ipi_message_pass,
  68. .cause_ipi = smp_iSeries_cause_ipi,
  69. .probe = smp_iSeries_probe,
  70. .kick_cpu = smp_iSeries_kick_cpu,
  71. .setup_cpu = smp_iSeries_setup_cpu,
  72. };
  73. /* This is called very early. */
  74. void __init smp_init_iSeries(void)
  75. {
  76. smp_ops = &iSeries_smp_ops;
  77. }