On Thu, May 28, 2015 at 10:40:00PM -0700, Yinghai Lu wrote: >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. >During update the resource before reordering, it does not calculate >resource end correctly. > >We need to keep the original resource size before updating start. >otherwise we will smaller size during updating end. > >Fixes: d74b9027a4da ("PCI: Consider additional PF's IOV BAR alignment in sizing and assigning") >Signed-off-by: Yinghai Lu <yinghai@xxxxxxxxxx> >Cc: Wei Yang <weiyang@xxxxxxxxxxxxxxxxxx> >Cc: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx> Acked-by: Wei Yang <weiyang@xxxxxxxxxxxxxxxxxx> Thanks Yinghai, I have tested this on Power8, your code is correct. :-) > >--- > drivers/pci/setup-bus.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > >Index: linux-2.6/drivers/pci/setup-bus.c >=================================================================== >--- linux-2.6.orig/drivers/pci/setup-bus.c >+++ linux-2.6/drivers/pci/setup-bus.c >@@ -428,9 +428,10 @@ static void __assign_resources_sorted(st > * 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, -- Richard Yang Help you, Help me -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html