xref: /openbmc/linux/arch/s390/include/asm/topology.h (revision 92a2c6b2)
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_thread_cpumask(cpu)	  (&per_cpu(cpu_topology, cpu).thread_mask)
26 #define topology_core_id(cpu)		  (per_cpu(cpu_topology, cpu).core_id)
27 #define topology_core_cpumask(cpu)	  (&per_cpu(cpu_topology, cpu).core_mask)
28 #define topology_book_id(cpu)		  (per_cpu(cpu_topology, cpu).book_id)
29 #define topology_book_cpumask(cpu)	  (&per_cpu(cpu_topology, cpu).book_mask)
30 
31 #define mc_capable() 1
32 
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 
40 #else /* CONFIG_SCHED_BOOK */
41 
42 static inline void topology_schedule_update(void) { }
43 static inline int topology_cpu_init(struct cpu *cpu) { return 0; }
44 static inline void topology_expect_change(void) { }
45 
46 #endif /* CONFIG_SCHED_BOOK */
47 
48 #define POLARIZATION_UNKNOWN	(-1)
49 #define POLARIZATION_HRZ	(0)
50 #define POLARIZATION_VL		(1)
51 #define POLARIZATION_VM		(2)
52 #define POLARIZATION_VH		(3)
53 
54 #include <asm-generic/topology.h>
55 
56 #endif /* _ASM_S390_TOPOLOGY_H */
57