smp.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * include/asm-s390/smp.h
  3. *
  4. * S390 version
  5. * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
  6. * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
  7. * Martin Schwidefsky (schwidefsky@de.ibm.com)
  8. * Heiko Carstens (heiko.carstens@de.ibm.com)
  9. */
  10. #ifndef __ASM_SMP_H
  11. #define __ASM_SMP_H
  12. #include <linux/threads.h>
  13. #include <linux/cpumask.h>
  14. #include <linux/bitops.h>
  15. #if defined(__KERNEL__) && defined(CONFIG_SMP) && !defined(__ASSEMBLY__)
  16. #include <asm/lowcore.h>
  17. #include <asm/sigp.h>
  18. #include <asm/ptrace.h>
  19. #include <asm/system.h>
  20. /*
  21. s390 specific smp.c headers
  22. */
  23. typedef struct
  24. {
  25. int intresting;
  26. sigp_ccode ccode;
  27. __u32 status;
  28. __u16 cpu;
  29. } sigp_info;
  30. extern void machine_restart_smp(char *);
  31. extern void machine_halt_smp(void);
  32. extern void machine_power_off_smp(void);
  33. #define NO_PROC_ID 0xFF /* No processor magic marker */
  34. /*
  35. * This magic constant controls our willingness to transfer
  36. * a process across CPUs. Such a transfer incurs misses on the L1
  37. * cache, and on a P6 or P5 with multiple L2 caches L2 hits. My
  38. * gut feeling is this will vary by board in value. For a board
  39. * with separate L2 cache it probably depends also on the RSS, and
  40. * for a board with shared L2 cache it ought to decay fast as other
  41. * processes are run.
  42. */
  43. #define PROC_CHANGE_PENALTY 20 /* Schedule penalty */
  44. #define raw_smp_processor_id() (S390_lowcore.cpu_nr)
  45. /*
  46. * returns 1 if cpu is in stopped/check stopped state or not operational
  47. * returns 0 otherwise
  48. */
  49. static inline int
  50. smp_cpu_not_running(int cpu)
  51. {
  52. __u32 status;
  53. switch (signal_processor_ps(&status, 0, cpu, sigp_sense)) {
  54. case sigp_order_code_accepted:
  55. case sigp_status_stored:
  56. /* Check for stopped and check stop state */
  57. if (status & 0x50)
  58. return 1;
  59. break;
  60. case sigp_not_operational:
  61. return 1;
  62. default:
  63. break;
  64. }
  65. return 0;
  66. }
  67. #define cpu_logical_map(cpu) (cpu)
  68. extern int __cpu_disable (void);
  69. extern void __cpu_die (unsigned int cpu);
  70. extern void cpu_die (void) __attribute__ ((noreturn));
  71. extern int __cpu_up (unsigned int cpu);
  72. extern struct mutex smp_cpu_state_mutex;
  73. extern int smp_cpu_polarization[];
  74. extern void arch_send_call_function_single_ipi(int cpu);
  75. extern void arch_send_call_function_ipi(cpumask_t mask);
  76. #endif
  77. #ifndef CONFIG_SMP
  78. #define hard_smp_processor_id() 0
  79. #define smp_cpu_not_running(cpu) 1
  80. #endif
  81. #ifdef CONFIG_HOTPLUG_CPU
  82. extern int smp_rescan_cpus(void);
  83. #else
  84. static inline int smp_rescan_cpus(void) { return 0; }
  85. #endif
  86. extern union save_area *zfcpdump_save_areas[NR_CPUS + 1];
  87. #endif