[Skiboot] [PATCH 3/3] npu2: Use ibm, loc-code rather than ibm, slot-label

Oliver O'Halloran oohall at gmail.com
Fri Apr 20 14:40:41 AEST 2018


The ibm,slot-label property is to name the slot that appears under a
PCIe bridge. In the past we (ab)used the slot tables to attach names
to GPU devices and their corresponding NVLinks which resulted in npu2.c
using slot-label as a location code rather than as a way to name slots.

Fix this up since it's confusing.

Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
 hw/npu2.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/hw/npu2.c b/hw/npu2.c
index 07b70d6e4dfa..8484a84ad849 100644
--- a/hw/npu2.c
+++ b/hw/npu2.c
@@ -392,13 +392,13 @@ static int __npu2_dev_bind_pci_dev(struct phb *phb __unused,
 
 	/* Find the PCI device's slot location */
 	for (pci_dt_node = pd->dn;
-	     pci_dt_node && !dt_find_property(pci_dt_node, "ibm,slot-label");
+	     pci_dt_node && !dt_find_property(pci_dt_node, "ibm,loc-code");
 	     pci_dt_node = pci_dt_node->parent);
 
 	if (!pci_dt_node)
 		return 0;
 
-	pcislot = (char *)dt_prop_get(pci_dt_node, "ibm,slot-label");
+	pcislot = (char *)dt_prop_get(pci_dt_node, "ibm,loc-code");
 
 	prlog(PR_DEBUG, "NPU2: comparing GPU '%s' and NPU2 '%s'\n",
 	      pcislot, dev->nvlink.slot_label);
@@ -639,18 +639,11 @@ static int npu2_dn_fixup(struct phb *phb,
 		dt_add_property_cells(pd->dn, "ibm,nvlink-speed", speed);
 
 	/*
-	 * NPU2 devices require a slot location to associate with GPUs.
-	 * This can be added via the slot table matching, otherwise we
-	 * read it from the link node.
+	 * NPU2 devices have a slot label that indicates which GPU slot
+	 * this NPU is connected to. Add a location code to the NVlink
+	 * device node based on the slot label.
 	 */
-	label = dt_prop_get_def(pd->dn, "ibm,slot-label", NULL);
-
-	if (!label) {
-		label = dt_prop_get_def(dev->dt_node, "ibm,slot-label", NULL);
-		if (label)
-			dt_add_property_string(pd->dn, "ibm,slot-label", label);
-	}
-
+	label = dt_prop_get_def(dev->dt_node, "ibm,slot-label", NULL);
 	if (!label) {
 		/**
 		 * @fwts-label NPUNoPHBSlotLabel
@@ -660,6 +653,7 @@ static int npu2_dn_fixup(struct phb *phb,
 		prlog(PR_ERR, "NPU2: Cannot find GPU slot information\n");
 		return 0;
 	}
+	dt_add_property_string(pd->dn, "ibm,loc-code", label);
 
 	dev->nvlink.slot_label = label;
 
-- 
2.9.5



More information about the Skiboot mailing list