smp.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Copyright IBM Corp. 1999,2009
  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. #ifdef CONFIG_SMP
  10. #include <asm/system.h>
  11. #include <asm/sigp.h>
  12. extern void machine_restart_smp(char *);
  13. extern void machine_halt_smp(void);
  14. extern void machine_power_off_smp(void);
  15. #define raw_smp_processor_id() (S390_lowcore.cpu_nr)
  16. extern int __cpu_disable (void);
  17. extern void __cpu_die (unsigned int cpu);
  18. extern int __cpu_up (unsigned int cpu);
  19. extern struct mutex smp_cpu_state_mutex;
  20. extern void arch_send_call_function_single_ipi(int cpu);
  21. extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
  22. extern struct save_area *zfcpdump_save_areas[NR_CPUS + 1];
  23. extern void smp_switch_to_ipl_cpu(void (*func)(void *), void *);
  24. extern void smp_switch_to_cpu(void (*)(void *), void *, unsigned long sp,
  25. int from, int to);
  26. extern void smp_restart_with_online_cpu(void);
  27. extern void smp_restart_cpu(void);
  28. /*
  29. * returns 1 if (virtual) cpu is scheduled
  30. * returns 0 otherwise
  31. */
  32. static inline int smp_vcpu_scheduled(int cpu)
  33. {
  34. u32 status;
  35. switch (sigp_ps(&status, 0, cpu, sigp_sense_running)) {
  36. case sigp_status_stored:
  37. /* Check for running status */
  38. if (status & 0x400)
  39. return 0;
  40. break;
  41. case sigp_not_operational:
  42. return 0;
  43. default:
  44. break;
  45. }
  46. return 1;
  47. }
  48. #else /* CONFIG_SMP */
  49. static inline void smp_switch_to_ipl_cpu(void (*func)(void *), void *data)
  50. {
  51. func(data);
  52. }
  53. static inline void smp_restart_with_online_cpu(void)
  54. {
  55. }
  56. #define smp_vcpu_scheduled (1)
  57. #endif /* CONFIG_SMP */
  58. #ifdef CONFIG_HOTPLUG_CPU
  59. extern int smp_rescan_cpus(void);
  60. extern void __noreturn cpu_die(void);
  61. #else
  62. static inline int smp_rescan_cpus(void) { return 0; }
  63. static inline void cpu_die(void) { }
  64. #endif
  65. #endif /* __ASM_SMP_H */