diff options
Diffstat (limited to 'arch/x86/mm')
-rw-r--r-- | arch/x86/mm/k8topology_64.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/arch/x86/mm/k8topology_64.c b/arch/x86/mm/k8topology_64.c index 86808e666f9c..1f476e477844 100644 --- a/arch/x86/mm/k8topology_64.c +++ b/arch/x86/mm/k8topology_64.c | |||
@@ -13,12 +13,15 @@ | |||
13 | #include <linux/nodemask.h> | 13 | #include <linux/nodemask.h> |
14 | #include <asm/io.h> | 14 | #include <asm/io.h> |
15 | #include <linux/pci_ids.h> | 15 | #include <linux/pci_ids.h> |
16 | #include <linux/acpi.h> | ||
16 | #include <asm/types.h> | 17 | #include <asm/types.h> |
17 | #include <asm/mmzone.h> | 18 | #include <asm/mmzone.h> |
18 | #include <asm/proto.h> | 19 | #include <asm/proto.h> |
19 | #include <asm/e820.h> | 20 | #include <asm/e820.h> |
20 | #include <asm/pci-direct.h> | 21 | #include <asm/pci-direct.h> |
21 | #include <asm/numa.h> | 22 | #include <asm/numa.h> |
23 | #include <asm/mpspec.h> | ||
24 | #include <asm/apic.h> | ||
22 | 25 | ||
23 | static __init int find_northbridge(void) | 26 | static __init int find_northbridge(void) |
24 | { | 27 | { |
@@ -44,6 +47,30 @@ static __init int find_northbridge(void) | |||
44 | return -1; | 47 | return -1; |
45 | } | 48 | } |
46 | 49 | ||
50 | static __init void early_get_boot_cpu_id(void) | ||
51 | { | ||
52 | /* | ||
53 | * need to get boot_cpu_id so can use that to create apicid_to_node | ||
54 | * in k8_scan_nodes() | ||
55 | */ | ||
56 | /* | ||
57 | * Find possible boot-time SMP configuration: | ||
58 | */ | ||
59 | early_find_smp_config(); | ||
60 | #ifdef CONFIG_ACPI | ||
61 | /* | ||
62 | * Read APIC information from ACPI tables. | ||
63 | */ | ||
64 | early_acpi_boot_init(); | ||
65 | #endif | ||
66 | /* | ||
67 | * get boot-time SMP configuration: | ||
68 | */ | ||
69 | if (smp_found_config) | ||
70 | early_get_smp_config(); | ||
71 | early_init_lapic_mapping(); | ||
72 | } | ||
73 | |||
47 | int __init k8_scan_nodes(unsigned long start, unsigned long end) | 74 | int __init k8_scan_nodes(unsigned long start, unsigned long end) |
48 | { | 75 | { |
49 | unsigned long prevbase; | 76 | unsigned long prevbase; |
@@ -56,6 +83,7 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end) | |||
56 | unsigned cores; | 83 | unsigned cores; |
57 | unsigned bits; | 84 | unsigned bits; |
58 | int j; | 85 | int j; |
86 | unsigned apicid_base; | ||
59 | 87 | ||
60 | if (!early_pci_allowed()) | 88 | if (!early_pci_allowed()) |
61 | return -1; | 89 | return -1; |
@@ -174,11 +202,19 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end) | |||
174 | /* use the coreid bits from early_identify_cpu */ | 202 | /* use the coreid bits from early_identify_cpu */ |
175 | bits = boot_cpu_data.x86_coreid_bits; | 203 | bits = boot_cpu_data.x86_coreid_bits; |
176 | cores = (1<<bits); | 204 | cores = (1<<bits); |
205 | apicid_base = 0; | ||
206 | /* need to get boot_cpu_id early for system with apicid lifting */ | ||
207 | early_get_boot_cpu_id(); | ||
208 | if (boot_cpu_physical_apicid > 0) { | ||
209 | printk(KERN_INFO "BSP APIC ID: %02x\n", | ||
210 | boot_cpu_physical_apicid); | ||
211 | apicid_base = boot_cpu_physical_apicid; | ||
212 | } | ||
177 | 213 | ||
178 | for (i = 0; i < 8; i++) { | 214 | for (i = 0; i < 8; i++) { |
179 | if (nodes[i].start != nodes[i].end) { | 215 | if (nodes[i].start != nodes[i].end) { |
180 | nodeid = nodeids[i]; | 216 | nodeid = nodeids[i]; |
181 | for (j = 0; j < cores; j++) | 217 | for (j = apicid_base; j < cores + apicid_base; j++) |
182 | apicid_to_node[(nodeid << bits) + j] = i; | 218 | apicid_to_node[(nodeid << bits) + j] = i; |
183 | setup_node_bootmem(i, nodes[i].start, nodes[i].end); | 219 | setup_node_bootmem(i, nodes[i].start, nodes[i].end); |
184 | } | 220 | } |