smp.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 unsigned int smp_cpu_mt_shift;
  15. extern unsigned int smp_cpu_mtid;
  16. extern int __cpu_up(unsigned int cpu, struct task_struct *tidle);
  17. extern void arch_send_call_function_single_ipi(int cpu);
  18. extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
  19. extern void smp_call_online_cpu(void (*func)(void *), void *);
  20. extern void smp_call_ipl_cpu(void (*func)(void *), void *);
  21. extern int smp_find_processor_id(u16 address);
  22. extern int smp_store_status(int cpu);
  23. extern int smp_vcpu_scheduled(int cpu);
  24. extern void smp_yield_cpu(int cpu);
  25. extern void smp_cpu_set_polarization(int cpu, int val);
  26. extern int smp_cpu_get_polarization(int cpu);
  27. extern void smp_fill_possible_mask(void);
  28. #else /* CONFIG_SMP */
  29. #define smp_cpu_mtid 0
  30. static inline void smp_call_ipl_cpu(void (*func)(void *), void *data)
  31. {
  32. func(data);
  33. }
  34. static inline void smp_call_online_cpu(void (*func)(void *), void *data)
  35. {
  36. func(data);
  37. }
  38. static inline int smp_find_processor_id(u16 address) { return 0; }
  39. static inline int smp_store_status(int cpu) { return 0; }
  40. static inline int smp_vcpu_scheduled(int cpu) { return 1; }
  41. static inline void smp_yield_cpu(int cpu) { }
  42. static inline void smp_fill_possible_mask(void) { }
  43. #endif /* CONFIG_SMP */
  44. static inline void smp_stop_cpu(void)
  45. {
  46. u16 pcpu = stap();
  47. for (;;) {
  48. __pcpu_sigp(pcpu, SIGP_STOP, 0, NULL);
  49. cpu_relax();
  50. }
  51. }
  52. #ifdef CONFIG_HOTPLUG_CPU
  53. extern int smp_rescan_cpus(void);
  54. extern void __noreturn cpu_die(void);
  55. extern void __cpu_die(unsigned int cpu);
  56. extern int __cpu_disable(void);
  57. #else
  58. static inline int smp_rescan_cpus(void) { return 0; }
  59. static inline void cpu_die(void) { }
  60. #endif
  61. #endif /* __ASM_SMP_H */