malta_smp.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * Malta Platform-specific hooks for SMP operation
  3. */
  4. #include <linux/kernel.h>
  5. #include <linux/sched.h>
  6. #include <linux/cpumask.h>
  7. #include <linux/interrupt.h>
  8. #include <asm/atomic.h>
  9. #include <asm/cpu.h>
  10. #include <asm/processor.h>
  11. #include <asm/system.h>
  12. #include <asm/hardirq.h>
  13. #include <asm/mmu_context.h>
  14. #include <asm/smp.h>
  15. #ifdef CONFIG_MIPS_MT_SMTC
  16. #include <asm/smtc_ipi.h>
  17. #endif /* CONFIG_MIPS_MT_SMTC */
  18. /* VPE/SMP Prototype implements platform interfaces directly */
  19. #if !defined(CONFIG_MIPS_MT_SMP)
  20. /*
  21. * Cause the specified action to be performed on a targeted "CPU"
  22. */
  23. void core_send_ipi(int cpu, unsigned int action)
  24. {
  25. /* "CPU" may be TC of same VPE, VPE of same CPU, or different CPU */
  26. #ifdef CONFIG_MIPS_MT_SMTC
  27. smtc_send_ipi(cpu, LINUX_SMP_IPI, action);
  28. #endif /* CONFIG_MIPS_MT_SMTC */
  29. }
  30. /*
  31. * Platform "CPU" startup hook
  32. */
  33. void prom_boot_secondary(int cpu, struct task_struct *idle)
  34. {
  35. #ifdef CONFIG_MIPS_MT_SMTC
  36. smtc_boot_secondary(cpu, idle);
  37. #endif /* CONFIG_MIPS_MT_SMTC */
  38. }
  39. /*
  40. * Post-config but pre-boot cleanup entry point
  41. */
  42. void prom_init_secondary(void)
  43. {
  44. #ifdef CONFIG_MIPS_MT_SMTC
  45. void smtc_init_secondary(void);
  46. int myvpe;
  47. /* Don't enable Malta I/O interrupts (IP2) for secondary VPEs */
  48. myvpe = read_c0_tcbind() & TCBIND_CURVPE;
  49. if (myvpe != 0) {
  50. /* Ideally, this should be done only once per VPE, but... */
  51. clear_c0_status(STATUSF_IP2);
  52. set_c0_status(STATUSF_IP0 | STATUSF_IP1 | STATUSF_IP3
  53. | STATUSF_IP4 | STATUSF_IP5 | STATUSF_IP6
  54. | STATUSF_IP7);
  55. }
  56. smtc_init_secondary();
  57. #endif /* CONFIG_MIPS_MT_SMTC */
  58. }
  59. /*
  60. * Platform SMP pre-initialization
  61. *
  62. * As noted above, we can assume a single CPU for now
  63. * but it may be multithreaded.
  64. */
  65. void plat_smp_setup(void)
  66. {
  67. if (read_c0_config3() & (1<<2))
  68. mipsmt_build_cpu_map(0);
  69. }
  70. void __init plat_prepare_cpus(unsigned int max_cpus)
  71. {
  72. if (read_c0_config3() & (1<<2))
  73. mipsmt_prepare_cpus();
  74. }
  75. /*
  76. * SMP initialization finalization entry point
  77. */
  78. void prom_smp_finish(void)
  79. {
  80. #ifdef CONFIG_MIPS_MT_SMTC
  81. smtc_smp_finish();
  82. #endif /* CONFIG_MIPS_MT_SMTC */
  83. }
  84. /*
  85. * Hook for after all CPUs are online
  86. */
  87. void prom_cpus_done(void)
  88. {
  89. }
  90. #endif /* CONFIG_MIPS32R2_MT_SMP */