Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 30450
b: refs/heads/master
c: faee9a5
h: refs/heads/master
v: v3
  • Loading branch information
Andi Kleen authored and Linus Torvalds committed Jun 26, 2006
1 parent 7c67ffc commit e51744e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 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: 79121ea9f098934850347eeed3857ffd836810c3
refs/heads/master: faee9a5dc9d8399cc3b1b8e18b6d7ff7b17f1af1
14 changes: 8 additions & 6 deletions trunk/arch/i386/kernel/cpu/amd.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,17 @@ static void __init init_amd(struct cpuinfo_x86 *c)

#ifdef CONFIG_X86_HT
/*
* On a AMD dual core setup the lower bits of the APIC id
* distingush the cores. Assumes number of cores is a power
* of two.
* On a AMD multi core setup the lower bits of the APIC id
* distingush the cores.
*/
if (c->x86_max_cores > 1) {
int cpu = smp_processor_id();
unsigned bits = 0;
while ((1 << bits) < c->x86_max_cores)
bits++;
unsigned bits = (cpuid_ecx(0x80000008) >> 12) & 0xf;

if (bits == 0) {
while ((1 << bits) < c->x86_max_cores)
bits++;
}
cpu_core_id[cpu] = phys_proc_id[cpu] & ((1<<bits)-1);
phys_proc_id[cpu] >>= bits;
printk(KERN_INFO "CPU %d(%d) -> Core %d\n",
Expand Down
20 changes: 13 additions & 7 deletions trunk/arch/x86_64/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -873,10 +873,18 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c)
int node = 0;
unsigned apicid = hard_smp_processor_id();
#endif
unsigned ecx = cpuid_ecx(0x80000008);

bits = 0;
while ((1 << bits) < c->x86_max_cores)
bits++;
c->x86_max_cores = (ecx & 0xff) + 1;

/* CPU telling us the core id bits shift? */
bits = (ecx >> 12) & 0xF;

/* Otherwise recompute */
if (bits == 0) {
while ((1 << bits) < c->x86_max_cores)
bits++;
}

/* Low order bits define the core id (index of core in socket) */
cpu_core_id[cpu] = phys_proc_id[cpu] & ((1 << bits)-1);
Expand Down Expand Up @@ -964,11 +972,9 @@ static int __init init_amd(struct cpuinfo_x86 *c)
if (c->x86_power & (1<<8))
set_bit(X86_FEATURE_CONSTANT_TSC, &c->x86_capability);

if (c->extended_cpuid_level >= 0x80000008) {
c->x86_max_cores = (cpuid_ecx(0x80000008) & 0xff) + 1;

/* Multi core CPU? */
if (c->extended_cpuid_level >= 0x80000008)
amd_detect_cmp(c);
}

return r;
}
Expand Down

0 comments on commit e51744e

Please sign in to comment.