diff mbox series

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

Message ID 20190423075607.31994-2-oohall@gmail.com
State Accepted
Headers show
Series [1/2] hw/phb4: Read ibm,loc-code from PBCQ node | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (d318cdb3863fcf92288528bfed3b6e435cf6f0ef)
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present

Commit Message

Oliver O'Halloran April 23, 2019, 7:56 a.m. UTC
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.

e.g.

pciex@600c3c0100000/ibm,loc-code
                 "UOPWR.0000000-Node0-Proc0"

pciex@600c3c0100000/pci@0/ibm,loc-code
                 "UOPWR.0000000-Node0-Proc0"

pciex@600c3c0100000/pci@0/usb-xhci@0/ibm,loc-code
                 "UOPWR.0000000-Node0"

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@gmail.com>
---
 core/pci.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

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);