summary refs log tree commit diff
path: root/drivers/pci/iov.c
diff options
context:
space:
mode:
authorDavid Daney <david.daney@cavium.com>2015-10-29 17:35:40 -0500
committerBjorn Helgaas <bhelgaas@google.com>2015-10-29 17:35:40 -0500
commit111839917fccf4f74d50ad937321acc6a07eb9c3 (patch)
tree7536a1ef0d1fee3a9100ec75ee370de283d4c9d6 /drivers/pci/iov.c
parent938174e59f83354251a75a2b90171e0ffdf6f1d7 (diff)
downloadlinux-111839917fccf4f74d50ad937321acc6a07eb9c3.tar.gz
PCI: Handle Enhanced Allocation capability for SR-IOV devices
SR-IOV BARs can be specified via EA entries.  Extend the EA parser to
extract the SRIOV BAR resources, and modify sriov_init() to use resources
previously obtained via EA.

Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Sean O. Stalley <sean.stalley@intel.com>
Diffstat (limited to 'drivers/pci/iov.c')
-rw-r--r--drivers/pci/iov.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index ee0ebff103a4..c789e68df358 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -436,8 +436,15 @@ found:
 	nres = 0;
 	for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) {
 		res = &dev->resource[i + PCI_IOV_RESOURCES];
-		bar64 = __pci_read_base(dev, pci_bar_unknown, res,
-					pos + PCI_SRIOV_BAR + i * 4);
+		/*
+		 * If it is already FIXED, don't change it, something
+		 * (perhaps EA or header fixups) wants it this way.
+		 */
+		if (res->flags & IORESOURCE_PCI_FIXED)
+			bar64 = (res->flags & IORESOURCE_MEM_64) ? 1 : 0;
+		else
+			bar64 = __pci_read_base(dev, pci_bar_unknown, res,
+						pos + PCI_SRIOV_BAR + i * 4);
 		if (!res->flags)
 			continue;
 		if (resource_size(res) & (PAGE_SIZE - 1)) {