linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: of_property: Assign PCI instead of CPU bus address to dynamic PCI nodes
@ 2024-11-08  9:42 Andrea della Porta
  2024-11-08 10:09 ` Herve Codina
  2024-11-15 17:25 ` Bjorn Helgaas
  0 siblings, 2 replies; 6+ messages in thread
From: Andrea della Porta @ 2024-11-08  9:42 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Florian Fainelli,
	Broadcom internal kernel review list, Lorenzo Pieralisi,
	Krzysztof Wilczynski, Manivannan Sadhasivam, Bjorn Helgaas,
	Linus Walleij, Catalin Marinas, Will Deacon, Bartosz Golaszewski,
	Derek Kiernan, Dragan Cvetic, Arnd Bergmann, Greg Kroah-Hartman,
	Saravana Kannan, linux-clk, devicetree, linux-rpi-kernel,
	linux-arm-kernel, linux-kernel, linux-pci, linux-gpio,
	Masahiro Yamada, Stefan Wahren, Herve Codina, Luca Ceresoli,
	Thomas Petazzoni, Andrew Lunn
  Cc: Andrea della Porta, stable

When populating "ranges" property for a PCI bridge or endpoint,
of_pci_prop_ranges() incorrectly use the CPU bus address of the resource.
In such PCI nodes, the window should instead be in PCI address space. Call
pci_bus_address() on the resource in order to obtain the PCI bus
address.

Fixes: 407d1a51921e ("PCI: Create device tree node for bridge")
Cc: stable@vger.kernel.org
Signed-off-by: Andrea della Porta <andrea.porta@suse.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Tested-by: Herve Codina <herve.codina@bootlin.com>
---
This patch, originally preparatory for a bigger patchset (see [1]), has
been splitted in a standalone one for better management and because it
contains a bugfix which is probably of interest to stable branch.

 drivers/pci/of_property.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/of_property.c b/drivers/pci/of_property.c
index 5a0b98e69795..886c236e5de6 100644
--- a/drivers/pci/of_property.c
+++ b/drivers/pci/of_property.c
@@ -126,7 +126,7 @@ static int of_pci_prop_ranges(struct pci_dev *pdev, struct of_changeset *ocs,
 		if (of_pci_get_addr_flags(&res[j], &flags))
 			continue;
 
-		val64 = res[j].start;
+		val64 = pci_bus_address(pdev, &res[j] - pdev->resource);
 		of_pci_set_address(pdev, rp[i].parent_addr, val64, 0, flags,
 				   false);
 		if (pci_is_bridge(pdev)) {
-- 
2.35.3



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-11-15 17:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-08  9:42 [PATCH] PCI: of_property: Assign PCI instead of CPU bus address to dynamic PCI nodes Andrea della Porta
2024-11-08 10:09 ` Herve Codina
2024-11-08 10:14   ` Andrea della Porta
2024-11-14 15:26     ` Andrea della Porta
2024-11-14 15:45       ` Herve Codina
2024-11-15 17:25 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).