smp.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 int smp_cpu_polarization[];
  21. extern void arch_send_call_function_single_ipi(int cpu);
  22. extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
  23. extern struct save_area *zfcpdump_save_areas[NR_CPUS + 1];
  24. extern void smp_switch_to_ipl_cpu(void (*func)(void *), void *);
  25. extern void smp_switch_to_cpu(void (*)(void *), void *, unsigned long sp,
  26. int from, int to);
  27. extern void smp_restart_with_online_cpu(void);
  28. extern void smp_restart_cpu(void);
  29. /*
  30. * returns 1 if (virtual) cpu is scheduled
  31. * returns 0 otherwise
  32. */
  33. static inline int smp_vcpu_scheduled(int cpu)
  34. {
  35. u32 status;
  36. switch (sigp_ps(&status, 0, cpu, sigp_sense_running)) {
  37. case sigp_status_stored:
  38. /* Check for running status */
  39. if (status & 0x400)
  40. return 0;
  41. break;
  42. case sigp_not_operational:
  43. return 0;
  44. default:
  45. break;
  46. }
  47. return 1;
  48. }
  49. #else /* CONFIG_SMP */
  50. static inline void smp_switch_to_ipl_cpu(void (*func)(void *), void *data)
  51. {
  52. func(data);
  53. }
  54. static inline void smp_restart_with_online_cpu(void)
  55. {
  56. }
  57. #define smp_vcpu_scheduled (1)
  58. #endif /* CONFIG_SMP */
  59. #ifdef CONFIG_HOTPLUG_CPU
  60. extern int smp_rescan_cpus(void);
  61. extern void __noreturn cpu_die(void);
  62. #else
  63. static inline int smp_rescan_cpus(void) { return 0; }
  64. static inline void cpu_die(void) { }
  65. #endif
  66. #endif /* __ASM_SMP_H */