Loading...
1#ifndef _ASM_S390_TOPOLOGY_H
2#define _ASM_S390_TOPOLOGY_H
3
4#include <linux/cpumask.h>
5#include <asm/sysinfo.h>
6
7struct cpu;
8
9#ifdef CONFIG_SCHED_BOOK
10
11extern unsigned char cpu_core_id[NR_CPUS];
12extern cpumask_t cpu_core_map[NR_CPUS];
13
14static inline const struct cpumask *cpu_coregroup_mask(int cpu)
15{
16 return &cpu_core_map[cpu];
17}
18
19#define topology_core_id(cpu) (cpu_core_id[cpu])
20#define topology_core_cpumask(cpu) (&cpu_core_map[cpu])
21#define mc_capable() (1)
22
23extern unsigned char cpu_book_id[NR_CPUS];
24extern cpumask_t cpu_book_map[NR_CPUS];
25
26static inline const struct cpumask *cpu_book_mask(int cpu)
27{
28 return &cpu_book_map[cpu];
29}
30
31#define topology_book_id(cpu) (cpu_book_id[cpu])
32#define topology_book_cpumask(cpu) (&cpu_book_map[cpu])
33
34int topology_cpu_init(struct cpu *);
35int topology_set_cpu_management(int fc);
36void topology_schedule_update(void);
37void store_topology(struct sysinfo_15_1_x *info);
38void topology_expect_change(void);
39
40#else /* CONFIG_SCHED_BOOK */
41
42static inline void topology_schedule_update(void) { }
43static inline int topology_cpu_init(struct cpu *cpu) { return 0; }
44static 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
54extern int cpu_polarization[];
55
56static inline void cpu_set_polarization(int cpu, int val)
57{
58#ifdef CONFIG_SCHED_BOOK
59 cpu_polarization[cpu] = val;
60#endif
61}
62
63static inline int cpu_read_polarization(int cpu)
64{
65#ifdef CONFIG_SCHED_BOOK
66 return cpu_polarization[cpu];
67#else
68 return POLARIZATION_HRZ;
69#endif
70}
71
72#ifdef CONFIG_SCHED_BOOK
73void s390_init_cpu_topology(void);
74#else
75static inline void s390_init_cpu_topology(void)
76{
77};
78#endif
79
80#define SD_BOOK_INIT SD_CPU_INIT
81
82#include <asm-generic/topology.h>
83
84#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 */