topology.h 2.6 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3
#ifndef _ASM_S390_TOPOLOGY_H
#define _ASM_S390_TOPOLOGY_H

4
#include <linux/cpumask.h>
5
#include <asm/numa.h>
6

7
struct sysinfo_15_1_x;
8 9
struct cpu;

10
#ifdef CONFIG_SCHED_TOPOLOGY
11

12
struct cpu_topology_s390 {
M
Martin Schwidefsky 已提交
13
	unsigned short thread_id;
14 15 16
	unsigned short core_id;
	unsigned short socket_id;
	unsigned short book_id;
17
	unsigned short drawer_id;
18
	unsigned short node_id;
M
Martin Schwidefsky 已提交
19
	cpumask_t thread_mask;
20 21
	cpumask_t core_mask;
	cpumask_t book_mask;
22
	cpumask_t drawer_mask;
23 24
};

25 26 27 28 29 30 31 32 33 34 35
extern struct cpu_topology_s390 cpu_topology[NR_CPUS];

#define topology_physical_package_id(cpu) (cpu_topology[cpu].socket_id)
#define topology_thread_id(cpu)		  (cpu_topology[cpu].thread_id)
#define topology_sibling_cpumask(cpu)	  (&cpu_topology[cpu].thread_mask)
#define topology_core_id(cpu)		  (cpu_topology[cpu].core_id)
#define topology_core_cpumask(cpu)	  (&cpu_topology[cpu].core_mask)
#define topology_book_id(cpu)		  (cpu_topology[cpu].book_id)
#define topology_book_cpumask(cpu)	  (&cpu_topology[cpu].book_mask)
#define topology_drawer_id(cpu)		  (cpu_topology[cpu].drawer_id)
#define topology_drawer_cpumask(cpu)	  (&cpu_topology[cpu].drawer_mask)
36

37
#define mc_capable() 1
38

39
int topology_cpu_init(struct cpu *);
H
Heiko Carstens 已提交
40 41
int topology_set_cpu_management(int fc);
void topology_schedule_update(void);
42
void store_topology(struct sysinfo_15_1_x *info);
43
void topology_expect_change(void);
44
const struct cpumask *cpu_coregroup_mask(int cpu);
H
Heiko Carstens 已提交
45

46
#else /* CONFIG_SCHED_TOPOLOGY */
47 48 49

static inline void topology_schedule_update(void) { }
static inline int topology_cpu_init(struct cpu *cpu) { return 0; }
50
static inline void topology_expect_change(void) { }
51

52
#endif /* CONFIG_SCHED_TOPOLOGY */
53 54

#define POLARIZATION_UNKNOWN	(-1)
H
Heiko Carstens 已提交
55 56 57 58 59
#define POLARIZATION_HRZ	(0)
#define POLARIZATION_VL		(1)
#define POLARIZATION_VM		(2)
#define POLARIZATION_VH		(3)

60 61 62 63 64 65 66
#define SD_BOOK_INIT	SD_CPU_INIT

#ifdef CONFIG_NUMA

#define cpu_to_node cpu_to_node
static inline int cpu_to_node(int cpu)
{
67
	return cpu_topology[cpu].node_id;
68 69 70 71 72 73
}

/* Returns a pointer to the cpumask of CPUs on node 'node'. */
#define cpumask_of_node cpumask_of_node
static inline const struct cpumask *cpumask_of_node(int node)
{
74
	return &node_to_cpumask_map[node];
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
}

/*
 * Returns the number of the node containing node 'node'. This
 * architecture is flat, so it is a pretty simple function!
 */
#define parent_node(node) (node)

#define pcibus_to_node(bus) __pcibus_to_node(bus)

#define node_distance(a, b) __node_distance(a, b)

#else /* !CONFIG_NUMA */

#define numa_node_id numa_node_id
static inline int numa_node_id(void)
{
	return 0;
}

#endif /* CONFIG_NUMA */

L
Linus Torvalds 已提交
97 98 99
#include <asm-generic/topology.h>

#endif /* _ASM_S390_TOPOLOGY_H */