提交 15863ff3 编写于 作者: V Vasant Hegde 提交者: Benjamin Herrenschmidt

powerpc: Make chip-id information available to userspace

So far "/sys/devices/system/cpu/cpuX/topology/physical_package_id"
was always default (-1) on ppc64 architecture.

Now, some systems have an ibm,chip-id property in the cpu nodes in
the device tree. On these systems, we now use this information to
display physical_package_id.
Signed-off-by: NVasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: NShivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
上级 20212703
...@@ -112,6 +112,7 @@ static inline struct cpumask *cpu_core_mask(int cpu) ...@@ -112,6 +112,7 @@ static inline struct cpumask *cpu_core_mask(int cpu)
} }
extern int cpu_to_core_id(int cpu); extern int cpu_to_core_id(int cpu);
extern int cpu_to_chip_id(int cpu);
/* Since OpenPIC has only 4 IPIs, we use slightly different message numbers. /* Since OpenPIC has only 4 IPIs, we use slightly different message numbers.
* *
......
...@@ -96,6 +96,7 @@ static inline int prrn_is_enabled(void) ...@@ -96,6 +96,7 @@ static inline int prrn_is_enabled(void)
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
#include <asm/smp.h> #include <asm/smp.h>
#define topology_physical_package_id(cpu) (cpu_to_chip_id(cpu))
#define topology_thread_cpumask(cpu) (per_cpu(cpu_sibling_map, cpu)) #define topology_thread_cpumask(cpu) (per_cpu(cpu_sibling_map, cpu))
#define topology_core_cpumask(cpu) (per_cpu(cpu_core_map, cpu)) #define topology_core_cpumask(cpu) (per_cpu(cpu_core_map, cpu))
#define topology_core_id(cpu) (cpu_to_core_id(cpu)) #define topology_core_id(cpu) (cpu_to_core_id(cpu))
......
...@@ -596,6 +596,21 @@ int cpu_to_core_id(int cpu) ...@@ -596,6 +596,21 @@ int cpu_to_core_id(int cpu)
return id; return id;
} }
/* Return the value of the chip-id property corresponding
* to the given logical cpu.
*/
int cpu_to_chip_id(int cpu)
{
struct device_node *np;
np = of_get_cpu_node(cpu, NULL);
if (!np)
return -1;
of_node_put(np);
return of_get_ibm_chip_id(np);
}
/* Helper routines for cpu to core mapping */ /* Helper routines for cpu to core mapping */
int cpu_core_index_of_thread(int cpu) int cpu_core_index_of_thread(int cpu)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册