aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/pci/common.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/common.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/common.c')
-rw-r--r--arch/x86/pci/common.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 75fcc29ecf52..07d53184f7a4 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -342,9 +342,14 @@ struct pci_bus * __devinit pcibios_scan_root(int busnum)
342 return NULL; 342 return NULL;
343 } 343 }
344 344
345 sd->node = get_mp_bus_to_node(busnum);
346
345 printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum); 347 printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum);
348 bus = pci_scan_bus_parented(NULL, busnum, &pci_root_ops, sd);
349 if (!bus)
350 kfree(sd);
346 351
347 return pci_scan_bus_parented(NULL, busnum, &pci_root_ops, sd); 352 return bus;
348} 353}
349 354
350extern u8 pci_cache_line_size; 355extern u8 pci_cache_line_size;
@@ -480,7 +485,7 @@ void pcibios_disable_device (struct pci_dev *dev)
480 pcibios_disable_irq(dev); 485 pcibios_disable_irq(dev);
481} 486}
482 487
483struct pci_bus *__devinit pci_scan_bus_with_sysdata(int busno) 488struct pci_bus *pci_scan_bus_on_node(int busno, struct pci_ops *ops, int node)
484{ 489{
485 struct pci_bus *bus = NULL; 490 struct pci_bus *bus = NULL;
486 struct pci_sysdata *sd; 491 struct pci_sysdata *sd;
@@ -495,10 +500,15 @@ struct pci_bus *__devinit pci_scan_bus_with_sysdata(int busno)
495 printk(KERN_ERR "PCI: OOM, skipping PCI bus %02x\n", busno); 500 printk(KERN_ERR "PCI: OOM, skipping PCI bus %02x\n", busno);
496 return NULL; 501 return NULL;
497 } 502 }
498 sd->node = -1; 503 sd->node = node;
499 bus = pci_scan_bus(busno, &pci_root_ops, sd); 504 bus = pci_scan_bus(busno, ops, sd);
500 if (!bus) 505 if (!bus)
501 kfree(sd); 506 kfree(sd);
502 507
503 return bus; 508 return bus;
504} 509}
510
511struct pci_bus *pci_scan_bus_with_sysdata(int busno)
512{
513 return pci_scan_bus_on_node(busno, &pci_root_ops, -1);
514}