@@ -483,6 +483,13 @@ static void pci_restore_bars(struct pci_dev *dev)
{
int i;
+ /*
+ * Per SRIOV SPEC 3.4.1.11, VF BARs are RO zero.
+ * If this is a VF, just return.
+ */
+ if (dev->is_virtfn)
+ return;
+
for (i = 0; i < PCI_BRIDGE_RESOURCES; i++)
pci_update_resource(dev, i);
}
@@ -36,6 +36,11 @@ void pci_update_resource(struct pci_dev *dev, int resno)
enum pci_bar_type type;
struct resource *res = dev->resource + resno;
+ if (dev->is_virtfn) {
+ dev_warn(&dev->dev, "Trying to update VF BAR\n");
+ return;
+ }
+
/*
* Ignore resources for unimplemented BARs and unused resource slots
* for 64 bit BARs.
VF BARs are RO zero, so updating VF BARs will not take any effect. See the SR-IOV spec r1.1, sec 3.4.1.11. Also this patch adds a warning in pci_update_resource() in case someone really tries to update it. Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com> --- drivers/pci/pci.c | 7 +++++++ drivers/pci/setup-res.c | 5 +++++ 2 files changed, 12 insertions(+)