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