Skip to content

Commit 62d9a78

Browse files
Yongji Xiebjorn-helgaas
authored andcommitted
PCI: Ignore requested alignment for VF BARs
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 <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]>
1 parent f0b99f7 commit 62d9a78

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/pci/pci.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5049,6 +5049,15 @@ void pci_reassigndev_resource_alignment(struct pci_dev *dev)
50495049
resource_size_t align, size;
50505050
u16 command;
50515051

5052+
/*
5053+
* VF BARs are read-only zero according to SR-IOV spec r1.1, sec
5054+
* 3.4.1.11. Their resources are allocated from the space
5055+
* described by the VF BARx register in the PF's SR-IOV capability.
5056+
* We can't influence their alignment here.
5057+
*/
5058+
if (dev->is_virtfn)
5059+
return;
5060+
50525061
/* check if specified PCI is target device to reassign */
50535062
align = pci_specified_resource_alignment(dev);
50545063
if (!align)

0 commit comments

Comments
 (0)