Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 68f8e9fa authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by Benjamin Herrenschmidt
Browse files

PCI: Print more info in sriov_enable() error message



If we don't have space for all the bus numbers required to enable VFs,
print the largest bus number required and the range available.

No functional change; improved error message only.

Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Acked-by: default avatarWei Yang <weiyang@linux.vnet.ibm.com>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent c6406d8f
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -180,6 +180,7 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
	struct pci_dev *pdev;
	struct pci_dev *pdev;
	struct pci_sriov *iov = dev->sriov;
	struct pci_sriov *iov = dev->sriov;
	int bars = 0;
	int bars = 0;
	u8 bus;


	if (!nr_virtfn)
	if (!nr_virtfn)
		return 0;
		return 0;
@@ -216,8 +217,10 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
	iov->offset = offset;
	iov->offset = offset;
	iov->stride = stride;
	iov->stride = stride;


	if (virtfn_bus(dev, nr_virtfn - 1) > dev->bus->busn_res.end) {
	bus = virtfn_bus(dev, nr_virtfn - 1);
		dev_err(&dev->dev, "SR-IOV: bus number out of range\n");
	if (bus > dev->bus->busn_res.end) {
		dev_err(&dev->dev, "can't enable %d VFs (bus %02x out of range of %pR)\n",
			nr_virtfn, bus, &dev->bus->busn_res);
		return -ENOMEM;
		return -ENOMEM;
	}
	}