blob: 7016dd7b6bc421c8f94bbe369c86d9227def458e [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _ASM_S390_TOPOLOGY_H
2#define _ASM_S390_TOPOLOGY_H
3
Heiko Carstensdbd70fb2008-04-17 07:46:12 +02004#include <linux/cpumask.h>
Heiko Carstens96f4a702010-10-25 16:10:54 +02005#include <asm/sysinfo.h>
Heiko Carstensdbd70fb2008-04-17 07:46:12 +02006
Heiko Carstens83a24e32011-12-27 11:27:09 +01007struct cpu;
8
9#ifdef CONFIG_SCHED_BOOK
10
Heiko Carstens10d38582010-05-17 10:00:12 +020011extern unsigned char cpu_core_id[NR_CPUS];
Heiko Carstensd00aa4e2008-04-30 13:38:40 +020012extern cpumask_t cpu_core_map[NR_CPUS];
13
Heiko Carstensac5fa222011-05-26 09:48:27 +020014static inline const struct cpumask *cpu_coregroup_mask(int cpu)
Heiko Carstens4cb14bc2010-08-31 10:28:18 +020015{
16 return &cpu_core_map[cpu];
17}
18
Heiko Carstens10d38582010-05-17 10:00:12 +020019#define topology_core_id(cpu) (cpu_core_id[cpu])
Rusty Russell2bb23a62009-01-01 10:12:20 +103020#define topology_core_cpumask(cpu) (&cpu_core_map[cpu])
Heiko Carstens4cb14bc2010-08-31 10:28:18 +020021#define mc_capable() (1)
22
Heiko Carstens4cb14bc2010-08-31 10:28:18 +020023extern unsigned char cpu_book_id[NR_CPUS];
24extern cpumask_t cpu_book_map[NR_CPUS];
25
Heiko Carstensac5fa222011-05-26 09:48:27 +020026static inline const struct cpumask *cpu_book_mask(int cpu)
Heiko Carstens4cb14bc2010-08-31 10:28:18 +020027{
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
Heiko Carstens83a24e32011-12-27 11:27:09 +010034int topology_cpu_init(struct cpu *);
Heiko Carstensc10fde02008-04-17 07:46:13 +020035int topology_set_cpu_management(int fc);
36void topology_schedule_update(void);
Heiko Carstens96f4a702010-10-25 16:10:54 +020037void store_topology(struct sysinfo_15_1_x *info);
Heiko Carstensc10fde02008-04-17 07:46:13 +020038
Heiko Carstens83a24e32011-12-27 11:27:09 +010039#else /* CONFIG_SCHED_BOOK */
40
41static inline void topology_schedule_update(void) { }
42static inline int topology_cpu_init(struct cpu *cpu) { return 0; }
43
44#endif /* CONFIG_SCHED_BOOK */
45
46#define POLARIZATION_UNKNOWN (-1)
Heiko Carstensc10fde02008-04-17 07:46:13 +020047#define POLARIZATION_HRZ (0)
48#define POLARIZATION_VL (1)
49#define POLARIZATION_VM (2)
50#define POLARIZATION_VH (3)
51
Heiko Carstens83a24e32011-12-27 11:27:09 +010052extern int cpu_polarization[];
53
54static inline void cpu_set_polarization(int cpu, int val)
55{
56#ifdef CONFIG_SCHED_BOOK
57 cpu_polarization[cpu] = val;
58#endif
59}
60
61static inline int cpu_read_polarization(int cpu)
62{
63#ifdef CONFIG_SCHED_BOOK
64 return cpu_polarization[cpu];
65#else
66 return POLARIZATION_HRZ;
67#endif
68}
69
70#ifdef CONFIG_SCHED_BOOK
Heiko Carstensdbd70fb2008-04-17 07:46:12 +020071void s390_init_cpu_topology(void);
72#else
73static inline void s390_init_cpu_topology(void)
74{
75};
76#endif
77
Heiko Carstens4cb14bc2010-08-31 10:28:18 +020078#define SD_BOOK_INIT SD_CPU_INIT
79
Linus Torvalds1da177e2005-04-16 15:20:36 -070080#include <asm-generic/topology.h>
81
82#endif /* _ASM_S390_TOPOLOGY_H */