Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _ASM_S390_TOPOLOGY_H |
| 2 | #define _ASM_S390_TOPOLOGY_H |
| 3 | |
Heiko Carstens | dbd70fb | 2008-04-17 07:46:12 +0200 | [diff] [blame] | 4 | #include <linux/cpumask.h> |
| 5 | |
Heiko Carstens | 7860913 | 2012-09-03 14:11:32 +0200 | [diff] [blame] | 6 | struct sysinfo_15_1_x; |
Heiko Carstens | 83a24e3 | 2011-12-27 11:27:09 +0100 | [diff] [blame] | 7 | struct cpu; |
| 8 | |
| 9 | #ifdef CONFIG_SCHED_BOOK |
| 10 | |
Heiko Carstens | d1e57508 | 2012-11-12 10:03:25 +0100 | [diff] [blame^] | 11 | struct 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 | }; |
Heiko Carstens | 658e5ce | 2012-11-10 11:04:27 +0100 | [diff] [blame] | 18 | |
Heiko Carstens | d1e57508 | 2012-11-12 10:03:25 +0100 | [diff] [blame^] | 19 | extern 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 |
Heiko Carstens | d00aa4e | 2008-04-30 13:38:40 +0200 | [diff] [blame] | 28 | |
Heiko Carstens | ac5fa22 | 2011-05-26 09:48:27 +0200 | [diff] [blame] | 29 | static inline const struct cpumask *cpu_coregroup_mask(int cpu) |
Heiko Carstens | 4cb14bc | 2010-08-31 10:28:18 +0200 | [diff] [blame] | 30 | { |
Heiko Carstens | d1e57508 | 2012-11-12 10:03:25 +0100 | [diff] [blame^] | 31 | return &cpu_topology[cpu].core_mask; |
Heiko Carstens | 4cb14bc | 2010-08-31 10:28:18 +0200 | [diff] [blame] | 32 | } |
| 33 | |
Heiko Carstens | ac5fa22 | 2011-05-26 09:48:27 +0200 | [diff] [blame] | 34 | static inline const struct cpumask *cpu_book_mask(int cpu) |
Heiko Carstens | 4cb14bc | 2010-08-31 10:28:18 +0200 | [diff] [blame] | 35 | { |
Heiko Carstens | d1e57508 | 2012-11-12 10:03:25 +0100 | [diff] [blame^] | 36 | return &cpu_topology[cpu].book_mask; |
Heiko Carstens | 4cb14bc | 2010-08-31 10:28:18 +0200 | [diff] [blame] | 37 | } |
| 38 | |
Heiko Carstens | 83a24e3 | 2011-12-27 11:27:09 +0100 | [diff] [blame] | 39 | int topology_cpu_init(struct cpu *); |
Heiko Carstens | c10fde0 | 2008-04-17 07:46:13 +0200 | [diff] [blame] | 40 | int topology_set_cpu_management(int fc); |
| 41 | void topology_schedule_update(void); |
Heiko Carstens | 96f4a70 | 2010-10-25 16:10:54 +0200 | [diff] [blame] | 42 | void store_topology(struct sysinfo_15_1_x *info); |
Heiko Carstens | d68bddb | 2011-12-27 11:27:16 +0100 | [diff] [blame] | 43 | void topology_expect_change(void); |
Heiko Carstens | c10fde0 | 2008-04-17 07:46:13 +0200 | [diff] [blame] | 44 | |
Heiko Carstens | 83a24e3 | 2011-12-27 11:27:09 +0100 | [diff] [blame] | 45 | #else /* CONFIG_SCHED_BOOK */ |
| 46 | |
| 47 | static inline void topology_schedule_update(void) { } |
| 48 | static inline int topology_cpu_init(struct cpu *cpu) { return 0; } |
Heiko Carstens | d68bddb | 2011-12-27 11:27:16 +0100 | [diff] [blame] | 49 | static inline void topology_expect_change(void) { } |
Heiko Carstens | 83a24e3 | 2011-12-27 11:27:09 +0100 | [diff] [blame] | 50 | |
| 51 | #endif /* CONFIG_SCHED_BOOK */ |
| 52 | |
| 53 | #define POLARIZATION_UNKNOWN (-1) |
Heiko Carstens | c10fde0 | 2008-04-17 07:46:13 +0200 | [diff] [blame] | 54 | #define POLARIZATION_HRZ (0) |
| 55 | #define POLARIZATION_VL (1) |
| 56 | #define POLARIZATION_VM (2) |
| 57 | #define POLARIZATION_VH (3) |
| 58 | |
Heiko Carstens | 83a24e3 | 2011-12-27 11:27:09 +0100 | [diff] [blame] | 59 | #ifdef CONFIG_SCHED_BOOK |
Heiko Carstens | dbd70fb | 2008-04-17 07:46:12 +0200 | [diff] [blame] | 60 | void s390_init_cpu_topology(void); |
| 61 | #else |
| 62 | static inline void s390_init_cpu_topology(void) |
| 63 | { |
| 64 | }; |
| 65 | #endif |
| 66 | |
Heiko Carstens | 4cb14bc | 2010-08-31 10:28:18 +0200 | [diff] [blame] | 67 | #define SD_BOOK_INIT SD_CPU_INIT |
| 68 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | #include <asm-generic/topology.h> |
| 70 | |
| 71 | #endif /* _ASM_S390_TOPOLOGY_H */ |