summaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/pci.h
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2013-12-20 09:57:37 -0700
committerBjorn Helgaas <bhelgaas@google.com>2014-01-07 16:24:33 -0700
commitf75b99d5a77d63f20e07bd276d5a427808ac8ef6 (patch)
treed95860eb9124958ce6cda8cc927403c97ff3d358 /arch/x86/include/asm/pci.h
parent36e097a8a29761e0e2c951c0390f1057df248a87 (diff)
downloadop-kernel-dev-f75b99d5a77d63f20e07bd276d5a427808ac8ef6.zip
op-kernel-dev-f75b99d5a77d63f20e07bd276d5a427808ac8ef6.tar.gz
PCI: Enforce bus address limits in resource allocation
When allocating space for 32-bit BARs, we previously limited RESOURCE addresses so they would fit in 32 bits. However, the BUS address need not be the same as the resource address, and it's the bus address that must fit in the 32-bit BAR. This patch adds: - pci_clip_resource_to_region(), which clips a resource so it contains only the range that maps to the specified bus address region, e.g., to clip a resource to 32-bit bus addresses, and - pci_bus_alloc_from_region(), which allocates space for a resource from the specified bus address region, and changes pci_bus_alloc_resource() to allocate space for 64-bit BARs from the entire bus address region, and space for 32-bit BARs from only the bus address region below 4GB. If we had this window: pci_root HWP0002:0a: host bridge window [mem 0xf0180000000-0xf01fedfffff] (bus address [0x80000000-0xfedfffff]) we previously could not put a 32-bit BAR there, because the CPU addresses don't fit in 32 bits. This patch fixes this, so we can use this space for 32-bit BARs. It's also possible (though unlikely) to have resources with 32-bit CPU addresses but bus addresses above 4GB. In this case the previous code would allocate space that a 32-bit BAR could not map. Remove PCIBIOS_MAX_MEM_32, which is no longer used. [bhelgaas: reworked starting from http://lkml.kernel.org/r/1386658484-15774-3-git-send-email-yinghai@kernel.org] Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'arch/x86/include/asm/pci.h')
-rw-r--r--arch/x86/include/asm/pci.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index 947b5c4..122c299 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -125,7 +125,6 @@ int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc,
/* generic pci stuff */
#include <asm-generic/pci.h>
-#define PCIBIOS_MAX_MEM_32 0xffffffff
#ifdef CONFIG_NUMA
/* Returns the node based on pci bus */
OpenPOWER on IntegriCloud