topology.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #ifndef _ASM_S390_TOPOLOGY_H
  2. #define _ASM_S390_TOPOLOGY_H
  3. #include <linux/cpumask.h>
  4. #include <asm/numa.h>
  5. struct sysinfo_15_1_x;
  6. struct cpu;
  7. #ifdef CONFIG_SCHED_TOPOLOGY
  8. struct cpu_topology_s390 {
  9. unsigned short thread_id;
  10. unsigned short core_id;
  11. unsigned short socket_id;
  12. unsigned short book_id;
  13. unsigned short drawer_id;
  14. unsigned short node_id;
  15. cpumask_t thread_mask;
  16. cpumask_t core_mask;
  17. cpumask_t book_mask;
  18. cpumask_t drawer_mask;
  19. };
  20. DECLARE_PER_CPU(struct cpu_topology_s390, cpu_topology);
  21. #define topology_physical_package_id(cpu) (per_cpu(cpu_topology, cpu).socket_id)
  22. #define topology_thread_id(cpu) (per_cpu(cpu_topology, cpu).thread_id)
  23. #define topology_sibling_cpumask(cpu) \
  24. (&per_cpu(cpu_topology, cpu).thread_mask)
  25. #define topology_core_id(cpu) (per_cpu(cpu_topology, cpu).core_id)
  26. #define topology_core_cpumask(cpu) (&per_cpu(cpu_topology, cpu).core_mask)
  27. #define topology_book_id(cpu) (per_cpu(cpu_topology, cpu).book_id)
  28. #define topology_book_cpumask(cpu) (&per_cpu(cpu_topology, cpu).book_mask)
  29. #define topology_drawer_id(cpu) (per_cpu(cpu_topology, cpu).drawer_id)
  30. #define topology_drawer_cpumask(cpu) (&per_cpu(cpu_topology, cpu).drawer_mask)
  31. #define mc_capable() 1
  32. int topology_cpu_init(struct cpu *);
  33. int topology_set_cpu_management(int fc);
  34. void topology_schedule_update(void);
  35. void store_topology(struct sysinfo_15_1_x *info);
  36. void topology_expect_change(void);
  37. const struct cpumask *cpu_coregroup_mask(int cpu);
  38. #else /* CONFIG_SCHED_TOPOLOGY */
  39. static inline void topology_schedule_update(void) { }
  40. static inline int topology_cpu_init(struct cpu *cpu) { return 0; }
  41. static inline void topology_expect_change(void) { }
  42. #endif /* CONFIG_SCHED_TOPOLOGY */
  43. #define POLARIZATION_UNKNOWN (-1)
  44. #define POLARIZATION_HRZ (0)
  45. #define POLARIZATION_VL (1)
  46. #define POLARIZATION_VM (2)
  47. #define POLARIZATION_VH (3)
  48. #define SD_BOOK_INIT SD_CPU_INIT
  49. #ifdef CONFIG_NUMA
  50. #define cpu_to_node cpu_to_node
  51. static inline int cpu_to_node(int cpu)
  52. {
  53. return per_cpu(cpu_topology, cpu).node_id;
  54. }
  55. /* Returns a pointer to the cpumask of CPUs on node 'node'. */
  56. #define cpumask_of_node cpumask_of_node
  57. static inline const struct cpumask *cpumask_of_node(int node)
  58. {
  59. return &node_to_cpumask_map[node];
  60. }
  61. /*
  62. * Returns the number of the node containing node 'node'. This
  63. * architecture is flat, so it is a pretty simple function!
  64. */
  65. #define parent_node(node) (node)
  66. #define pcibus_to_node(bus) __pcibus_to_node(bus)
  67. #define node_distance(a, b) __node_distance(a, b)
  68. #else /* !CONFIG_NUMA */
  69. #define numa_node_id numa_node_id
  70. static inline int numa_node_id(void)
  71. {
  72. return 0;
  73. }
  74. #endif /* CONFIG_NUMA */
  75. #include <asm-generic/topology.h>
  76. #endif /* _ASM_S390_TOPOLOGY_H */