[Skiboot] [PATCH] hw/npu2.c: Add ibm, nvlink-speed device-tree property

Alistair Popple alistair at popple.id.au
Fri Aug 18 15:19:55 AEST 2017


NVLink2 links can support multiple different speeds. However the device driver
has no way of determining which speed was programmed so pass it down as a device
tree property.

Signed-off-by: Alistair Popple <alistair at popple.id.au>
---
 doc/device-tree/nvlink.rst | 7 ++++++-
 hw/npu2.c                  | 8 ++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/doc/device-tree/nvlink.rst b/doc/device-tree/nvlink.rst
index 6ce44e9..9f3fecb 100644
--- a/doc/device-tree/nvlink.rst
+++ b/doc/device-tree/nvlink.rst
@@ -105,7 +105,12 @@ Emulated PCI device bindings
                         vendor-id = <0x1014>;
                         ibm,gpu = <0x100002f7>; /* phandle pointing the associated GPU PCI device node */
 			memory-region = <0x10000abc>; /* phandle pointing to the GPU memory */
-			phandle = <0x100002fc>;
+                        ibm,nvlink-speed = <0x1>;
+
+                ; Denotes the speed the link is running at:
+                ; 0x3 == 20 Gbps, 0x8 = 25.78125 Gbps, 0x9 == 25.00000 Gbps
+
+                        phandle = <0x100002fc>;
                 };
 
                 pci at 1 {
diff --git a/hw/npu2.c b/hw/npu2.c
index 74e3325..3c1db4f 100644
--- a/hw/npu2.c
+++ b/hw/npu2.c
@@ -683,6 +683,14 @@ 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);
+
 	/* NPU devices require a slot location to associate with GPUs */
 	dev->slot_label = dt_prop_get_def(pd->dn, "ibm,slot-label", NULL);
 	if (!dev->slot_label) {
-- 
2.1.4



More information about the Skiboot mailing list