Thread (7 messages) 7 messages, 2 authors, 2021-08-16
STALE1809d

[PATCH] PCI: of: Fix MSI domain lookup with child bus nodes

From: Rob Herring <robh@kernel.org>
Date: 2021-08-13 16:03:01
Subsystem: pci subsystem, the rest · Maintainers: Bjorn Helgaas, Linus Torvalds

When a DT contains PCI child bus nodes, lookup of the MSI domain on PCI
buses fails resulting in the following warnings:

WARNING: CPU: 4 PID: 7 at include/linux/msi.h:256 __pci_enable_msi_range+0x398/0x59c

The issue is that pci_host_bridge_of_msi_domain() will check the DT node of
the passed in bus even if it's not the host bridge's bus. Based on the
name of the function, that's clearly not what we want. Fix this by
walking the bus parents to the root bus.

Reported-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Lorenzo Pieralisi <redacted>
Signed-off-by: Rob Herring <robh@kernel.org>
---
Compile tested only. Mauro, Can you see if this fixes your issue.

 drivers/pci/of.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/drivers/pci/of.c b/drivers/pci/of.c
index a143b02b2dcd..ea70aede054c 100644
--- a/drivers/pci/of.c
+++ b/drivers/pci/of.c
@@ -84,6 +84,10 @@ struct irq_domain *pci_host_bridge_of_msi_domain(struct pci_bus *bus)
 	if (!bus->dev.of_node)
 		return NULL;
 
+	/* Find the host bridge bus */
+	while (!pci_is_root_bus(bus))
+		bus = bus->parent;
+
 	/* Start looking for a phandle to an MSI controller. */
 	d = of_msi_get_domain(&bus->dev, bus->dev.of_node, DOMAIN_BUS_PCI_MSI);
 	if (d)
-- 
2.30.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help