]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blame - arch/s390/include/asm/topology.h
Merge remote-tracking branch 'asoc/topic/pcm512x' into asoc-next
[mirror_ubuntu-focal-kernel.git] / arch / s390 / include / asm / topology.h
CommitLineData
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 8struct sysinfo_15_1_x;
83a24e32
HC
9struct cpu;
10
9236b4dd 11#ifdef CONFIG_SCHED_TOPOLOGY
83a24e32 12
d1e57508 13struct 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;
1887aa07 20 unsigned short dedicated : 1;
10ad34bc 21 cpumask_t thread_mask;
d1e57508
HC
22 cpumask_t core_mask;
23 cpumask_t book_mask;
adac0f1e 24 cpumask_t drawer_mask;
d1e57508
HC
25};
26
30fc4ca2 27extern struct cpu_topology_s390 cpu_topology[NR_CPUS];
8c910580 28extern cpumask_t cpus_with_topology;
30fc4ca2
HC
29
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)
1887aa07 39#define topology_cpu_dedicated(cpu) (cpu_topology[cpu].dedicated)
658e5ce7 40
d1e57508 41#define mc_capable() 1
d00aa4e7 42
8c910580 43void topology_init_early(void);
83a24e32 44int topology_cpu_init(struct cpu *);
c10fde0d
HC
45int topology_set_cpu_management(int fc);
46void topology_schedule_update(void);
96f4a70d 47void store_topology(struct sysinfo_15_1_x *info);
d68bddb7 48void topology_expect_change(void);
2dfd7476 49const struct cpumask *cpu_coregroup_mask(int cpu);
c10fde0d 50
9236b4dd 51#else /* CONFIG_SCHED_TOPOLOGY */
83a24e32 52
8c910580 53static inline void topology_init_early(void) { }
83a24e32
HC
54static inline void topology_schedule_update(void) { }
55static inline int topology_cpu_init(struct cpu *cpu) { return 0; }
38389ec8 56static inline int topology_cpu_dedicated(int cpu_nr) { return 0; }
d68bddb7 57static inline void topology_expect_change(void) { }
83a24e32 58
9236b4dd 59#endif /* CONFIG_SCHED_TOPOLOGY */
83a24e32
HC
60
61#define POLARIZATION_UNKNOWN (-1)
c10fde0d
HC
62#define POLARIZATION_HRZ (0)
63#define POLARIZATION_VL (1)
64#define POLARIZATION_VM (2)
65#define POLARIZATION_VH (3)
66
3a368f74
PH
67#define SD_BOOK_INIT SD_CPU_INIT
68
69#ifdef CONFIG_NUMA
70
71#define cpu_to_node cpu_to_node
72static inline int cpu_to_node(int cpu)
73{
30fc4ca2 74 return cpu_topology[cpu].node_id;
3a368f74
PH
75}
76
77/* Returns a pointer to the cpumask of CPUs on node 'node'. */
78#define cpumask_of_node cpumask_of_node
79static inline const struct cpumask *cpumask_of_node(int node)
80{
22be9cd9 81 return &node_to_cpumask_map[node];
3a368f74
PH
82}
83
3a368f74
PH
84#define pcibus_to_node(bus) __pcibus_to_node(bus)
85
86#define node_distance(a, b) __node_distance(a, b)
87
88#else /* !CONFIG_NUMA */
89
90#define numa_node_id numa_node_id
91static inline int numa_node_id(void)
92{
93 return 0;
94}
95
96#endif /* CONFIG_NUMA */
97
1da177e4
LT
98#include <asm-generic/topology.h>
99
100#endif /* _ASM_S390_TOPOLOGY_H */