From a36b40799055d0ff070f87376a486caed5c3a475 Mon Sep 17 00:00:00 2001 From: Andrew Donnellan Date: Fri, 29 Jun 2018 12:57:09 +1000 Subject: npu2: Use same compatible string for NVLink and OpenCAPI link nodes in device tree Currently, we distinguish between NPU links for NVLink devices and OpenCAPI devices through the use of two different compatible strings - ibm,npu-link and ibm,npu-link-opencapi. As we move towards supporting configurations with both NVLink and OpenCAPI devices behind a single NPU, we need to detect the device type as part of presence detection, which can't happen until well after the point where the HDAT or platform code has created the NPU device tree nodes. Changing a node's compatible string after it's been created is a bit ugly, so instead we should move the device type to a new property which we can add to the node later on. Get rid of the ibm,npu-link-opencapi compatible string, add a new ibm,npu-link-type property, and a helper function to check the link type. Add an "unknown" device type in preparation for later patches to detect device type dynamically. These device tree bindings are entirely internal to skiboot and are not consumed directly by Linux, so this shouldn't break anything (other than internal BML lab environments). Signed-off-by: Andrew Donnellan Reviewed-by: Frederic Barrat Signed-off-by: Stewart Smith --- hw/npu2-opencapi.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'hw/npu2-opencapi.c') diff --git a/hw/npu2-opencapi.c b/hw/npu2-opencapi.c index d085cd1..f82e656 100644 --- a/hw/npu2-opencapi.c +++ b/hw/npu2-opencapi.c @@ -1701,9 +1701,12 @@ static void npu2_opencapi_probe(struct dt_node *dn) /* Don't try to init when we have an NVLink link */ dt_for_each_compatible(dn, link, "ibm,npu-link") { - prlog(PR_DEBUG, "OCAPI: NPU%d: NVLink link found, skipping\n", - index); - return; + if (npu2_dt_link_dev_type(link) != NPU2_DEV_TYPE_OPENCAPI) { + prlog(PR_DEBUG, + "OCAPI: NPU%d: Non-OpenCAPI link found, skipping OpenCAPI init\n", + index); + return; + } } path = dt_get_path(dn); @@ -1728,7 +1731,7 @@ static void npu2_opencapi_probe(struct dt_node *dn) n->regs = (void *)reg[0]; n->dt_node = dn; - dt_for_each_compatible(dn, link, "ibm,npu-link-opencapi") { + dt_for_each_compatible(dn, link, "ibm,npu-link") { dev_index = dt_prop_get_u32(link, "ibm,npu-link-index"); prlog(PR_INFO, "OCAPI: Configuring link index %lld\n", dev_index); @@ -1748,7 +1751,7 @@ static void npu2_opencapi_probe(struct dt_node *dn) if (rc) goto failed; - dt_for_each_compatible(dn, link, "ibm,npu-link-opencapi") { + dt_for_each_compatible(dn, link, "ibm,npu-link") { npu2_opencapi_setup_device(link, n, &n->devices[i]); i++; } -- cgit v1.1