smp.h 2.1 KB

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