Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 212006
b: refs/heads/master
c: 23588c3
h: refs/heads/master
v: v3
  • Loading branch information
Andreas Herrmann authored and H. Peter Anvin committed Oct 1, 2010
1 parent 588432e commit 09c2ac2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 25 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 420b13b60a3e5c5dcc6ec290e131cf5fbc603d94
refs/heads/master: 23588c38a84c9175c6668789b64ffba4651e5c6a
50 changes: 26 additions & 24 deletions trunk/arch/x86/kernel/cpu/amd.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,37 +253,41 @@ static int __cpuinit nearby_node(int apicid)
#endif

/*
* Fixup core topology information for AMD multi-node processors.
* Assumption: Number of cores in each internal node is the same.
* Fixup core topology information for
* (1) AMD multi-node processors
* Assumption: Number of cores in each internal node is the same.
*/
#ifdef CONFIG_X86_HT
static void __cpuinit amd_fixup_dcm(struct cpuinfo_x86 *c)
static void __cpuinit amd_get_topology(struct cpuinfo_x86 *c)
{
unsigned long long value;
u32 nodes, cores_per_node;
u8 node_id;
unsigned long long value;
int cpu = smp_processor_id();

if (!cpu_has(c, X86_FEATURE_NODEID_MSR))
return;

/* fixup topology information only once for a core */
if (cpu_has(c, X86_FEATURE_AMD_DCM))
/* get information required for multi-node processors */
if (cpu_has(c, X86_FEATURE_TOPOEXT)) {
value = cpuid_ecx(0x8000001e);
nodes = ((value >> 8) & 7) + 1;
node_id = value & 7;
} else if (cpu_has(c, X86_FEATURE_NODEID_MSR)) {
rdmsrl(MSR_FAM10H_NODE_ID, value);
nodes = ((value >> 3) & 7) + 1;
node_id = value & 7;
} else
return;

rdmsrl(MSR_FAM10H_NODE_ID, value);
/* fixup multi-node processor information */
if (nodes > 1) {
set_cpu_cap(c, X86_FEATURE_AMD_DCM);
cores_per_node = c->x86_max_cores / nodes;

nodes = ((value >> 3) & 7) + 1;
if (nodes == 1)
return;

set_cpu_cap(c, X86_FEATURE_AMD_DCM);
cores_per_node = c->x86_max_cores / nodes;
/* store NodeID, use llc_shared_map to store sibling info */
per_cpu(cpu_llc_id, cpu) = node_id;

/* store NodeID, use llc_shared_map to store sibling info */
per_cpu(cpu_llc_id, cpu) = value & 7;

/* fixup core id to be in range from 0 to (cores_per_node - 1) */
c->cpu_core_id = c->cpu_core_id % cores_per_node;
/* core id to be in range from 0 to (cores_per_node - 1) */
c->cpu_core_id = c->cpu_core_id % cores_per_node;
}
}
#endif

Expand All @@ -304,9 +308,7 @@ static void __cpuinit amd_detect_cmp(struct cpuinfo_x86 *c)
c->phys_proc_id = c->initial_apicid >> bits;
/* use socket ID also for last level cache */
per_cpu(cpu_llc_id, cpu) = c->phys_proc_id;
/* fixup topology information on multi-node processors */
if ((c->x86 == 0x10) && (c->x86_model == 9))
amd_fixup_dcm(c);
amd_get_topology(c);
#endif
}

Expand Down

0 comments on commit 09c2ac2

Please sign in to comment.