[Skiboot] [PATCH 2/2] core/pci: Use PHB io-base-location by default for PHB slots

Oliver O'Halloran oohall at gmail.com
Tue Apr 23 17:56:07 AEST 2019

On witherspoon only the GPU slots and the three pluggable PCI slots
(SLOT0, 1, 2) have platform defined slot names. For builtin devices such
as the SATA controller or the PLX switch that fans out to the GPU slots
we have no location codes which some people consider an issue.

This patch address the problem by making the ibm,slot-location-code for
the root port device default to the ibm,io-base-location-code which is
typically the location code for the system itself.


pciex at 600c3c0100000/ibm,loc-code

pciex at 600c3c0100000/pci at 0/ibm,loc-code

pciex at 600c3c0100000/pci at 0/usb-xhci at 0/ibm,loc-code

The PHB node, and the root complex nodes have a loc code of the
processor they are attached to, while the usb-xhci device under the
root port has a location code of the system itself.

Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
 core/pci.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/core/pci.c b/core/pci.c
index ee563c2fc577..85f3f722bf38 100644
--- a/core/pci.c
+++ b/core/pci.c
@@ -1611,6 +1611,15 @@ static void __noinline pci_add_one_device_node(struct phb *phb,
 	if (pd->slot)
 		pci_slot_add_dt_properties(pd->slot, np);
+	/*
+	 * Use the phb base location code for root ports if the platform
+	 * doesn't provide one via slot->add_properties() operation.
+	 */
+	if (pd->dev_type == PCIE_TYPE_ROOT_PORT && phb->base_loc_code &&
+	    !dt_has_node_property(np, "ibm,slot-location-code", NULL))
+		dt_add_property_string(np, "ibm,slot-location-code",
+				       phb->base_loc_code);
 	/* Make up location code */
 	pci_add_loc_code(np, pd);

More information about the Skiboot mailing list