smp.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * arch/arm/include/asm/smp.h
  4. *
  5. * Copyright (C) 2004-2005 ARM Ltd.
  6. */
  7. #ifndef __ASM_ARM_SMP_H
  8. #define __ASM_ARM_SMP_H
  9. #include <linux/threads.h>
  10. #include <linux/cpumask.h>
  11. #include <linux/thread_info.h>
  12. #ifndef CONFIG_SMP
  13. # error "<asm/smp.h> included in non-SMP build"
  14. #endif
  15. #define raw_smp_processor_id() (current_thread_info()->cpu)
  16. struct seq_file;
  17. /*
  18. * generate IPI list text
  19. */
  20. extern void show_ipi_list(struct seq_file *, int);
  21. /*
  22. * Called from C code, this handles an IPI.
  23. */
  24. void handle_IPI(int ipinr, struct pt_regs *regs);
  25. /*
  26. * Setup the set of possible CPUs (via set_cpu_possible)
  27. */
  28. extern void smp_init_cpus(void);
  29. /*
  30. * Register IPI interrupts with the arch SMP code
  31. */
  32. extern void set_smp_ipi_range(int ipi_base, int nr_ipi);
  33. /*
  34. * Called from platform specific assembly code, this is the
  35. * secondary CPU entry point.
  36. */
  37. asmlinkage void secondary_start_kernel(struct task_struct *task);
  38. /*
  39. * Initial data for bringing up a secondary CPU.
  40. */
  41. struct secondary_data {
  42. union {
  43. struct mpu_rgn_info *mpu_rgn_info;
  44. u64 pgdir;
  45. };
  46. unsigned long swapper_pg_dir;
  47. void *stack;
  48. struct task_struct *task;
  49. };
  50. extern struct secondary_data secondary_data;
  51. extern void secondary_startup(void);
  52. extern void secondary_startup_arm(void);
  53. extern int __cpu_disable(void);
  54. extern void __cpu_die(unsigned int cpu);
  55. extern void arch_send_call_function_single_ipi(int cpu);
  56. extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
  57. extern void arch_send_wakeup_ipi_mask(const struct cpumask *mask);
  58. extern int register_ipi_completion(struct completion *completion, int cpu);
  59. struct smp_operations {
  60. #ifdef CONFIG_SMP
  61. /*
  62. * Setup the set of possible CPUs (via set_cpu_possible)
  63. */
  64. void (*smp_init_cpus)(void);
  65. /*
  66. * Initialize cpu_possible map, and enable coherency
  67. */
  68. void (*smp_prepare_cpus)(unsigned int max_cpus);
  69. /*
  70. * Perform platform specific initialisation of the specified CPU.
  71. */
  72. void (*smp_secondary_init)(unsigned int cpu);
  73. /*
  74. * Boot a secondary CPU, and assign it the specified idle task.
  75. * This also gives us the initial stack to use for this CPU.
  76. */
  77. int (*smp_boot_secondary)(unsigned int cpu, struct task_struct *idle);
  78. #ifdef CONFIG_HOTPLUG_CPU
  79. int (*cpu_kill)(unsigned int cpu);
  80. void (*cpu_die)(unsigned int cpu);
  81. bool (*cpu_can_disable)(unsigned int cpu);
  82. int (*cpu_disable)(unsigned int cpu);
  83. #endif
  84. #endif
  85. };
  86. struct of_cpu_method {
  87. const char *method;
  88. const struct smp_operations *ops;
  89. };
  90. #define CPU_METHOD_OF_DECLARE(name, _method, _ops) \
  91. static const struct of_cpu_method __cpu_method_of_table_##name \
  92. __used __section("__cpu_method_of_table") \
  93. = { .method = _method, .ops = _ops }
  94. /*
  95. * set platform specific SMP operations
  96. */
  97. extern void smp_set_ops(const struct smp_operations *);
  98. #endif /* ifndef __ASM_ARM_SMP_H */