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

PCI: Turn on reallocation for unassigned resources with host bridge offset

Previously we did not turn on automatic PCI resource reallocation for
unassigned IOV resources behind a host bridge with address offset.  This
patch fixes that bug.

The intent was that "!r->start" would check for a BAR containing zero.  But
that check is incorrect for host bridges that apply an offset, because in
that case the resource address is not the same as the bus address.

This patch fixes that by converting the resource address back to a bus
address before checking for zero.

[bhelgaas: changelog]
Suggested-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: NYinghai Lu <yinghai@kernel.org>
Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
上级 223d96fc
无相关合并请求
...@@ -1367,9 +1367,14 @@ static int __init iov_resources_unassigned(struct pci_dev *dev, void *data) ...@@ -1367,9 +1367,14 @@ static int __init iov_resources_unassigned(struct pci_dev *dev, void *data)
for (i = PCI_IOV_RESOURCES; i <= PCI_IOV_RESOURCE_END; i++) { for (i = PCI_IOV_RESOURCES; i <= PCI_IOV_RESOURCE_END; i++) {
struct resource *r = &dev->resource[i]; struct resource *r = &dev->resource[i];
struct pci_bus_region region;
/* Not assigned or rejected by kernel? */ /* Not assigned or rejected by kernel? */
if (r->flags && !r->start) { if (!r->flags)
continue;
pcibios_resource_to_bus(dev, &region, r);
if (!region.start) {
*unassigned = true; *unassigned = true;
return 1; /* return early from pci_walk_bus() */ return 1; /* return early from pci_walk_bus() */
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部