PCI: Ignore requested alignment for VF BARs
authorYongji Xie <xyjxie@linux.vnet.ibm.com>
Tue, 13 Sep 2016 09:00:32 +0000 (17:00 +0800)
committerBjorn Helgaas <bhelgaas@google.com>
Wed, 28 Sep 2016 22:17:20 +0000 (17:17 -0500)
Resource allocation for VFs is done via the VF BARx registers in the PF's
SR-IOV Capability, and the BARs in the VFs themselves are read-only zeros
(see SR-IOV spec r1.1, secs 3.3.14 and 3.4.1.11).

Even though the actual VF BARs are read-only zeros, the VF dev->resource[]
structs describe the space allocated for the VF (this is a piece of the
space described by the VF BARx register in the PF's SR-IOV capability).

It's meaningless to request additional alignment for a VF: the VF BAR
alignment is completely determined by the alignment of the VF BARx in the
PF and the size of the VF BAR.

Ignore the user's alignment requests for VF devices.

Signed-off-by: Yongji Xie <xyjxie@linux.vnet.ibm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/pci.c

index ed9447a..b5b8333 100644 (file)
@@ -5049,6 +5049,15 @@ void pci_reassigndev_resource_alignment(struct pci_dev *dev)
        resource_size_t align, size;
        u16 command;
 
+       /*
+        * VF BARs are read-only zero according to SR-IOV spec r1.1, sec
+        * 3.4.1.11.  Their resources are allocated from the space
+        * described by the VF BARx register in the PF's SR-IOV capability.
+        * We can't influence their alignment here.
+        */
+       if (dev->is_virtfn)
+               return;
+
        /* check if specified PCI is target device to reassign */
        align = pci_specified_resource_alignment(dev);
        if (!align)