Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1241095
| From | David Daney <ddaney.cavm@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v5 4/4] PCI: Handle Enhanced Allocation (EA) capability for SRIOV devices. |
| Date | 2015-10-07 02:00 +0200 |
| Message-ID | <qgKjg-4BH-13@gated-at.bofh.it> (permalink) |
| References | <qgKjf-4BH-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: David Daney <david.daney@cavium.com>
SRIOV 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>
---
drivers/pci/iov.c | 11 +++++++++--
drivers/pci/pci.c | 7 +++++++
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index ee0ebff..c789e68 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)) {
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 30a90d1..6c41585 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -2176,6 +2176,13 @@ 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_VIRT_MEM ||
+ prop == PCI_EA_P_VIRT_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
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v5 0/4] PCI: Add support for PCI Enhanced Allocation "BARs" David Daney <ddaney.cavm@gmail.com> - 2015-10-07 02:00 +0200
[PATCH v5 2/4] PCI: Add support for Enhanced Allocation devices David Daney <ddaney.cavm@gmail.com> - 2015-10-07 02:00 +0200
[PATCH v5 4/4] PCI: Handle Enhanced Allocation (EA) capability for SRIOV devices. David Daney <ddaney.cavm@gmail.com> - 2015-10-07 02:00 +0200
RE: [PATCH v5 0/4] PCI: Add support for PCI Enhanced Allocation "BARs" "Stalley, Sean" <sean.stalley@intel.com> - 2015-10-07 15:50 +0200
Re: [PATCH v5 0/4] PCI: Add support for PCI Enhanced Allocation "BARs" "Sean O. Stalley" <sean.stalley@intel.com> - 2015-10-14 18:30 +0200
Re: [PATCH v5 0/4] PCI: Add support for PCI Enhanced Allocation "BARs" Bjorn Helgaas <helgaas@kernel.org> - 2015-10-15 16:10 +0200
csiph-web