aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver O'Halloran <oohall@gmail.com>2017-09-20 19:46:00 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-09-20 20:13:35 -0500
commit429abacbe43b441ef7f79bd25353f810d1b3f53d (patch)
treed772dbb924f92a20a43d3893a25f654fed2810d2
parent8599e8ad69052e5dfcc2625dab1211302fb45f9a (diff)
downloadskiboot-429abacbe43b441ef7f79bd25353f810d1b3f53d.zip
skiboot-429abacbe43b441ef7f79bd25353f810d1b3f53d.tar.gz
skiboot-429abacbe43b441ef7f79bd25353f810d1b3f53d.tar.bz2
npu2: Copy link speed from the npu node
This needs to be in the PCI device node so the speed of the NVLink can be passed to the GPU driver. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--hw/npu2.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/hw/npu2.c b/hw/npu2.c
index e3365a3..1176d3c 100644
--- a/hw/npu2.c
+++ b/hw/npu2.c
@@ -709,6 +709,7 @@ static int npu2_dn_fixup(struct phb *phb,
{
struct npu2 *p = phb_to_npu2(phb);
struct npu2_dev *dev;
+ uint32_t speed;
dev = npu2_bdf_to_dev(p, pd->bdfn);
assert(dev);
@@ -719,13 +720,15 @@ static int npu2_dn_fixup(struct phb *phb,
npu2_dn_fixup_gmb(pd->dn, dev);
dt_add_property_cells(pd->dn, "ibm,nvlink", dev->dt_node->phandle);
- /* NVLink supports multiple speeds and device drivers need to know what
- * speed has been set by firmware. The speed is actually controlled by
- * Hostboot, so until we get a HDAT entry telling us what speed they
- * programmed we will just hard code it here and hope it matches. If it
- * doesn't it is always possible to manually override it when installing
- * the device driver. */
- dt_add_property_cells(pd->dn, "ibm,nvlink-speed", 0x9);
+ /*
+ * NVLink supports multiple speeds and device drivers need to know what
+ * speed has been set by firmware. Hostboot does the inits that set the
+ * link speed and tell us via HDAT and we need to copy that from the
+ * link node.
+ */
+ speed = dt_prop_get_u32_def(dev->dt_node, "nvidia,link-speed", 0xff);
+ if (speed != 0xff)
+ dt_add_property_cells(pd->dn, "ibm,nvlink-speed", speed);
/* NPU2 devices require a slot location to associate with GPUs */
dev->slot_label = dt_prop_get_def(pd->dn, "ibm,slot-label", NULL);