Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 106895
b: refs/heads/master
c: e9efed3
h: refs/heads/master
i:
  106893: 157ff69
  106891: 6371c8c
  106887: 59ccb7b
  106879: c36e86c
v: v3
  • Loading branch information
Nathan Lynch authored and Benjamin Herrenschmidt committed Jul 28, 2008
1 parent 14d9e5e commit 0c81525
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 440a0857e32a05979fb01fc59ea454a723e80e4b
refs/heads/master: e9efed3b80a83e44b98fc626f3268ae072550b84
23 changes: 23 additions & 0 deletions trunk/arch/powerpc/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,29 @@ int __cpuinit __cpu_up(unsigned int cpu)
return 0;
}

/* Return the value of the reg property corresponding to the given
* logical cpu.
*/
int cpu_to_core_id(int cpu)
{
struct device_node *np;
const int *reg;
int id = -1;

np = of_get_cpu_node(cpu, NULL);
if (!np)
goto out;

reg = of_get_property(np, "reg", NULL);
if (!reg)
goto out;

id = *reg;
out:
of_node_put(np);
return id;
}

/* Must be called when no change can occur to cpu_present_map,
* i.e. during cpu online or offline.
*/
Expand Down
1 change: 1 addition & 0 deletions trunk/include/asm-powerpc/smp.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ extern int smp_hw_index[];

DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
DECLARE_PER_CPU(cpumask_t, cpu_core_map);
extern int cpu_to_core_id(int cpu);

/* Since OpenPIC has only 4 IPIs, we use slightly different message numbers.
*
Expand Down
1 change: 1 addition & 0 deletions trunk/include/asm-powerpc/topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ static inline void sysfs_remove_device_from_node(struct sys_device *dev,

#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu))
#define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu))
#define topology_core_id(cpu) (cpu_to_core_id(cpu))
#endif
#endif

Expand Down

0 comments on commit 0c81525

Please sign in to comment.