diff options
author | Wei Yang <weiyang@linux.vnet.ibm.com> | 2015-05-19 06:24:17 (GMT) |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2015-05-27 16:47:17 (GMT) |
commit | a6b65983dabceb7ccb1801ee7f5bd421c2704d16 (patch) | |
tree | 04d4f169875b6839c5e801534f2a072c906a58b5 | |
parent | 110baab1d12836508c68a36cd5bb2e76896f2efd (diff) | |
download | linux-a6b65983dabceb7ccb1801ee7f5bd421c2704d16.tar.xz |
PCI: Fix IOV resource sorting by alignment requirement
In d74b9027a4da ("PCI: Consider additional PF's IOV BAR alignment in sizing
and assigning"), it stores additional alignment in realloc_head and takes
this into consideration for assignment.
After getting the additional alignment, it reorders the head list so
resources with bigger alignment are ahead of resources with smaller
alignment. It does this by iterating over the head list and inserting
ahead of any resource with smaller alignment. This should be done for the
first occurrence, but the code currently iterates over the whole list.
Fix this by terminating the loop when we find the first smaller resource in
the head list.
[bhelgaas: changelog]
Fixes: d74b9027a4da ("PCI: Consider additional PF's IOV BAR alignment in sizing and assigning")
Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r-- | drivers/pci/setup-bus.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 4fd0cac..aa281d9 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -435,9 +435,11 @@ static void __assign_resources_sorted(struct list_head *head, list_for_each_entry(dev_res2, head, list) { align = pci_resource_alignment(dev_res2->dev, dev_res2->res); - if (add_align > align) + if (add_align > align) { list_move_tail(&dev_res->list, &dev_res2->list); + break; + } } } |