diff options
Diffstat (limited to 'arch/s390/kernel/topology.c')
-rw-r--r-- | arch/s390/kernel/topology.c | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c index bf96f1b5c6ec..90e9ba11eba1 100644 --- a/arch/s390/kernel/topology.c +++ b/arch/s390/kernel/topology.c | |||
@@ -3,6 +3,9 @@ | |||
3 | * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com> | 3 | * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com> |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #define KMSG_COMPONENT "cpu" | ||
7 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt | ||
8 | |||
6 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
7 | #include <linux/mm.h> | 10 | #include <linux/mm.h> |
8 | #include <linux/init.h> | 11 | #include <linux/init.h> |
@@ -12,6 +15,7 @@ | |||
12 | #include <linux/workqueue.h> | 15 | #include <linux/workqueue.h> |
13 | #include <linux/cpu.h> | 16 | #include <linux/cpu.h> |
14 | #include <linux/smp.h> | 17 | #include <linux/smp.h> |
18 | #include <linux/cpuset.h> | ||
15 | #include <asm/delay.h> | 19 | #include <asm/delay.h> |
16 | #include <asm/s390_ext.h> | 20 | #include <asm/s390_ext.h> |
17 | #include <asm/sysinfo.h> | 21 | #include <asm/sysinfo.h> |
@@ -57,11 +61,11 @@ struct core_info { | |||
57 | cpumask_t mask; | 61 | cpumask_t mask; |
58 | }; | 62 | }; |
59 | 63 | ||
64 | static int topology_enabled; | ||
60 | static void topology_work_fn(struct work_struct *work); | 65 | static void topology_work_fn(struct work_struct *work); |
61 | static struct tl_info *tl_info; | 66 | static struct tl_info *tl_info; |
62 | static struct core_info core_info; | 67 | static struct core_info core_info; |
63 | static int machine_has_topology; | 68 | static int machine_has_topology; |
64 | static int machine_has_topology_irq; | ||
65 | static struct timer_list topology_timer; | 69 | static struct timer_list topology_timer; |
66 | static void set_topology_timer(void); | 70 | static void set_topology_timer(void); |
67 | static DECLARE_WORK(topology_work, topology_work_fn); | 71 | static DECLARE_WORK(topology_work, topology_work_fn); |
@@ -77,8 +81,8 @@ cpumask_t cpu_coregroup_map(unsigned int cpu) | |||
77 | cpumask_t mask; | 81 | cpumask_t mask; |
78 | 82 | ||
79 | cpus_clear(mask); | 83 | cpus_clear(mask); |
80 | if (!machine_has_topology) | 84 | if (!topology_enabled || !machine_has_topology) |
81 | return cpu_present_map; | 85 | return cpu_possible_map; |
82 | spin_lock_irqsave(&topology_lock, flags); | 86 | spin_lock_irqsave(&topology_lock, flags); |
83 | while (core) { | 87 | while (core) { |
84 | if (cpu_isset(cpu, core->mask)) { | 88 | if (cpu_isset(cpu, core->mask)) { |
@@ -168,7 +172,7 @@ static void topology_update_polarization_simple(void) | |||
168 | int cpu; | 172 | int cpu; |
169 | 173 | ||
170 | mutex_lock(&smp_cpu_state_mutex); | 174 | mutex_lock(&smp_cpu_state_mutex); |
171 | for_each_present_cpu(cpu) | 175 | for_each_possible_cpu(cpu) |
172 | smp_cpu_polarization[cpu] = POLARIZATION_HRZ; | 176 | smp_cpu_polarization[cpu] = POLARIZATION_HRZ; |
173 | mutex_unlock(&smp_cpu_state_mutex); | 177 | mutex_unlock(&smp_cpu_state_mutex); |
174 | } | 178 | } |
@@ -199,7 +203,7 @@ int topology_set_cpu_management(int fc) | |||
199 | rc = ptf(PTF_HORIZONTAL); | 203 | rc = ptf(PTF_HORIZONTAL); |
200 | if (rc) | 204 | if (rc) |
201 | return -EBUSY; | 205 | return -EBUSY; |
202 | for_each_present_cpu(cpu) | 206 | for_each_possible_cpu(cpu) |
203 | smp_cpu_polarization[cpu] = POLARIZATION_UNKNWN; | 207 | smp_cpu_polarization[cpu] = POLARIZATION_UNKNWN; |
204 | return rc; | 208 | return rc; |
205 | } | 209 | } |
@@ -208,7 +212,7 @@ static void update_cpu_core_map(void) | |||
208 | { | 212 | { |
209 | int cpu; | 213 | int cpu; |
210 | 214 | ||
211 | for_each_present_cpu(cpu) | 215 | for_each_possible_cpu(cpu) |
212 | cpu_core_map[cpu] = cpu_coregroup_map(cpu); | 216 | cpu_core_map[cpu] = cpu_coregroup_map(cpu); |
213 | } | 217 | } |
214 | 218 | ||
@@ -235,7 +239,7 @@ int arch_update_cpu_topology(void) | |||
235 | 239 | ||
236 | static void topology_work_fn(struct work_struct *work) | 240 | static void topology_work_fn(struct work_struct *work) |
237 | { | 241 | { |
238 | arch_reinit_sched_domains(); | 242 | rebuild_sched_domains(); |
239 | } | 243 | } |
240 | 244 | ||
241 | void topology_schedule_update(void) | 245 | void topology_schedule_update(void) |
@@ -258,10 +262,14 @@ static void set_topology_timer(void) | |||
258 | add_timer(&topology_timer); | 262 | add_timer(&topology_timer); |
259 | } | 263 | } |
260 | 264 | ||
261 | static void topology_interrupt(__u16 code) | 265 | static int __init early_parse_topology(char *p) |
262 | { | 266 | { |
263 | schedule_work(&topology_work); | 267 | if (strncmp(p, "on", 2)) |
268 | return 0; | ||
269 | topology_enabled = 1; | ||
270 | return 0; | ||
264 | } | 271 | } |
272 | early_param("topology", early_parse_topology); | ||
265 | 273 | ||
266 | static int __init init_topology_update(void) | 274 | static int __init init_topology_update(void) |
267 | { | 275 | { |
@@ -273,14 +281,7 @@ static int __init init_topology_update(void) | |||
273 | goto out; | 281 | goto out; |
274 | } | 282 | } |
275 | init_timer_deferrable(&topology_timer); | 283 | init_timer_deferrable(&topology_timer); |
276 | if (machine_has_topology_irq) { | 284 | set_topology_timer(); |
277 | rc = register_external_interrupt(0x2005, topology_interrupt); | ||
278 | if (rc) | ||
279 | goto out; | ||
280 | ctl_set_bit(0, 8); | ||
281 | } | ||
282 | else | ||
283 | set_topology_timer(); | ||
284 | out: | 285 | out: |
285 | update_cpu_core_map(); | 286 | update_cpu_core_map(); |
286 | return rc; | 287 | return rc; |
@@ -301,9 +302,6 @@ void __init s390_init_cpu_topology(void) | |||
301 | return; | 302 | return; |
302 | machine_has_topology = 1; | 303 | machine_has_topology = 1; |
303 | 304 | ||
304 | if (facility_bits & (1ULL << 51)) | ||
305 | machine_has_topology_irq = 1; | ||
306 | |||
307 | tl_info = alloc_bootmem_pages(PAGE_SIZE); | 305 | tl_info = alloc_bootmem_pages(PAGE_SIZE); |
308 | info = tl_info; | 306 | info = tl_info; |
309 | stsi(info, 15, 1, 2); | 307 | stsi(info, 15, 1, 2); |
@@ -312,7 +310,7 @@ void __init s390_init_cpu_topology(void) | |||
312 | for (i = 0; i < info->mnest - 2; i++) | 310 | for (i = 0; i < info->mnest - 2; i++) |
313 | nr_cores *= info->mag[NR_MAG - 3 - i]; | 311 | nr_cores *= info->mag[NR_MAG - 3 - i]; |
314 | 312 | ||
315 | printk(KERN_INFO "CPU topology:"); | 313 | pr_info("The CPU configuration topology of the machine is:"); |
316 | for (i = 0; i < NR_MAG; i++) | 314 | for (i = 0; i < NR_MAG; i++) |
317 | printk(" %d", info->mag[i]); | 315 | printk(" %d", info->mag[i]); |
318 | printk(" / %d\n", info->mnest); | 316 | printk(" / %d\n", info->mnest); |
@@ -327,5 +325,4 @@ void __init s390_init_cpu_topology(void) | |||
327 | return; | 325 | return; |
328 | error: | 326 | error: |
329 | machine_has_topology = 0; | 327 | machine_has_topology = 0; |
330 | machine_has_topology_irq = 0; | ||
331 | } | 328 | } |