blob: c4fbb9527c5ca2b553ca98c3f7887ea236fdff1c [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>
5
Heiko Carstens78609132012-09-03 14:11:32 +02006struct sysinfo_15_1_x;
Heiko Carstens83a24e32011-12-27 11:27:09 +01007struct cpu;
8
9#ifdef CONFIG_SCHED_BOOK
10
Heiko Carstensd1e575082012-11-12 10:03:25 +010011struct cpu_topology_s390 {
Martin Schwidefsky10ad34b2015-01-14 17:52:10 +010012 unsigned short thread_id;
Heiko Carstensd1e575082012-11-12 10:03:25 +010013 unsigned short core_id;
14 unsigned short socket_id;
15 unsigned short book_id;
Martin Schwidefsky10ad34b2015-01-14 17:52:10 +010016 cpumask_t thread_mask;
Heiko Carstensd1e575082012-11-12 10:03:25 +010017 cpumask_t core_mask;
18 cpumask_t book_mask;
19};
Heiko Carstens658e5ce2012-11-10 11:04:27 +010020
Heiko Carstensd1e575082012-11-12 10:03:25 +010021extern struct cpu_topology_s390 cpu_topology[NR_CPUS];
22
23#define topology_physical_package_id(cpu) (cpu_topology[cpu].socket_id)
Martin Schwidefsky10ad34b2015-01-14 17:52:10 +010024#define topology_thread_id(cpu) (cpu_topology[cpu].thread_id)
25#define topology_thread_cpumask(cpu) (&cpu_topology[cpu].thread_mask)
Heiko Carstensd1e575082012-11-12 10:03:25 +010026#define topology_core_id(cpu) (cpu_topology[cpu].core_id)
27#define topology_core_cpumask(cpu) (&cpu_topology[cpu].core_mask)
28#define topology_book_id(cpu) (cpu_topology[cpu].book_id)
29#define topology_book_cpumask(cpu) (&cpu_topology[cpu].book_mask)
30
31#define mc_capable() 1
Heiko Carstensd00aa4e2008-04-30 13:38:40 +020032
Heiko Carstens83a24e32011-12-27 11:27:09 +010033int topology_cpu_init(struct cpu *);
Heiko Carstensc10fde02008-04-17 07:46:13 +020034int topology_set_cpu_management(int fc);
35void topology_schedule_update(void);
Heiko Carstens96f4a702010-10-25 16:10:54 +020036void store_topology(struct sysinfo_15_1_x *info);
Heiko Carstensd68bddb2011-12-27 11:27:16 +010037void topology_expect_change(void);
Vincent Guittot2dfd7472014-04-11 11:44:38 +020038const struct cpumask *cpu_coregroup_mask(int cpu);
Heiko Carstensc10fde02008-04-17 07:46:13 +020039
Heiko Carstens83a24e32011-12-27 11:27:09 +010040#else /* CONFIG_SCHED_BOOK */
41
42static inline void topology_schedule_update(void) { }
43static inline int topology_cpu_init(struct cpu *cpu) { return 0; }
Heiko Carstensd68bddb2011-12-27 11:27:16 +010044static inline void topology_expect_change(void) { }
Heiko Carstens83a24e32011-12-27 11:27:09 +010045
46#endif /* CONFIG_SCHED_BOOK */
47
48#define POLARIZATION_UNKNOWN (-1)
Heiko Carstensc10fde02008-04-17 07:46:13 +020049#define POLARIZATION_HRZ (0)
50#define POLARIZATION_VL (1)
51#define POLARIZATION_VM (2)
52#define POLARIZATION_VH (3)
53
Heiko Carstens83a24e32011-12-27 11:27:09 +010054#ifdef CONFIG_SCHED_BOOK
Heiko Carstensdbd70fb2008-04-17 07:46:12 +020055void s390_init_cpu_topology(void);
56#else
57static inline void s390_init_cpu_topology(void)
58{
59};
60#endif
61
Linus Torvalds1da177e2005-04-16 15:20:36 -070062#include <asm-generic/topology.h>
63
64#endif /* _ASM_S390_TOPOLOGY_H */