@@ -1044,12 +1044,20 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
struct resource *r = &dev->resource[i];
resource_size_t r_size;
- if (r->parent || (r->flags & IORESOURCE_PCI_FIXED) ||
+ if (r->parent ||
((r->flags & mask) != type &&
(r->flags & mask) != type2 &&
(r->flags & mask) != type3))
continue;
r_size = resource_size(r);
+
+ if (r->flags & IORESOURCE_PCI_FIXED) {
+ if (pci_movable_bars_enabled())
+ size += r_size;
+
+ continue;
+ }
+
#ifdef CONFIG_PCI_IOV
/* put SRIOV requested res to the optional list */
if (realloc_head && i >= PCI_IOV_RESOURCES &&
@@ -1383,6 +1391,8 @@ static void pdev_assign_fixed_resources(struct pci_dev *dev)
while (b && !r->parent) {
assign_fixed_resource_on_bus(b, r);
b = b->parent;
+ if (!r->parent && pci_movable_bars_enabled())
+ break;
}
}
}
The only difference between the fixed and movable BARs is an offset preservation during the release+reassign procedure on PCIe rescan. When fixed BARs are included into the result of pbus_size_mem(), these BARs can be restricted: assign them to direct parents only. Signed-off-by: Sergey Miroshnichenko <s.miroshnichenko@yadro.com> --- drivers/pci/setup-bus.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)