[PATCH v5 08/23] PCI: Include fixed and immovable BARs into the bus size calculating
Sergey Miroshnichenko
s.miroshnichenko at yadro.com
Sat Aug 17 02:50:46 AEST 2019
The only difference between the fixed/immovable and movable BARs is a size
and offset preservation after they are released (the corresponding struct
resource* detached from a bridge window for a while during a bus rescan).
Include fixed/immovable BARs into result of pbus_size_mem() and prohibit
assigning them to non-direct parents.
Signed-off-by: Sergey Miroshnichenko <s.miroshnichenko at yadro.com>
---
drivers/pci/setup-bus.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 1a731002ce18..2c250efca512 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -1011,12 +1011,21 @@ 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) ||
+ !pci_dev_movable_bars_supported(dev)) {
+ 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 &&
--
2.21.0
More information about the Linuxppc-dev
mailing list