diff mbox

[v1,1/3] PCI: xilinx: Configure PCIe MPS settings

Message ID 20170208224930.14351.91597.stgit@bhelgaas-glaptop.roam.corp.google.com (mailing list archive)
State New, archived
Headers show

Commit Message

Bjorn Helgaas Feb. 8, 2017, 10:49 p.m. UTC
From: Bjorn Helgaas <bhelgaas@google.com>

Make sure PCIe MPS settings are valid when we enumerate a new hierarchy.

Based-on-patch-by: Jon Mason <jon.mason@broadcom.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/host/pcie-xilinx.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Christoph Hellwig Feb. 9, 2017, 7:19 a.m. UTC | #1
On Wed, Feb 08, 2017 at 04:49:30PM -0600, Bjorn Helgaas wrote:
> +	list_for_each_entry(child, &bus->children, node)
> +		pcie_bus_configure_settings(child);

This loop is duplicated in just about every driver, so it it
might be a good idea to provide a littler helper for it.
Bjorn Helgaas Feb. 10, 2017, 9:58 p.m. UTC | #2
On Wed, Feb 08, 2017 at 11:19:56PM -0800, Christoph Hellwig wrote:
> On Wed, Feb 08, 2017 at 04:49:30PM -0600, Bjorn Helgaas wrote:
> > +	list_for_each_entry(child, &bus->children, node)
> > +		pcie_bus_configure_settings(child);
> 
> This loop is duplicated in just about every driver, so it it
> might be a good idea to provide a littler helper for it.

Yeah, you're right.  One reason I didn't is because I would like to
remove these if we can move the MPS setup into the pci_device_add()
path.

We ought to be able to do at least the minimal "configure this new
device to match the existing hierarchy; if that's impossible, disable
the device" sort of thing there.

We probably would still want some sort of bus- or root port- or host
bridge-level configuration that can take a broader view, and that
might be done where we currently have this loop.  But I don't know 
exactly what that should look like.

Bjorn
diff mbox

Patch

diff --git a/drivers/pci/host/pcie-xilinx.c b/drivers/pci/host/pcie-xilinx.c
index c8616fadccf1..7f030f5d750b 100644
--- a/drivers/pci/host/pcie-xilinx.c
+++ b/drivers/pci/host/pcie-xilinx.c
@@ -632,7 +632,7 @@  static int xilinx_pcie_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct xilinx_pcie_port *port;
-	struct pci_bus *bus;
+	struct pci_bus *bus, *child;
 	int err;
 	resource_size_t iobase = 0;
 	LIST_HEAD(res);
@@ -686,6 +686,8 @@  static int xilinx_pcie_probe(struct platform_device *pdev)
 #ifndef CONFIG_MICROBLAZE
 	pci_fixup_irqs(pci_common_swizzle, of_irq_parse_and_map_pci);
 #endif
+	list_for_each_entry(child, &bus->children, node)
+		pcie_bus_configure_settings(child);
 	pci_bus_add_devices(bus);
 	return 0;