aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/iov.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/iov.c')
-rw-r--r--drivers/pci/iov.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index 6bacb8995e96..677924ae0350 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -1,3 +1,4 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * drivers/pci/iov.c 3 * drivers/pci/iov.c
3 * 4 *
@@ -259,19 +260,19 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
259 nres++; 260 nres++;
260 } 261 }
261 if (nres != iov->nres) { 262 if (nres != iov->nres) {
262 dev_err(&dev->dev, "not enough MMIO resources for SR-IOV\n"); 263 pci_err(dev, "not enough MMIO resources for SR-IOV\n");
263 return -ENOMEM; 264 return -ENOMEM;
264 } 265 }
265 266
266 bus = pci_iov_virtfn_bus(dev, nr_virtfn - 1); 267 bus = pci_iov_virtfn_bus(dev, nr_virtfn - 1);
267 if (bus > dev->bus->busn_res.end) { 268 if (bus > dev->bus->busn_res.end) {
268 dev_err(&dev->dev, "can't enable %d VFs (bus %02x out of range of %pR)\n", 269 pci_err(dev, "can't enable %d VFs (bus %02x out of range of %pR)\n",
269 nr_virtfn, bus, &dev->bus->busn_res); 270 nr_virtfn, bus, &dev->bus->busn_res);
270 return -ENOMEM; 271 return -ENOMEM;
271 } 272 }
272 273
273 if (pci_enable_resources(dev, bars)) { 274 if (pci_enable_resources(dev, bars)) {
274 dev_err(&dev->dev, "SR-IOV: IOV BARS not allocated\n"); 275 pci_err(dev, "SR-IOV: IOV BARS not allocated\n");
275 return -ENOMEM; 276 return -ENOMEM;
276 } 277 }
277 278
@@ -298,7 +299,7 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
298 299
299 rc = pcibios_sriov_enable(dev, initial); 300 rc = pcibios_sriov_enable(dev, initial);
300 if (rc) { 301 if (rc) {
301 dev_err(&dev->dev, "failure %d from pcibios_sriov_enable()\n", rc); 302 pci_err(dev, "failure %d from pcibios_sriov_enable()\n", rc);
302 goto err_pcibios; 303 goto err_pcibios;
303 } 304 }
304 305
@@ -432,7 +433,7 @@ found:
432 } 433 }
433 iov->barsz[i] = resource_size(res); 434 iov->barsz[i] = resource_size(res);
434 res->end = res->start + resource_size(res) * total - 1; 435 res->end = res->start + resource_size(res) * total - 1;
435 dev_info(&dev->dev, "VF(n) BAR%d space: %pR (contains BAR%d for %d VFs)\n", 436 pci_info(dev, "VF(n) BAR%d space: %pR (contains BAR%d for %d VFs)\n",
436 i, res, i, total); 437 i, res, i, total);
437 i += bar64; 438 i += bar64;
438 nres++; 439 nres++;
@@ -636,6 +637,17 @@ void pci_restore_iov_state(struct pci_dev *dev)
636} 637}
637 638
638/** 639/**
640 * pci_vf_drivers_autoprobe - set PF property drivers_autoprobe for VFs
641 * @dev: the PCI device
642 * @auto_probe: set VF drivers auto probe flag
643 */
644void pci_vf_drivers_autoprobe(struct pci_dev *dev, bool auto_probe)
645{
646 if (dev->is_physfn)
647 dev->sriov->drivers_autoprobe = auto_probe;
648}
649
650/**
639 * pci_iov_bus_range - find bus range used by Virtual Function 651 * pci_iov_bus_range - find bus range used by Virtual Function
640 * @bus: the PCI bus 652 * @bus: the PCI bus
641 * 653 *