]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
PCI: Handle Enhanced Allocation capability for SR-IOV devices
authorDavid Daney <david.daney@cavium.com>
Thu, 29 Oct 2015 22:35:40 +0000 (17:35 -0500)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 29 Oct 2015 22:35:40 +0000 (17:35 -0500)
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>
drivers/pci/iov.c
drivers/pci/pci.c

index ee0ebff103a412bc3db69c05f0a30ecc1872be48..c789e68df3581cb0c5bca1b233654a9a476b2e9b 100644 (file)
@@ -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)) {
index 8d796c02ee9022f079e71f3270cce1b956480678..364f98b301302e80f80727f57f39fd5cd0e87318 100644 (file)
@@ -2176,6 +2176,12 @@ static struct resource *pci_ea_get_resource(struct pci_dev *dev, u8 bei,
 {
        if (bei <= PCI_EA_BEI_BAR5 && prop <= PCI_EA_P_IO)
                return &dev->resource[bei];
+#ifdef CONFIG_PCI_IOV
+       else if (bei >= PCI_EA_BEI_VF_BAR0 && bei <= PCI_EA_BEI_VF_BAR5 &&
+                (prop == PCI_EA_P_VF_MEM || prop == PCI_EA_P_VF_MEM_PREFETCH))
+               return &dev->resource[PCI_IOV_RESOURCES +
+                                     bei - PCI_EA_BEI_VF_BAR0];
+#endif
        else if (bei == PCI_EA_BEI_ROM)
                return &dev->resource[PCI_ROM_RESOURCE];
        else