diff options
author | Joachim Deguara <joachim.deguara@amd.com> | 2007-07-21 11:11:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-21 21:37:14 -0400 |
commit | 7557244ba27f63404236cb27277b98c27d856692 (patch) | |
tree | 98fa8bbf1ac63315657e35465defba84fc843ed9 /arch/x86_64/mm | |
parent | 81e02d19b901da0900332654fa7846d119b53221 (diff) |
x86_64: make k8topology multi-core aware
This makes k8topology multicore aware instead of limited to signle- and
dual-core CPUs. It uses the CPUID to be more future proof.
Signed-off-by: Joachim Deguara <joachim.deguara@amd.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86_64/mm')
-rw-r--r-- | arch/x86_64/mm/k8topology.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/arch/x86_64/mm/k8topology.c b/arch/x86_64/mm/k8topology.c index f983c75825d0..a96006f7ae0c 100644 --- a/arch/x86_64/mm/k8topology.c +++ b/arch/x86_64/mm/k8topology.c | |||
@@ -44,12 +44,12 @@ 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, nb; | 47 | int nodeid, i, j, 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 dualcore = 0; | 52 | unsigned num_cores; |
53 | 53 | ||
54 | if (!early_pci_allowed()) | 54 | if (!early_pci_allowed()) |
55 | return -1; | 55 | return -1; |
@@ -60,6 +60,9 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end) | |||
60 | 60 | ||
61 | printk(KERN_INFO "Scanning NUMA topology in Northbridge %d\n", nb); | 61 | printk(KERN_INFO "Scanning NUMA topology in Northbridge %d\n", nb); |
62 | 62 | ||
63 | num_cores = (cpuid_ecx(0x80000008) & 0xff) + 1; | ||
64 | printk(KERN_INFO "CPU has %d num_cores\n", num_cores); | ||
65 | |||
63 | reg = read_pci_config(0, nb, 0, 0x60); | 66 | reg = read_pci_config(0, nb, 0, 0x60); |
64 | numnodes = ((reg >> 4) & 0xF) + 1; | 67 | numnodes = ((reg >> 4) & 0xF) + 1; |
65 | if (numnodes <= 1) | 68 | if (numnodes <= 1) |
@@ -73,8 +76,6 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end) | |||
73 | unsigned long base,limit; | 76 | unsigned long base,limit; |
74 | u32 nodeid; | 77 | u32 nodeid; |
75 | 78 | ||
76 | /* Undefined before E stepping, but hopefully 0 */ | ||
77 | dualcore |= ((read_pci_config(0, nb, 3, 0xe8) >> 12) & 3) == 1; | ||
78 | base = read_pci_config(0, nb, 1, 0x40 + i*8); | 79 | base = read_pci_config(0, nb, 1, 0x40 + i*8); |
79 | limit = read_pci_config(0, nb, 1, 0x44 + i*8); | 80 | limit = read_pci_config(0, nb, 1, 0x44 + i*8); |
80 | 81 | ||
@@ -170,8 +171,8 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end) | |||
170 | for (i = 0; i < 8; i++) { | 171 | for (i = 0; i < 8; i++) { |
171 | if (nodes[i].start != nodes[i].end) { | 172 | if (nodes[i].start != nodes[i].end) { |
172 | nodeid = nodeids[i]; | 173 | nodeid = nodeids[i]; |
173 | apicid_to_node[nodeid << dualcore] = i; | 174 | for (j = 0; j < num_cores; j++) |
174 | apicid_to_node[(nodeid << dualcore) + dualcore] = i; | 175 | apicid_to_node[(nodeid * num_cores) + j] = i; |
175 | setup_node_bootmem(i, nodes[i].start, nodes[i].end); | 176 | setup_node_bootmem(i, nodes[i].start, nodes[i].end); |
176 | } | 177 | } |
177 | } | 178 | } |