diff options
Diffstat (limited to 'arch/s390/kernel/topology.c')
-rw-r--r-- | arch/s390/kernel/topology.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c index 05151e06c388..54d93f4b6818 100644 --- a/arch/s390/kernel/topology.c +++ b/arch/s390/kernel/topology.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/cpu.h> | 17 | #include <linux/cpu.h> |
18 | #include <linux/smp.h> | 18 | #include <linux/smp.h> |
19 | #include <linux/mm.h> | 19 | #include <linux/mm.h> |
20 | #include <asm/sysinfo.h> | ||
20 | 21 | ||
21 | #define PTF_HORIZONTAL (0UL) | 22 | #define PTF_HORIZONTAL (0UL) |
22 | #define PTF_VERTICAL (1UL) | 23 | #define PTF_VERTICAL (1UL) |
@@ -44,9 +45,6 @@ static struct mask_info book_info; | |||
44 | cpumask_t cpu_book_map[NR_CPUS]; | 45 | cpumask_t cpu_book_map[NR_CPUS]; |
45 | unsigned char cpu_book_id[NR_CPUS]; | 46 | unsigned char cpu_book_id[NR_CPUS]; |
46 | 47 | ||
47 | /* smp_cpu_state_mutex must be held when accessing this array */ | ||
48 | int cpu_polarization[NR_CPUS]; | ||
49 | |||
50 | static cpumask_t cpu_group_map(struct mask_info *info, unsigned int cpu) | 48 | static cpumask_t cpu_group_map(struct mask_info *info, unsigned int cpu) |
51 | { | 49 | { |
52 | cpumask_t mask; | 50 | cpumask_t mask; |
@@ -75,10 +73,7 @@ static struct mask_info *add_cpus_to_mask(struct topology_cpu *tl_cpu, | |||
75 | { | 73 | { |
76 | unsigned int cpu; | 74 | unsigned int cpu; |
77 | 75 | ||
78 | for (cpu = find_first_bit(&tl_cpu->mask[0], TOPOLOGY_CPU_BITS); | 76 | for_each_set_bit(cpu, &tl_cpu->mask[0], TOPOLOGY_CPU_BITS) { |
79 | cpu < TOPOLOGY_CPU_BITS; | ||
80 | cpu = find_next_bit(&tl_cpu->mask[0], TOPOLOGY_CPU_BITS, cpu + 1)) | ||
81 | { | ||
82 | unsigned int rcpu; | 77 | unsigned int rcpu; |
83 | int lcpu; | 78 | int lcpu; |
84 | 79 | ||
@@ -94,7 +89,7 @@ static struct mask_info *add_cpus_to_mask(struct topology_cpu *tl_cpu, | |||
94 | } else { | 89 | } else { |
95 | cpu_core_id[lcpu] = core->id; | 90 | cpu_core_id[lcpu] = core->id; |
96 | } | 91 | } |
97 | cpu_set_polarization(lcpu, tl_cpu->pp); | 92 | smp_cpu_set_polarization(lcpu, tl_cpu->pp); |
98 | } | 93 | } |
99 | } | 94 | } |
100 | return core; | 95 | return core; |
@@ -201,7 +196,7 @@ static void topology_update_polarization_simple(void) | |||
201 | 196 | ||
202 | mutex_lock(&smp_cpu_state_mutex); | 197 | mutex_lock(&smp_cpu_state_mutex); |
203 | for_each_possible_cpu(cpu) | 198 | for_each_possible_cpu(cpu) |
204 | cpu_set_polarization(cpu, POLARIZATION_HRZ); | 199 | smp_cpu_set_polarization(cpu, POLARIZATION_HRZ); |
205 | mutex_unlock(&smp_cpu_state_mutex); | 200 | mutex_unlock(&smp_cpu_state_mutex); |
206 | } | 201 | } |
207 | 202 | ||
@@ -231,7 +226,7 @@ int topology_set_cpu_management(int fc) | |||
231 | if (rc) | 226 | if (rc) |
232 | return -EBUSY; | 227 | return -EBUSY; |
233 | for_each_possible_cpu(cpu) | 228 | for_each_possible_cpu(cpu) |
234 | cpu_set_polarization(cpu, POLARIZATION_UNKNOWN); | 229 | smp_cpu_set_polarization(cpu, POLARIZATION_UNKNOWN); |
235 | return rc; | 230 | return rc; |
236 | } | 231 | } |
237 | 232 | ||
@@ -250,12 +245,10 @@ static void update_cpu_core_map(void) | |||
250 | 245 | ||
251 | void store_topology(struct sysinfo_15_1_x *info) | 246 | void store_topology(struct sysinfo_15_1_x *info) |
252 | { | 247 | { |
253 | int rc; | 248 | if (topology_max_mnest >= 3) |
254 | 249 | stsi(info, 15, 1, 3); | |
255 | rc = stsi(info, 15, 1, 3); | 250 | else |
256 | if (rc != -ENOSYS) | 251 | stsi(info, 15, 1, 2); |
257 | return; | ||
258 | stsi(info, 15, 1, 2); | ||
259 | } | 252 | } |
260 | 253 | ||
261 | int arch_update_cpu_topology(void) | 254 | int arch_update_cpu_topology(void) |
@@ -415,7 +408,7 @@ static ssize_t cpu_polarization_show(struct device *dev, | |||
415 | ssize_t count; | 408 | ssize_t count; |
416 | 409 | ||
417 | mutex_lock(&smp_cpu_state_mutex); | 410 | mutex_lock(&smp_cpu_state_mutex); |
418 | switch (cpu_read_polarization(cpu)) { | 411 | switch (smp_cpu_get_polarization(cpu)) { |
419 | case POLARIZATION_HRZ: | 412 | case POLARIZATION_HRZ: |
420 | count = sprintf(buf, "horizontal\n"); | 413 | count = sprintf(buf, "horizontal\n"); |
421 | break; | 414 | break; |