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 | 10d3858 | 2010-05-17 10:00:12 +0200 | [diff] [blame] | 11 | extern unsigned char cpu_core_id[NR_CPUS]; |
Heiko Carstens | d00aa4e | 2008-04-30 13:38:40 +0200 | [diff] [blame] | 12 | extern cpumask_t cpu_core_map[NR_CPUS]; |
| 13 | |
Heiko Carstens | ac5fa22 | 2011-05-26 09:48:27 +0200 | [diff] [blame] | 14 | static inline const struct cpumask *cpu_coregroup_mask(int cpu) |
Heiko Carstens | 4cb14bc | 2010-08-31 10:28:18 +0200 | [diff] [blame] | 15 | { |
| 16 | return &cpu_core_map[cpu]; |
| 17 | } |
| 18 | |
Heiko Carstens | 10d3858 | 2010-05-17 10:00:12 +0200 | [diff] [blame] | 19 | #define topology_core_id(cpu) (cpu_core_id[cpu]) |
Rusty Russell | 2bb23a6 | 2009-01-01 10:12:20 +1030 | [diff] [blame] | 20 | #define topology_core_cpumask(cpu) (&cpu_core_map[cpu]) |
Heiko Carstens | 4cb14bc | 2010-08-31 10:28:18 +0200 | [diff] [blame] | 21 | #define mc_capable() (1) |
| 22 | |
Heiko Carstens | 4cb14bc | 2010-08-31 10:28:18 +0200 | [diff] [blame] | 23 | extern unsigned char cpu_book_id[NR_CPUS]; |
| 24 | extern cpumask_t cpu_book_map[NR_CPUS]; |
| 25 | |
Heiko Carstens | ac5fa22 | 2011-05-26 09:48:27 +0200 | [diff] [blame] | 26 | static inline const struct cpumask *cpu_book_mask(int cpu) |
Heiko Carstens | 4cb14bc | 2010-08-31 10:28:18 +0200 | [diff] [blame] | 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 | |
Heiko Carstens | 83a24e3 | 2011-12-27 11:27:09 +0100 | [diff] [blame] | 34 | int topology_cpu_init(struct cpu *); |
Heiko Carstens | c10fde0 | 2008-04-17 07:46:13 +0200 | [diff] [blame] | 35 | int topology_set_cpu_management(int fc); |
| 36 | void topology_schedule_update(void); |
Heiko Carstens | 96f4a70 | 2010-10-25 16:10:54 +0200 | [diff] [blame] | 37 | void store_topology(struct sysinfo_15_1_x *info); |
Heiko Carstens | d68bddb | 2011-12-27 11:27:16 +0100 | [diff] [blame] | 38 | void topology_expect_change(void); |
Heiko Carstens | c10fde0 | 2008-04-17 07:46:13 +0200 | [diff] [blame] | 39 | |
Heiko Carstens | 83a24e3 | 2011-12-27 11:27:09 +0100 | [diff] [blame] | 40 | #else /* CONFIG_SCHED_BOOK */ |
| 41 | |
| 42 | static inline void topology_schedule_update(void) { } |
| 43 | static inline int topology_cpu_init(struct cpu *cpu) { return 0; } |
Heiko Carstens | d68bddb | 2011-12-27 11:27:16 +0100 | [diff] [blame] | 44 | static inline void topology_expect_change(void) { } |
Heiko Carstens | 83a24e3 | 2011-12-27 11:27:09 +0100 | [diff] [blame] | 45 | |
| 46 | #endif /* CONFIG_SCHED_BOOK */ |
| 47 | |
| 48 | #define POLARIZATION_UNKNOWN (-1) |
Heiko Carstens | c10fde0 | 2008-04-17 07:46:13 +0200 | [diff] [blame] | 49 | #define POLARIZATION_HRZ (0) |
| 50 | #define POLARIZATION_VL (1) |
| 51 | #define POLARIZATION_VM (2) |
| 52 | #define POLARIZATION_VH (3) |
| 53 | |
Heiko Carstens | 83a24e3 | 2011-12-27 11:27:09 +0100 | [diff] [blame] | 54 | extern int cpu_polarization[]; |
| 55 | |
| 56 | static inline void cpu_set_polarization(int cpu, int val) |
| 57 | { |
| 58 | #ifdef CONFIG_SCHED_BOOK |
| 59 | cpu_polarization[cpu] = val; |
| 60 | #endif |
| 61 | } |
| 62 | |
| 63 | static 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 |
Heiko Carstens | dbd70fb | 2008-04-17 07:46:12 +0200 | [diff] [blame] | 73 | void s390_init_cpu_topology(void); |
| 74 | #else |
| 75 | static inline void s390_init_cpu_topology(void) |
| 76 | { |
| 77 | }; |
| 78 | #endif |
| 79 | |
Heiko Carstens | 4cb14bc | 2010-08-31 10:28:18 +0200 | [diff] [blame] | 80 | #define SD_BOOK_INIT SD_CPU_INIT |
| 81 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | #include <asm-generic/topology.h> |
| 83 | |
| 84 | #endif /* _ASM_S390_TOPOLOGY_H */ |