aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/k8topology_64.c
diff options
context:
space:
mode:
authorYinghai Lu <yhlu.kernel@gmail.com>2008-01-30 07:30:39 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:30:39 -0500
commit3f6e5a12b8384ab9816ba6703f4b4be87ac94b5a (patch)
treede18e4699de3eb5a0f4480974833deff66f5ad47 /arch/x86/mm/k8topology_64.c
parenta860b63c41f241c685245127a3d32f352cb04c12 (diff)
x86: use core id bits for apicid_to_node initialization
We shoud use core id bits instead of max cores, in case later with AMD downcores Quad core Opteron. [ tglx: arch/x86 adaptation ] Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Signed-off-by: Andi Kleen <ak@suse.de> Cc: Christoph Lameter <clameter@sgi.com> Cc: Len Brown <lenb@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/mm/k8topology_64.c')
-rw-r--r--arch/x86/mm/k8topology_64.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/arch/x86/mm/k8topology_64.c b/arch/x86/mm/k8topology_64.c
index a96006f7ae0c..3695c9e8b9b6 100644
--- a/arch/x86/mm/k8topology_64.c
+++ b/arch/x86/mm/k8topology_64.c
@@ -44,12 +44,14 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
44{ 44{
45 unsigned long prevbase; 45 unsigned long prevbase;
46 struct bootnode nodes[8]; 46 struct bootnode nodes[8];
47 int nodeid, i, j, nb; 47 int nodeid, i, nb;
48 unsigned char nodeids[8]; 48 unsigned char nodeids[8];
49 int found = 0; 49 int found = 0;
50 u32 reg; 50 u32 reg;
51 unsigned numnodes; 51 unsigned numnodes;
52 unsigned num_cores; 52 unsigned cores;
53 unsigned bits;
54 int j;
53 55
54 if (!early_pci_allowed()) 56 if (!early_pci_allowed())
55 return -1; 57 return -1;
@@ -60,9 +62,6 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
60 62
61 printk(KERN_INFO "Scanning NUMA topology in Northbridge %d\n", nb); 63 printk(KERN_INFO "Scanning NUMA topology in Northbridge %d\n", nb);
62 64
63 num_cores = (cpuid_ecx(0x80000008) & 0xff) + 1;
64 printk(KERN_INFO "CPU has %d num_cores\n", num_cores);
65
66 reg = read_pci_config(0, nb, 0, 0x60); 65 reg = read_pci_config(0, nb, 0, 0x60);
67 numnodes = ((reg >> 4) & 0xF) + 1; 66 numnodes = ((reg >> 4) & 0xF) + 1;
68 if (numnodes <= 1) 67 if (numnodes <= 1)
@@ -168,11 +167,15 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
168 } 167 }
169 printk(KERN_INFO "Using node hash shift of %d\n", memnode_shift); 168 printk(KERN_INFO "Using node hash shift of %d\n", memnode_shift);
170 169
170 /* use the coreid bits from early_identify_cpu */
171 bits = boot_cpu_data.x86_coreid_bits;
172 cores = (1<<bits);
173
171 for (i = 0; i < 8; i++) { 174 for (i = 0; i < 8; i++) {
172 if (nodes[i].start != nodes[i].end) { 175 if (nodes[i].start != nodes[i].end) {
173 nodeid = nodeids[i]; 176 nodeid = nodeids[i];
174 for (j = 0; j < num_cores; j++) 177 for (j = 0; j < cores; j++)
175 apicid_to_node[(nodeid * num_cores) + j] = i; 178 apicid_to_node[(nodeid << bits) + j] = i;
176 setup_node_bootmem(i, nodes[i].start, nodes[i].end); 179 setup_node_bootmem(i, nodes[i].start, nodes[i].end);
177 } 180 }
178 } 181 }