smp.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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_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. #define smp_vcpu_scheduled (1)
  54. #endif /* CONFIG_SMP */
  55. #ifdef CONFIG_HOTPLUG_CPU
  56. extern int smp_rescan_cpus(void);
  57. extern void __noreturn cpu_die(void);
  58. #else
  59. static inline int smp_rescan_cpus(void) { return 0; }
  60. static inline void cpu_die(void) { }
  61. #endif
  62. #endif /* __ASM_SMP_H */