]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
1da177e4 LT |
2 | #ifndef _ASM_S390_TOPOLOGY_H |
3 | #define _ASM_S390_TOPOLOGY_H | |
4 | ||
dbd70fb4 | 5 | #include <linux/cpumask.h> |
3a368f74 | 6 | #include <asm/numa.h> |
dbd70fb4 | 7 | |
78609132 | 8 | struct sysinfo_15_1_x; |
83a24e32 HC |
9 | struct cpu; |
10 | ||
9236b4dd | 11 | #ifdef CONFIG_SCHED_TOPOLOGY |
83a24e32 | 12 | |
d1e57508 | 13 | struct cpu_topology_s390 { |
10ad34bc | 14 | unsigned short thread_id; |
d1e57508 HC |
15 | unsigned short core_id; |
16 | unsigned short socket_id; | |
17 | unsigned short book_id; | |
adac0f1e | 18 | unsigned short drawer_id; |
3a368f74 | 19 | unsigned short node_id; |
10ad34bc | 20 | cpumask_t thread_mask; |
d1e57508 HC |
21 | cpumask_t core_mask; |
22 | cpumask_t book_mask; | |
adac0f1e | 23 | cpumask_t drawer_mask; |
d1e57508 HC |
24 | }; |
25 | ||
30fc4ca2 | 26 | extern struct cpu_topology_s390 cpu_topology[NR_CPUS]; |
8c910580 | 27 | extern cpumask_t cpus_with_topology; |
30fc4ca2 HC |
28 | |
29 | #define topology_physical_package_id(cpu) (cpu_topology[cpu].socket_id) | |
30 | #define topology_thread_id(cpu) (cpu_topology[cpu].thread_id) | |
31 | #define topology_sibling_cpumask(cpu) (&cpu_topology[cpu].thread_mask) | |
32 | #define topology_core_id(cpu) (cpu_topology[cpu].core_id) | |
33 | #define topology_core_cpumask(cpu) (&cpu_topology[cpu].core_mask) | |
34 | #define topology_book_id(cpu) (cpu_topology[cpu].book_id) | |
35 | #define topology_book_cpumask(cpu) (&cpu_topology[cpu].book_mask) | |
36 | #define topology_drawer_id(cpu) (cpu_topology[cpu].drawer_id) | |
37 | #define topology_drawer_cpumask(cpu) (&cpu_topology[cpu].drawer_mask) | |
658e5ce7 | 38 | |
d1e57508 | 39 | #define mc_capable() 1 |
d00aa4e7 | 40 | |
8c910580 | 41 | void topology_init_early(void); |
83a24e32 | 42 | int topology_cpu_init(struct cpu *); |
c10fde0d HC |
43 | int topology_set_cpu_management(int fc); |
44 | void topology_schedule_update(void); | |
96f4a70d | 45 | void store_topology(struct sysinfo_15_1_x *info); |
d68bddb7 | 46 | void topology_expect_change(void); |
2dfd7476 | 47 | const struct cpumask *cpu_coregroup_mask(int cpu); |
c10fde0d | 48 | |
9236b4dd | 49 | #else /* CONFIG_SCHED_TOPOLOGY */ |
83a24e32 | 50 | |
8c910580 | 51 | static inline void topology_init_early(void) { } |
83a24e32 HC |
52 | static inline void topology_schedule_update(void) { } |
53 | static inline int topology_cpu_init(struct cpu *cpu) { return 0; } | |
d68bddb7 | 54 | static inline void topology_expect_change(void) { } |
83a24e32 | 55 | |
9236b4dd | 56 | #endif /* CONFIG_SCHED_TOPOLOGY */ |
83a24e32 HC |
57 | |
58 | #define POLARIZATION_UNKNOWN (-1) | |
c10fde0d HC |
59 | #define POLARIZATION_HRZ (0) |
60 | #define POLARIZATION_VL (1) | |
61 | #define POLARIZATION_VM (2) | |
62 | #define POLARIZATION_VH (3) | |
63 | ||
3a368f74 PH |
64 | #define SD_BOOK_INIT SD_CPU_INIT |
65 | ||
66 | #ifdef CONFIG_NUMA | |
67 | ||
68 | #define cpu_to_node cpu_to_node | |
69 | static inline int cpu_to_node(int cpu) | |
70 | { | |
30fc4ca2 | 71 | return cpu_topology[cpu].node_id; |
3a368f74 PH |
72 | } |
73 | ||
74 | /* Returns a pointer to the cpumask of CPUs on node 'node'. */ | |
75 | #define cpumask_of_node cpumask_of_node | |
76 | static inline const struct cpumask *cpumask_of_node(int node) | |
77 | { | |
22be9cd9 | 78 | return &node_to_cpumask_map[node]; |
3a368f74 PH |
79 | } |
80 | ||
3a368f74 PH |
81 | #define pcibus_to_node(bus) __pcibus_to_node(bus) |
82 | ||
83 | #define node_distance(a, b) __node_distance(a, b) | |
84 | ||
85 | #else /* !CONFIG_NUMA */ | |
86 | ||
87 | #define numa_node_id numa_node_id | |
88 | static inline int numa_node_id(void) | |
89 | { | |
90 | return 0; | |
91 | } | |
92 | ||
93 | #endif /* CONFIG_NUMA */ | |
94 | ||
1da177e4 LT |
95 | #include <asm-generic/topology.h> |
96 | ||
97 | #endif /* _ASM_S390_TOPOLOGY_H */ |