Loading...
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_S390_TOPOLOGY_H
3#define _ASM_S390_TOPOLOGY_H
4
5#include <linux/cpumask.h>
6#include <asm/numa.h>
7
8struct sysinfo_15_1_x;
9struct cpu;
10
11#ifdef CONFIG_SCHED_TOPOLOGY
12
13struct 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 dedicated : 1;
20 int booted_cores;
21 cpumask_t thread_mask;
22 cpumask_t core_mask;
23 cpumask_t book_mask;
24 cpumask_t drawer_mask;
25};
26
27extern struct cpu_topology_s390 cpu_topology[NR_CPUS];
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)
38#define topology_cpu_dedicated(cpu) (cpu_topology[cpu].dedicated)
39#define topology_booted_cores(cpu) (cpu_topology[cpu].booted_cores)
40
41#define mc_capable() 1
42
43void topology_init_early(void);
44int topology_cpu_init(struct cpu *);
45int topology_set_cpu_management(int fc);
46void topology_schedule_update(void);
47void store_topology(struct sysinfo_15_1_x *info);
48void update_cpu_masks(void);
49void topology_expect_change(void);
50const struct cpumask *cpu_coregroup_mask(int cpu);
51
52#else /* CONFIG_SCHED_TOPOLOGY */
53
54static inline void topology_init_early(void) { }
55static inline void topology_schedule_update(void) { }
56static inline int topology_cpu_init(struct cpu *cpu) { return 0; }
57static inline int topology_cpu_dedicated(int cpu_nr) { return 0; }
58static inline int topology_booted_cores(int cpu_nr) { return 1; }
59static inline void update_cpu_masks(void) { }
60static inline void topology_expect_change(void) { }
61
62#endif /* CONFIG_SCHED_TOPOLOGY */
63
64#define POLARIZATION_UNKNOWN (-1)
65#define POLARIZATION_HRZ (0)
66#define POLARIZATION_VL (1)
67#define POLARIZATION_VM (2)
68#define POLARIZATION_VH (3)
69
70#define CPU_CAPACITY_HIGH SCHED_CAPACITY_SCALE
71#define CPU_CAPACITY_LOW (SCHED_CAPACITY_SCALE >> 3)
72
73#define SD_BOOK_INIT SD_CPU_INIT
74
75#ifdef CONFIG_NUMA
76
77#define cpu_to_node cpu_to_node
78static inline int cpu_to_node(int cpu)
79{
80 return 0;
81}
82
83/* Returns a pointer to the cpumask of CPUs on node 'node'. */
84#define cpumask_of_node cpumask_of_node
85static inline const struct cpumask *cpumask_of_node(int node)
86{
87 return cpu_possible_mask;
88}
89
90#define pcibus_to_node(bus) __pcibus_to_node(bus)
91
92#else /* !CONFIG_NUMA */
93
94#define numa_node_id numa_node_id
95static inline int numa_node_id(void)
96{
97 return 0;
98}
99
100#endif /* CONFIG_NUMA */
101
102#include <asm-generic/topology.h>
103
104#endif /* _ASM_S390_TOPOLOGY_H */
1#ifndef _ASM_S390_TOPOLOGY_H
2#define _ASM_S390_TOPOLOGY_H
3
4#include <linux/cpumask.h>
5
6struct sysinfo_15_1_x;
7struct cpu;
8
9#ifdef CONFIG_SCHED_BOOK
10
11struct cpu_topology_s390 {
12 unsigned short core_id;
13 unsigned short socket_id;
14 unsigned short book_id;
15 cpumask_t core_mask;
16 cpumask_t book_mask;
17};
18
19extern struct cpu_topology_s390 cpu_topology[NR_CPUS];
20
21#define topology_physical_package_id(cpu) (cpu_topology[cpu].socket_id)
22#define topology_core_id(cpu) (cpu_topology[cpu].core_id)
23#define topology_core_cpumask(cpu) (&cpu_topology[cpu].core_mask)
24#define topology_book_id(cpu) (cpu_topology[cpu].book_id)
25#define topology_book_cpumask(cpu) (&cpu_topology[cpu].book_mask)
26
27#define mc_capable() 1
28
29static inline const struct cpumask *cpu_coregroup_mask(int cpu)
30{
31 return &cpu_topology[cpu].core_mask;
32}
33
34static inline const struct cpumask *cpu_book_mask(int cpu)
35{
36 return &cpu_topology[cpu].book_mask;
37}
38
39int topology_cpu_init(struct cpu *);
40int topology_set_cpu_management(int fc);
41void topology_schedule_update(void);
42void store_topology(struct sysinfo_15_1_x *info);
43void topology_expect_change(void);
44
45#else /* CONFIG_SCHED_BOOK */
46
47static inline void topology_schedule_update(void) { }
48static inline int topology_cpu_init(struct cpu *cpu) { return 0; }
49static inline void topology_expect_change(void) { }
50
51#endif /* CONFIG_SCHED_BOOK */
52
53#define POLARIZATION_UNKNOWN (-1)
54#define POLARIZATION_HRZ (0)
55#define POLARIZATION_VL (1)
56#define POLARIZATION_VM (2)
57#define POLARIZATION_VH (3)
58
59#ifdef CONFIG_SCHED_BOOK
60void s390_init_cpu_topology(void);
61#else
62static inline void s390_init_cpu_topology(void)
63{
64};
65#endif
66
67#define SD_BOOK_INIT SD_CPU_INIT
68
69#include <asm-generic/topology.h>
70
71#endif /* _ASM_S390_TOPOLOGY_H */