提交 552bc94e 编写于 作者: Y Yinghai Lu 提交者: Bjorn Helgaas

PCI: Preserve resource size during alignment reordering

In d74b9027 ("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: d74b9027 ("PCI: Consider additional PF's IOV BAR alignment in sizing and assigning")
Signed-off-by: NYinghai Lu <yinghai@kernel.org>
Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
Acked-by: NWei Yang <weiyang@linux.vnet.ibm.com>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
上级 a6b65983
...@@ -428,9 +428,10 @@ static void __assign_resources_sorted(struct list_head *head, ...@@ -428,9 +428,10 @@ static void __assign_resources_sorted(struct list_head *head,
* consistent. * consistent.
*/ */
if (add_align > dev_res->res->start) { 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->start = add_align;
dev_res->res->end = add_align + dev_res->res->end = add_align + r_size - 1;
resource_size(dev_res->res);
list_for_each_entry(dev_res2, head, list) { list_for_each_entry(dev_res2, head, list) {
align = pci_resource_alignment(dev_res2->dev, align = pci_resource_alignment(dev_res2->dev,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册