aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/pci/acpi.c
diff options
context:
space:
mode:
authorYinghai Lu <Yinghai.Lu@Sun.COM>2008-02-19 06:20:09 -0500
committerIngo Molnar <mingo@elte.hu>2008-04-26 17:41:04 -0400
commit871d5f8dd0f7647f03facd4cb79485938d1b61ab (patch)
treeb08eee02ddd7b4bdb9dfde2637f5154e409cdacc /arch/x86/pci/acpi.c
parentbb63b4219976d48ed6d22ac33c18be334fb5a78c (diff)
x86: get mp_bus_to_node early
Currently, on an amd k8 system with multi ht chains, the numa_node of pci devices under /sys/devices/pci0000:80/* is always 0, even if that chain is on node 1 or 2 or 3. Workaround: pcibus_to_node(bus) is used when we want to get the node that pci_device is on. In struct device, we already have numa_node member, and we could use dev_to_node()/set_dev_node() to get and set numa_node in the device. set_dev_node is called in pci_device_add() with pcibus_to_node(bus), and pcibus_to_node uses bus->sysdata for nodeid. The problem is when pci_add_device is called, bus->sysdata is not assigned correct nodeid yet. The result is that numa_node will always be 0. pcibios_scan_root and pci_scan_root could take sysdata. So we need to get mp_bus_to_node mapping before these two are called, and thus get_mp_bus_to_node could get correct node for sysdata in root bus. In scanning of the root bus, all child busses will take parent bus sysdata. So all pci_device->dev.numa_node will be assigned correctly and automatically. Later we could use dev_to_node(&pci_dev->dev) to get numa_node, and we could also could make other bus specific device get the correct numa_node too. This is an updated version of pci_sysdata and Jeff's pci_domain patch. [ mingo@elte.hu: build fix ] Signed-off-by: Yinghai Lu <yinghai.lu@sun.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/pci/acpi.c')
-rw-r--r--arch/x86/pci/acpi.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 2664cb3fc96c..1a9c0c6a1a18 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -191,7 +191,10 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
191{ 191{
192 struct pci_bus *bus; 192 struct pci_bus *bus;
193 struct pci_sysdata *sd; 193 struct pci_sysdata *sd;
194 int node;
195#ifdef CONFIG_ACPI_NUMA
194 int pxm; 196 int pxm;
197#endif
195 198
196 dmi_check_system(acpi_pciprobe_dmi_table); 199 dmi_check_system(acpi_pciprobe_dmi_table);
197 200
@@ -201,6 +204,17 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
201 return NULL; 204 return NULL;
202 } 205 }
203 206
207 node = -1;
208#ifdef CONFIG_ACPI_NUMA
209 pxm = acpi_get_pxm(device->handle);
210 if (pxm >= 0)
211 node = pxm_to_node(pxm);
212 if (node != -1)
213 set_mp_bus_to_node(busnum, node);
214 else
215 node = get_mp_bus_to_node(busnum);
216#endif
217
204 /* Allocate per-root-bus (not per bus) arch-specific data. 218 /* Allocate per-root-bus (not per bus) arch-specific data.
205 * TODO: leak; this memory is never freed. 219 * TODO: leak; this memory is never freed.
206 * It's arguable whether it's worth the trouble to care. 220 * It's arguable whether it's worth the trouble to care.
@@ -212,13 +226,7 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
212 } 226 }
213 227
214 sd->domain = domain; 228 sd->domain = domain;
215 sd->node = -1; 229 sd->node = node;
216
217 pxm = acpi_get_pxm(device->handle);
218#ifdef CONFIG_ACPI_NUMA
219 if (pxm >= 0)
220 sd->node = pxm_to_node(pxm);
221#endif
222 /* 230 /*
223 * Maybe the desired pci bus has been already scanned. In such case 231 * Maybe the desired pci bus has been already scanned. In such case
224 * it is unnecessary to scan the pci bus with the given domain,busnum. 232 * it is unnecessary to scan the pci bus with the given domain,busnum.
@@ -238,9 +246,9 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
238 kfree(sd); 246 kfree(sd);
239 247
240#ifdef CONFIG_ACPI_NUMA 248#ifdef CONFIG_ACPI_NUMA
241 if (bus != NULL) { 249 if (bus) {
242 if (pxm >= 0) { 250 if (pxm >= 0) {
243 printk("bus %d -> pxm %d -> node %d\n", 251 printk(KERN_DEBUG "bus %02x -> pxm %d -> node %d\n",
244 busnum, pxm, pxm_to_node(pxm)); 252 busnum, pxm, pxm_to_node(pxm));
245 } 253 }
246 } 254 }
@@ -248,7 +256,6 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
248 256
249 if (bus && (pci_probe & PCI_USE__CRS)) 257 if (bus && (pci_probe & PCI_USE__CRS))
250 get_current_resources(device, busnum, domain, bus); 258 get_current_resources(device, busnum, domain, bus);
251
252 return bus; 259 return bus;
253} 260}
254 261