From 10ee3d7032562d6094d3ee7de84af93fcc0250c7 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Fri, 24 Jan 2014 14:42:33 -0700 Subject: ia64 / sba_iommu: Use NUMA_NO_NODE, not MAX_NUMNODES, for unknown node MAX_NUMNODES is typically used for sizing arrays. NUMA_NO_NODE is the usual value for "we don't know what node this is on," e.g., it is the error return from acpi_get_node(). This changes the ioc->node value for unknown nodes from MAX_NUMNODES to NUMA_NO_NODE. Signed-off-by: Bjorn Helgaas Acked-by: Rafael J. Wysocki --- arch/ia64/hp/common/sba_iommu.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'arch/ia64/hp') diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c index 8e858b593e4f..a52d6b49b7ce 100644 --- a/arch/ia64/hp/common/sba_iommu.c +++ b/arch/ia64/hp/common/sba_iommu.c @@ -1140,11 +1140,13 @@ sba_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, #ifdef CONFIG_NUMA { + int node = ioc->node; struct page *page; - page = alloc_pages_exact_node(ioc->node == MAX_NUMNODES ? - numa_node_id() : ioc->node, flags, - get_order(size)); + if (node == NUMA_NO_NODE) + node = numa_node_id(); + + page = alloc_pages_exact_node(node, flags, get_order(size)); if (unlikely(!page)) return NULL; @@ -1914,7 +1916,7 @@ ioc_show(struct seq_file *s, void *v) seq_printf(s, "Hewlett Packard %s IOC rev %d.%d\n", ioc->name, ((ioc->rev >> 4) & 0xF), (ioc->rev & 0xF)); #ifdef CONFIG_NUMA - if (ioc->node != MAX_NUMNODES) + if (ioc->node != NUMA_NO_NODE) seq_printf(s, "NUMA node : %d\n", ioc->node); #endif seq_printf(s, "IOVA size : %ld MB\n", ((ioc->pdir_size >> 3) * iovp_size)/(1024*1024)); @@ -2022,7 +2024,7 @@ sba_map_ioc_to_node(struct ioc *ioc, acpi_handle handle) unsigned int node; int pxm; - ioc->node = MAX_NUMNODES; + ioc->node = NUMA_NO_NODE; pxm = acpi_get_pxm(handle); @@ -2031,7 +2033,7 @@ sba_map_ioc_to_node(struct ioc *ioc, acpi_handle handle) node = pxm_to_node(pxm); - if (node >= MAX_NUMNODES || !node_online(node)) + if (node == NUMA_NO_NODE || !node_online(node)) return; ioc->node = node; -- cgit From b1e9cee7f68620fa2a020e35b5fbe3c4cc780e84 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Fri, 24 Jan 2014 15:28:42 -0700 Subject: ia64: Remove acpi_get_pxm() usage The IOMMU, LSAPIC, IOSAPIC, and PCI host bridge code doesn't care about _PXM values directly; it only needs to know what NUMA node the hardware is on. This uses acpi_get_node() directly and removes the _PXM stuff. Signed-off-by: Bjorn Helgaas Acked-by: Rafael J. Wysocki --- arch/ia64/hp/common/sba_iommu.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'arch/ia64/hp') diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c index a52d6b49b7ce..007361d59aa6 100644 --- a/arch/ia64/hp/common/sba_iommu.c +++ b/arch/ia64/hp/common/sba_iommu.c @@ -2017,31 +2017,19 @@ sba_connect_bus(struct pci_bus *bus) printk(KERN_WARNING "No IOC for PCI Bus %04x:%02x in ACPI\n", pci_domain_nr(bus), bus->number); } -#ifdef CONFIG_NUMA static void __init sba_map_ioc_to_node(struct ioc *ioc, acpi_handle handle) { +#ifdef CONFIG_NUMA unsigned int node; - int pxm; - - ioc->node = NUMA_NO_NODE; - - pxm = acpi_get_pxm(handle); - - if (pxm < 0) - return; - node = pxm_to_node(pxm); - - if (node == NUMA_NO_NODE || !node_online(node)) - return; + node = acpi_get_node(handle); + if (node != NUMA_NO_NODE && !node_online(node)) + node = NUMA_NO_NODE; ioc->node = node; - return; -} -#else -#define sba_map_ioc_to_node(ioc, handle) #endif +} static int __init acpi_sba_ioc_add(struct acpi_device *device, -- cgit