Skip to content

Commit 429abac

Browse files
oohalstewartsmith
authored andcommitted
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>
1 parent 8599e8a commit 429abac

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

hw/npu2.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,7 @@ static int npu2_dn_fixup(struct phb *phb,
709709
{
710710
struct npu2 *p = phb_to_npu2(phb);
711711
struct npu2_dev *dev;
712+
uint32_t speed;
712713

713714
dev = npu2_bdf_to_dev(p, pd->bdfn);
714715
assert(dev);
@@ -719,13 +720,15 @@ static int npu2_dn_fixup(struct phb *phb,
719720
npu2_dn_fixup_gmb(pd->dn, dev);
720721
dt_add_property_cells(pd->dn, "ibm,nvlink", dev->dt_node->phandle);
721722

722-
/* NVLink supports multiple speeds and device drivers need to know what
723-
* speed has been set by firmware. The speed is actually controlled by
724-
* Hostboot, so until we get a HDAT entry telling us what speed they
725-
* programmed we will just hard code it here and hope it matches. If it
726-
* doesn't it is always possible to manually override it when installing
727-
* the device driver. */
728-
dt_add_property_cells(pd->dn, "ibm,nvlink-speed", 0x9);
723+
/*
724+
* NVLink supports multiple speeds and device drivers need to know what
725+
* speed has been set by firmware. Hostboot does the inits that set the
726+
* link speed and tell us via HDAT and we need to copy that from the
727+
* link node.
728+
*/
729+
speed = dt_prop_get_u32_def(dev->dt_node, "nvidia,link-speed", 0xff);
730+
if (speed != 0xff)
731+
dt_add_property_cells(pd->dn, "ibm,nvlink-speed", speed);
729732

730733
/* NPU2 devices require a slot location to associate with GPUs */
731734
dev->slot_label = dt_prop_get_def(pd->dn, "ibm,slot-label", NULL);

0 commit comments

Comments
 (0)