diff options
author | Yinghai Lu <yinghai@kernel.org> | 2015-05-28 22:40:00 -0700 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2015-06-01 17:56:32 -0500 |
commit | 552bc94ebeeb189d0ac682dae95cf05e6b72d7fd (patch) | |
tree | 82b46e686bc0b87cab90f337eabda13004dfc0ad /drivers/pci | |
parent | a6b65983dabceb7ccb1801ee7f5bd421c2704d16 (diff) | |
download | linux-stable-552bc94ebeeb189d0ac682dae95cf05e6b72d7fd.tar.gz linux-stable-552bc94ebeeb189d0ac682dae95cf05e6b72d7fd.tar.bz2 linux-stable-552bc94ebeeb189d0ac682dae95cf05e6b72d7fd.zip |
PCI: Preserve resource size during alignment reordering
In d74b9027a4da ("PCI: Consider additional PF's IOV BAR alignment in sizing
and assigning"), we store additional alignment in realloc_head and take
this into consideration for assignment.
In __assign_resources_sorted(), we changed dev_res->res->start, then used
resource_start() (which depends on res->start), so the recomputed res->end
was completely bogus. Even if we'd had the correct size, the end would
have been off by one.
Preserve the resource size when we adjust its alignment.
[bhelgaas: changelog]
Fixes: d74b9027a4da ("PCI: Consider additional PF's IOV BAR alignment in sizing and assigning")
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Wei Yang <weiyang@linux.vnet.ibm.com>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/setup-bus.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index aa281d909eb0..508cc56130e3 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -428,9 +428,10 @@ static void __assign_resources_sorted(struct list_head *head, * consistent. */ if (add_align > dev_res->res->start) { + resource_size_t r_size = resource_size(dev_res->res); + dev_res->res->start = add_align; - dev_res->res->end = add_align + - resource_size(dev_res->res); + dev_res->res->end = add_align + r_size - 1; list_for_each_entry(dev_res2, head, list) { align = pci_resource_alignment(dev_res2->dev, |