topology.h 2.7 KB

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