diff mbox series

[13/13] hw/npu2-common: Allow mixed mode NPU setups

Message ID 5c2eff06db01029e6f284f4586405bb5b18b60a0.1544597914.git-series.andrew.donnellan@au1.ibm.com
State Superseded
Headers show
Series Support OpenCAPI and NVLink devices on same NPU on Witherspoon | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master

Commit Message

Andrew Donnellan Dec. 12, 2018, 6:58 a.m. UTC
Now that we have all the support in place for NPUs with both NVLink and
OpenCAPI devices, get rid of the error that aborts NPU init when a mixed
setup is detected.

While we're there, rename setup_devices() to more accurately reflect what
it does, and move the calls to the NVLink/OpenCAPI setup code out of there
into the main probe function.

Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
---
 hw/npu2-common.c   | 28 ++++++----------------------
 hw/npu2-opencapi.c |  5 -----
 2 files changed, 6 insertions(+), 27 deletions(-)

Comments

Frederic Barrat Jan. 8, 2019, 1:26 p.m. UTC | #1
Le 12/12/2018 à 07:58, Andrew Donnellan a écrit :
> Now that we have all the support in place for NPUs with both NVLink and
> OpenCAPI devices, get rid of the error that aborts NPU init when a mixed
> setup is detected.
> 
> While we're there, rename setup_devices() to more accurately reflect what
> it does, and move the calls to the NVLink/OpenCAPI setup code out of there
> into the main probe function.
> 
> Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
> ---

One very minor detail below
Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>


> diff --git a/hw/npu2-opencapi.c b/hw/npu2-opencapi.c
> index a57f556b102d..71661648d8e0 100644
> --- a/hw/npu2-opencapi.c
> +++ b/hw/npu2-opencapi.c
> @@ -19,15 +19,10 @@
>    *
>    * This file provides support for OpenCAPI as implemented on POWER9.
>    *
> - * At present, we initialise the NPU separately from the NVLink code in npu2.c.
> - * As such, we don't currently support mixed NVLink and OpenCAPI configurations
> - * on the same NPU for machines such as Witherspoon.
> - *
>    * Procedure references in this file are to the POWER9 OpenCAPI NPU Workbook
>    * (IBM internal document).
>    *
>    * TODO:
> - *   - Support for mixed NVLink and OpenCAPI on the same NPU
>    *   - Support for link ganging (one AFU using multiple links)
>    *   - Link reset and error handling
>    *   - Presence detection

Nothing to do with this series, but while we're at it, you can remove 
presence detection from that TODO list
diff mbox series

Patch

diff --git a/hw/npu2-common.c b/hw/npu2-common.c
index 9c383ef7f35f..978ed4561ebc 100644
--- a/hw/npu2-common.c
+++ b/hw/npu2-common.c
@@ -618,26 +618,19 @@  failed:
 	return NULL;
 }
 
-static void setup_devices(struct npu2 *npu)
+static void add_link_type_properties(struct npu2 *npu)
 {
-	bool nvlink_detected = false, ocapi_detected = false;
 	struct npu2_dev *dev;
 
-	/*
-	 * TODO: In future, we'll do brick configuration here to support mixed
-	 * setups.
-	 */
 	for (int i = 0; i < npu->total_devices; i++) {
 		dev = &npu->devices[i];
 		switch (dev->type) {
 		case NPU2_DEV_TYPE_NVLINK:
-			nvlink_detected = true;
 			dt_add_property_strings(dev->dt_node,
 						"ibm,npu-link-type",
 						"nvlink");
 			break;
 		case NPU2_DEV_TYPE_OPENCAPI:
-			ocapi_detected = true;
 			dt_add_property_strings(dev->dt_node,
 						"ibm,npu-link-type",
 						"opencapi");
@@ -650,19 +643,6 @@  static void setup_devices(struct npu2 *npu)
 						"unknown");
 		}
 	}
-
-	if (nvlink_detected && ocapi_detected) {
-		prlog(PR_ERR, "NPU: NVLink and OpenCAPI devices on same chip not supported, aborting NPU init\n");
-		return;
-	}
-
-	assign_bars(npu);
-	setup_irqs(npu);
-
-	if (nvlink_detected)
-		npu2_nvlink_init_npu(npu);
-	else if (ocapi_detected)
-		npu2_opencapi_init_npu(npu);
 }
 
 void probe_npu2(void)
@@ -698,7 +678,11 @@  void probe_npu2(void)
 		if (!npu)
 			continue;
 		platform.npu2_device_detect(npu);
+		add_link_type_properties(npu);
 		set_brick_config(npu);
-		setup_devices(npu);
+		assign_bars(npu);
+		setup_irqs(npu);
+		npu2_nvlink_init_npu(npu);
+		npu2_opencapi_init_npu(npu);
 	}
 }
diff --git a/hw/npu2-opencapi.c b/hw/npu2-opencapi.c
index a57f556b102d..71661648d8e0 100644
--- a/hw/npu2-opencapi.c
+++ b/hw/npu2-opencapi.c
@@ -19,15 +19,10 @@ 
  *
  * This file provides support for OpenCAPI as implemented on POWER9.
  *
- * At present, we initialise the NPU separately from the NVLink code in npu2.c.
- * As such, we don't currently support mixed NVLink and OpenCAPI configurations
- * on the same NPU for machines such as Witherspoon.
- *
  * Procedure references in this file are to the POWER9 OpenCAPI NPU Workbook
  * (IBM internal document).
  *
  * TODO:
- *   - Support for mixed NVLink and OpenCAPI on the same NPU
  *   - Support for link ganging (one AFU using multiple links)
  *   - Link reset and error handling
  *   - Presence detection