Commit 70675e0b authored by Wei Yang's avatar Wei Yang Committed by Bjorn Helgaas

PCI: Don't try to restore VF BARs

VF BARs are read-only zero, so updating VF BARs will not have any effect.
See the SR-IOV spec r1.1, sec 3.4.1.11.

Don't update VF BARs in pci_restore_bars().

This avoids spurious "BAR %d: error updating" messages that we see when
doing vfio pass-through after 6eb70187 ("vfio-pci: Move idle devices to
D3hot power state").

[bhelgaas: changelog, fix whitespace]
Signed-off-by: default avatarWei Yang <weiyang@linux.vnet.ibm.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent 6ff33f39
...@@ -484,7 +484,7 @@ int pci_wait_for_pending(struct pci_dev *dev, int pos, u16 mask) ...@@ -484,7 +484,7 @@ int pci_wait_for_pending(struct pci_dev *dev, int pos, u16 mask)
} }
/** /**
* pci_restore_bars - restore a devices BAR values (e.g. after wake-up) * pci_restore_bars - restore a device's BAR values (e.g. after wake-up)
* @dev: PCI device to have its BARs restored * @dev: PCI device to have its BARs restored
* *
* Restore the BAR values for a given device, so as to make it * Restore the BAR values for a given device, so as to make it
...@@ -494,6 +494,10 @@ static void pci_restore_bars(struct pci_dev *dev) ...@@ -494,6 +494,10 @@ static void pci_restore_bars(struct pci_dev *dev)
{ {
int i; int i;
/* Per SR-IOV spec 3.4.1.11, VF BARs are RO zero */
if (dev->is_virtfn)
return;
for (i = 0; i < PCI_BRIDGE_RESOURCES; i++) for (i = 0; i < PCI_BRIDGE_RESOURCES; i++)
pci_update_resource(dev, i); pci_update_resource(dev, i);
} }
......
...@@ -36,6 +36,11 @@ void pci_update_resource(struct pci_dev *dev, int resno) ...@@ -36,6 +36,11 @@ void pci_update_resource(struct pci_dev *dev, int resno)
enum pci_bar_type type; enum pci_bar_type type;
struct resource *res = dev->resource + resno; struct resource *res = dev->resource + resno;
if (dev->is_virtfn) {
dev_warn(&dev->dev, "can't update VF BAR%d\n", resno);
return;
}
/* /*
* Ignore resources for unimplemented BARs and unused resource slots * Ignore resources for unimplemented BARs and unused resource slots
* for 64 bit BARs. * for 64 bit BARs.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment