topology.h 2.7 KB

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