diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2008-04-30 07:38:40 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2008-04-30 07:38:45 -0400 |
commit | d00aa4e7d0129983fc4389c85e15a066eb4e69a9 (patch) | |
tree | 424089981ed740aa2366e6c5956927e3855de33c | |
parent | edf2209692769d3e461c0351553098bc017c2caf (diff) |
[S390] Add topology_core_siblings to topology.h
This exposes the core siblings to user space via sysfs.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
-rw-r--r-- | arch/s390/kernel/topology.c | 21 | ||||
-rw-r--r-- | include/asm-s390/topology.h | 4 |
2 files changed, 22 insertions, 3 deletions
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c index 12b39b3d9c38..0becefcf19b9 100644 --- a/arch/s390/kernel/topology.c +++ b/arch/s390/kernel/topology.c | |||
@@ -66,6 +66,8 @@ static struct timer_list topology_timer; | |||
66 | static void set_topology_timer(void); | 66 | static void set_topology_timer(void); |
67 | static DECLARE_WORK(topology_work, topology_work_fn); | 67 | static DECLARE_WORK(topology_work, topology_work_fn); |
68 | 68 | ||
69 | cpumask_t cpu_core_map[NR_CPUS]; | ||
70 | |||
69 | cpumask_t cpu_coregroup_map(unsigned int cpu) | 71 | cpumask_t cpu_coregroup_map(unsigned int cpu) |
70 | { | 72 | { |
71 | struct core_info *core = &core_info; | 73 | struct core_info *core = &core_info; |
@@ -199,6 +201,14 @@ int topology_set_cpu_management(int fc) | |||
199 | return rc; | 201 | return rc; |
200 | } | 202 | } |
201 | 203 | ||
204 | static void update_cpu_core_map(void) | ||
205 | { | ||
206 | int cpu; | ||
207 | |||
208 | for_each_present_cpu(cpu) | ||
209 | cpu_core_map[cpu] = cpu_coregroup_map(cpu); | ||
210 | } | ||
211 | |||
202 | void arch_update_cpu_topology(void) | 212 | void arch_update_cpu_topology(void) |
203 | { | 213 | { |
204 | struct tl_info *info = tl_info; | 214 | struct tl_info *info = tl_info; |
@@ -206,11 +216,13 @@ void arch_update_cpu_topology(void) | |||
206 | int cpu; | 216 | int cpu; |
207 | 217 | ||
208 | if (!machine_has_topology) { | 218 | if (!machine_has_topology) { |
219 | update_cpu_core_map(); | ||
209 | topology_update_polarization_simple(); | 220 | topology_update_polarization_simple(); |
210 | return; | 221 | return; |
211 | } | 222 | } |
212 | stsi(info, 15, 1, 2); | 223 | stsi(info, 15, 1, 2); |
213 | tl_to_cores(info); | 224 | tl_to_cores(info); |
225 | update_cpu_core_map(); | ||
214 | for_each_online_cpu(cpu) { | 226 | for_each_online_cpu(cpu) { |
215 | sysdev = get_cpu_sysdev(cpu); | 227 | sysdev = get_cpu_sysdev(cpu); |
216 | kobject_uevent(&sysdev->kobj, KOBJ_CHANGE); | 228 | kobject_uevent(&sysdev->kobj, KOBJ_CHANGE); |
@@ -251,20 +263,23 @@ static int __init init_topology_update(void) | |||
251 | { | 263 | { |
252 | int rc; | 264 | int rc; |
253 | 265 | ||
266 | rc = 0; | ||
254 | if (!machine_has_topology) { | 267 | if (!machine_has_topology) { |
255 | topology_update_polarization_simple(); | 268 | topology_update_polarization_simple(); |
256 | return 0; | 269 | goto out; |
257 | } | 270 | } |
258 | init_timer_deferrable(&topology_timer); | 271 | init_timer_deferrable(&topology_timer); |
259 | if (machine_has_topology_irq) { | 272 | if (machine_has_topology_irq) { |
260 | rc = register_external_interrupt(0x2005, topology_interrupt); | 273 | rc = register_external_interrupt(0x2005, topology_interrupt); |
261 | if (rc) | 274 | if (rc) |
262 | return rc; | 275 | goto out; |
263 | ctl_set_bit(0, 8); | 276 | ctl_set_bit(0, 8); |
264 | } | 277 | } |
265 | else | 278 | else |
266 | set_topology_timer(); | 279 | set_topology_timer(); |
267 | return 0; | 280 | out: |
281 | update_cpu_core_map(); | ||
282 | return rc; | ||
268 | } | 283 | } |
269 | __initcall(init_topology_update); | 284 | __initcall(init_topology_update); |
270 | 285 | ||
diff --git a/include/asm-s390/topology.h b/include/asm-s390/topology.h index 8e97b06f298a..d96c91643458 100644 --- a/include/asm-s390/topology.h +++ b/include/asm-s390/topology.h | |||
@@ -7,6 +7,10 @@ | |||
7 | 7 | ||
8 | cpumask_t cpu_coregroup_map(unsigned int cpu); | 8 | cpumask_t cpu_coregroup_map(unsigned int cpu); |
9 | 9 | ||
10 | extern cpumask_t cpu_core_map[NR_CPUS]; | ||
11 | |||
12 | #define topology_core_siblings(cpu) (cpu_core_map[cpu]) | ||
13 | |||
10 | int topology_set_cpu_management(int fc); | 14 | int topology_set_cpu_management(int fc); |
11 | void topology_schedule_update(void); | 15 | void topology_schedule_update(void); |
12 | 16 | ||