Commit 5e316d34 authored by Andrea della Porta's avatar Andrea della Porta Committed by Bjorn Helgaas
Browse files

PCI: of_property: Assign PCI instead of CPU bus address to dynamic PCI nodes

When populating "ranges" property for a PCI bridge or endpoint,
of_pci_prop_ranges() incorrectly uses the CPU 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.

[Previous discussion at:
https://lore.kernel.org/all/8b4fa91380fc4754ea80f47330c613e4f6b6592c.1724159867.git.andrea.porta@suse.com/]

Link: https://lore.kernel.org/r/20241108094256.28933-1-andrea.porta@suse.com


Fixes: 407d1a51 ("PCI: Create device tree node for bridge")
Tested-by: default avatarHerve Codina <herve.codina@bootlin.com>
Signed-off-by: default avatarAndrea della Porta <andrea.porta@suse.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Cc: stable@vger.kernel.org
parent 9852d85e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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)) {