]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[IA64] pcibus_to_node implementation for IA64
authorChristoph Lameter <clameter@sgi.com>
Thu, 7 Jul 2005 23:59:00 +0000 (16:59 -0700)
committerTony Luck <tony.luck@intel.com>
Tue, 12 Jul 2005 18:04:22 +0000 (11:04 -0700)
pcibus_to_node provides a way for the Linux kernel to identify to which
node a certain pcibus connects to. Allocations of control structures
for devices can then be made on the node where the pci bus is located
to allow local access during interrupt and other device manipulation.

This patch provides a new "node" field in the the pci_controller
structure. The node field will be set based on ACPI information (thanks
to Alex Williamson  <alex.williamson@hp.com for that piece).

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
arch/ia64/pci/pci.c
include/asm-ia64/pci.h
include/asm-ia64/topology.h

index 720a861f88be283675a5b568bbf8837950e31d72..54d9ed444e4a11343a11674ac9c6d5e53d1b6729 100644 (file)
@@ -157,6 +157,7 @@ alloc_pci_controller (int seg)
 
        memset(controller, 0, sizeof(*controller));
        controller->segment = seg;
+       controller->node = -1;
        return controller;
 }
 
@@ -288,6 +289,7 @@ pci_acpi_scan_root(struct acpi_device *device, int domain, int bus)
        unsigned int windows = 0;
        struct pci_bus *pbus;
        char *name;
+       int pxm;
 
        controller = alloc_pci_controller(domain);
        if (!controller)
@@ -295,10 +297,16 @@ pci_acpi_scan_root(struct acpi_device *device, int domain, int bus)
 
        controller->acpi_handle = device->handle;
 
+       pxm = acpi_get_pxm(controller->acpi_handle);
+#ifdef CONFIG_NUMA
+       if (pxm >= 0)
+               controller->node = pxm_to_nid_map[pxm];
+#endif
+
        acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window,
                        &windows);
-       controller->window = kmalloc(sizeof(*controller->window) * windows,
-                       GFP_KERNEL);
+       controller->window = kmalloc_node(sizeof(*controller->window) * windows,
+                       GFP_KERNEL, controller->node);
        if (!controller->window)
                goto out2;
 
index 0c4c5d801d3f8d3893ca02057d960f3fadc54c96..8b7237cc84c17d55c01ac12af9dbd2f9fb8016ab 100644 (file)
@@ -128,6 +128,7 @@ struct pci_controller {
        void *acpi_handle;
        void *iommu;
        int segment;
+       int node;               /* nearest node with memory or -1 for global allocation */
 
        unsigned int windows;
        struct pci_window *window;
index 4e64c2a6b36913a5f2a0da25c9c7195ff39d747f..399bc29729fd2c532b20d472fcb208b83be35fa2 100644 (file)
  */
 #define node_to_first_cpu(node) (__ffs(node_to_cpumask(node)))
 
+/*
+ * Determines the node for a given pci bus
+ */
+#define pcibus_to_node(bus) PCI_CONTROLLER(bus)->node
+
 void build_cpu_to_node_map(void);
 
 #define SD_CPU_INIT (struct sched_domain) {            \