smp.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright IBM Corp. 1999, 2012
  3. * Author(s): Denis Joseph Barrow,
  4. * Martin Schwidefsky <schwidefsky@de.ibm.com>,
  5. * Heiko Carstens <heiko.carstens@de.ibm.com>,
  6. */
  7. #ifndef __ASM_SMP_H
  8. #define __ASM_SMP_H
  9. #include <asm/sigp.h>
  10. #ifdef CONFIG_SMP
  11. #include <asm/lowcore.h>
  12. #define raw_smp_processor_id() (S390_lowcore.cpu_nr)
  13. extern struct mutex smp_cpu_state_mutex;
  14. extern int __cpu_up(unsigned int cpu, struct task_struct *tidle);
  15. extern void arch_send_call_function_single_ipi(int cpu);
  16. extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
  17. extern void smp_call_online_cpu(void (*func)(void *), void *);
  18. extern void smp_call_ipl_cpu(void (*func)(void *), void *);
  19. extern int smp_find_processor_id(u16 address);
  20. extern int smp_store_status(int cpu);
  21. extern int smp_vcpu_scheduled(int cpu);
  22. extern void smp_yield_cpu(int cpu);
  23. extern void smp_yield(void);
  24. extern void smp_cpu_set_polarization(int cpu, int val);
  25. extern int smp_cpu_get_polarization(int cpu);
  26. extern void smp_fill_possible_mask(void);
  27. #else /* CONFIG_SMP */
  28. static inline void smp_call_ipl_cpu(void (*func)(void *), void *data)
  29. {
  30. func(data);
  31. }
  32. static inline void smp_call_online_cpu(void (*func)(void *), void *data)
  33. {
  34. func(data);
  35. }
  36. static inline int smp_find_processor_id(u16 address) { return 0; }
  37. static inline int smp_store_status(int cpu) { return 0; }
  38. static inline int smp_vcpu_scheduled(int cpu) { return 1; }
  39. static inline void smp_yield_cpu(int cpu) { }
  40. static inline void smp_yield(void) { }
  41. static inline void smp_fill_possible_mask(void) { }
  42. #endif /* CONFIG_SMP */
  43. static inline void smp_stop_cpu(void)
  44. {
  45. u16 pcpu = stap();
  46. for (;;) {
  47. __pcpu_sigp(pcpu, SIGP_STOP, 0, NULL);
  48. cpu_relax();
  49. }
  50. }
  51. #ifdef CONFIG_HOTPLUG_CPU
  52. extern int smp_rescan_cpus(void);
  53. extern void __noreturn cpu_die(void);
  54. extern void __cpu_die(unsigned int cpu);
  55. extern int __cpu_disable(void);
  56. #else
  57. static inline int smp_rescan_cpus(void) { return 0; }
  58. static inline void cpu_die(void) { }
  59. #endif
  60. #endif /* __ASM_SMP_H */