Patchwork [RFC,v3,03/21] PCI: Enable bridge's I/O and MEM access for hotplugged devices

login
register
mail settings
Submitter Sergey Miroshnichenko
Date Feb. 4, 2019, 3:35 p.m.
Message ID <20190204153601.7576-4-s.miroshnichenko@yadro.com>
Download mbox | patch
Permalink /patch/717445/
State New
Headers show

Comments

Sergey Miroshnichenko - Feb. 4, 2019, 3:35 p.m.
After updating the bridge window resources, the PCI_COMMAND_IO and
PCI_COMMAND_MEMORY bits of the bridge must be addressed as well.

Signed-off-by: Sergey Miroshnichenko <s.miroshnichenko@yadro.com>
---
 drivers/pci/pci.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Patch

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 3a83e05f8363..55cf18389c15 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1578,6 +1578,14 @@  static void pci_enable_bridge(struct pci_dev *dev)
 		pci_enable_bridge(bridge);
 
 	if (pci_is_enabled(dev)) {
+		int i, bars = 0;
+
+		for (i = PCI_BRIDGE_RESOURCES; i < DEVICE_COUNT_RESOURCE; i++) {
+			if (dev->resource[i].flags & (IORESOURCE_MEM | IORESOURCE_IO))
+				bars |= (1 << i);
+		}
+		do_pci_enable_device(dev, bars);
+
 		if (!dev->is_busmaster)
 			pci_set_master(dev);
 		mutex_unlock(&dev->enable_mutex);