Commit 10d38589 authored by Heiko Carstens's avatar Heiko Carstens Committed by Martin Schwidefsky

[S390] topology: expose core identifier

Provide a topology_core_id define which makes sure that the contents of
/sys/devices/system/cpu/cpuX/topology/core_id
indeed do contain the core id and not always 0.
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 2dedf0d9
...@@ -7,8 +7,10 @@ ...@@ -7,8 +7,10 @@
const struct cpumask *cpu_coregroup_mask(unsigned int cpu); const struct cpumask *cpu_coregroup_mask(unsigned int cpu);
extern unsigned char cpu_core_id[NR_CPUS];
extern cpumask_t cpu_core_map[NR_CPUS]; extern cpumask_t cpu_core_map[NR_CPUS];
#define topology_core_id(cpu) (cpu_core_id[cpu])
#define topology_core_cpumask(cpu) (&cpu_core_map[cpu]) #define topology_core_cpumask(cpu) (&cpu_core_map[cpu])
int topology_set_cpu_management(int fc); int topology_set_cpu_management(int fc);
......
...@@ -37,7 +37,8 @@ struct tl_cpu { ...@@ -37,7 +37,8 @@ struct tl_cpu {
}; };
struct tl_container { struct tl_container {
unsigned char reserved[8]; unsigned char reserved[7];
unsigned char id;
}; };
union tl_entry { union tl_entry {
...@@ -58,6 +59,7 @@ struct tl_info { ...@@ -58,6 +59,7 @@ struct tl_info {
struct core_info { struct core_info {
struct core_info *next; struct core_info *next;
unsigned char id;
cpumask_t mask; cpumask_t mask;
}; };
...@@ -73,6 +75,7 @@ static DECLARE_WORK(topology_work, topology_work_fn); ...@@ -73,6 +75,7 @@ static DECLARE_WORK(topology_work, topology_work_fn);
static DEFINE_SPINLOCK(topology_lock); static DEFINE_SPINLOCK(topology_lock);
cpumask_t cpu_core_map[NR_CPUS]; cpumask_t cpu_core_map[NR_CPUS];
unsigned char cpu_core_id[NR_CPUS];
static cpumask_t cpu_coregroup_map(unsigned int cpu) static cpumask_t cpu_coregroup_map(unsigned int cpu)
{ {
...@@ -116,6 +119,7 @@ static void add_cpus_to_core(struct tl_cpu *tl_cpu, struct core_info *core) ...@@ -116,6 +119,7 @@ static void add_cpus_to_core(struct tl_cpu *tl_cpu, struct core_info *core)
for_each_present_cpu(lcpu) { for_each_present_cpu(lcpu) {
if (cpu_logical_map(lcpu) == rcpu) { if (cpu_logical_map(lcpu) == rcpu) {
cpu_set(lcpu, core->mask); cpu_set(lcpu, core->mask);
cpu_core_id[lcpu] = core->id;
smp_cpu_polarization[lcpu] = tl_cpu->pp; smp_cpu_polarization[lcpu] = tl_cpu->pp;
} }
} }
...@@ -158,6 +162,7 @@ static void tl_to_cores(struct tl_info *info) ...@@ -158,6 +162,7 @@ static void tl_to_cores(struct tl_info *info)
break; break;
case 1: case 1:
core = core->next; core = core->next;
core->id = tle->container.id;
break; break;
case 0: case 0:
add_cpus_to_core(&tle->cpu, core); add_cpus_to_core(&tle->cpu, core);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment