xref: /openbmc/linux/arch/s390/include/asm/topology.h (revision bbde9fc1824aab58bc78c084163007dd6c03fe5b)
1 #ifndef _ASM_S390_TOPOLOGY_H
2 #define _ASM_S390_TOPOLOGY_H
3 
4 #include <linux/cpumask.h>
5 
6 struct sysinfo_15_1_x;
7 struct cpu;
8 
9 #ifdef CONFIG_SCHED_BOOK
10 
11 struct cpu_topology_s390 {
12 	unsigned short thread_id;
13 	unsigned short core_id;
14 	unsigned short socket_id;
15 	unsigned short book_id;
16 	cpumask_t thread_mask;
17 	cpumask_t core_mask;
18 	cpumask_t book_mask;
19 };
20 
21 DECLARE_PER_CPU(struct cpu_topology_s390, cpu_topology);
22 
23 #define topology_physical_package_id(cpu) (per_cpu(cpu_topology, cpu).socket_id)
24 #define topology_thread_id(cpu)		  (per_cpu(cpu_topology, cpu).thread_id)
25 #define topology_sibling_cpumask(cpu) \
26 		(&per_cpu(cpu_topology, cpu).thread_mask)
27 #define topology_core_id(cpu)		  (per_cpu(cpu_topology, cpu).core_id)
28 #define topology_core_cpumask(cpu)	  (&per_cpu(cpu_topology, cpu).core_mask)
29 #define topology_book_id(cpu)		  (per_cpu(cpu_topology, cpu).book_id)
30 #define topology_book_cpumask(cpu)	  (&per_cpu(cpu_topology, cpu).book_mask)
31 
32 #define mc_capable() 1
33 
34 int topology_cpu_init(struct cpu *);
35 int topology_set_cpu_management(int fc);
36 void topology_schedule_update(void);
37 void store_topology(struct sysinfo_15_1_x *info);
38 void topology_expect_change(void);
39 const struct cpumask *cpu_coregroup_mask(int cpu);
40 
41 #else /* CONFIG_SCHED_BOOK */
42 
43 static inline void topology_schedule_update(void) { }
44 static inline int topology_cpu_init(struct cpu *cpu) { return 0; }
45 static inline void topology_expect_change(void) { }
46 
47 #endif /* CONFIG_SCHED_BOOK */
48 
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 
55 #include <asm-generic/topology.h>
56 
57 #endif /* _ASM_S390_TOPOLOGY_H */
58