@@ -4977,6 +4977,13 @@ static resource_size_t pci_specified_resource_alignment(struct pci_dev *dev)
49774977
49784978 spin_lock (& resource_alignment_lock );
49794979 p = resource_alignment_param ;
4980+ if (!* p )
4981+ goto out ;
4982+ if (pci_has_flag (PCI_PROBE_ONLY )) {
4983+ pr_info_once ("PCI: Ignoring requested alignments (PCI_PROBE_ONLY)\n" );
4984+ goto out ;
4985+ }
4986+
49804987 while (* p ) {
49814988 count = 0 ;
49824989 if (sscanf (p , "%d%n" , & align_order , & count ) == 1 &&
@@ -5041,6 +5048,7 @@ static resource_size_t pci_specified_resource_alignment(struct pci_dev *dev)
50415048 }
50425049 p ++ ;
50435050 }
5051+ out :
50445052 spin_unlock (& resource_alignment_lock );
50455053 return align ;
50465054}
@@ -5059,6 +5067,15 @@ void pci_reassigndev_resource_alignment(struct pci_dev *dev)
50595067 resource_size_t align , size ;
50605068 u16 command ;
50615069
5070+ /*
5071+ * VF BARs are read-only zero according to SR-IOV spec r1.1, sec
5072+ * 3.4.1.11. Their resources are allocated from the space
5073+ * described by the VF BARx register in the PF's SR-IOV capability.
5074+ * We can't influence their alignment here.
5075+ */
5076+ if (dev -> is_virtfn )
5077+ return ;
5078+
50625079 /* check if specified PCI is target device to reassign */
50635080 align = pci_specified_resource_alignment (dev );
50645081 if (!align )
@@ -5081,6 +5098,12 @@ void pci_reassigndev_resource_alignment(struct pci_dev *dev)
50815098 r = & dev -> resource [i ];
50825099 if (!(r -> flags & IORESOURCE_MEM ))
50835100 continue ;
5101+ if (r -> flags & IORESOURCE_PCI_FIXED ) {
5102+ dev_info (& dev -> dev , "Ignoring requested alignment for BAR%d: %pR\n" ,
5103+ i , r );
5104+ continue ;
5105+ }
5106+
50845107 size = resource_size (r );
50855108 if (size < align ) {
50865109 size = align ;
0 commit comments