ソースを参照

Merge "mm-drivers: hw_fence: add support for multiple ipe and vpu clients"

qctecmdr 2 年 前
コミット
ccd2f268a7

+ 6 - 4
hw_fence/include/hw_fence_drv_priv.h

@@ -124,10 +124,12 @@ enum hw_fence_loopback_id {
 /**
  * enum hw_fence_client_data_id - Enum with the clients having client_data, an optional
  *                                parameter passed from the waiting client and returned
- *                                to it upon fence signaling
- * @HW_FENCE_CLIENT_DATA_ID_CTX0: GFX Client.
- * @HW_FENCE_CLIENT_DATA_ID_IPE: IPE Client.
- * @HW_FENCE_CLIENT_DATA_ID_VPU: VPU Client.
+ *                                to it upon fence signaling. Only the first HW Fence
+ *                                Client for non-VAL clients (e.g. GFX, IPE, VPU) have
+ *                                client_data.
+ * @HW_FENCE_CLIENT_DATA_ID_CTX0: GFX Client 0.
+ * @HW_FENCE_CLIENT_DATA_ID_IPE: IPE Client 0.
+ * @HW_FENCE_CLIENT_DATA_ID_VPU: VPU Client 0.
  * @HW_FENCE_CLIENT_DATA_ID_VAL0: Debug validation client 0.
  * @HW_FENCE_CLIENT_DATA_ID_VAL1: Debug validation client 1.
  * @HW_FENCE_MAX_CLIENTS_WITH_DATA: Max number of clients with data, also indicates an

+ 6 - 6
hw_fence/include/hw_fence_drv_utils.h

@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #ifndef __HW_FENCE_DRV_UTILS_H
@@ -8,21 +8,21 @@
 
 /**
  * HW_FENCE_MAX_CLIENT_TYPE_STATIC:
- * Total number of client types without configurable number of sub-clients (GFX, DPU, VAL, IPE, VPU)
+ * Total number of client types without configurable number of sub-clients (GFX, DPU, VAL)
  */
-#define HW_FENCE_MAX_CLIENT_TYPE_STATIC 5
+#define HW_FENCE_MAX_CLIENT_TYPE_STATIC 3
 
 /**
  * HW_FENCE_MAX_CLIENT_TYPE_CONFIGURABLE:
- * Maximum number of client types with configurable number of sub-clients (e.g. IFE)
+ * Maximum number of client types with configurable number of sub-clients (e.g. IPE, VPU, IFE)
  */
-#define HW_FENCE_MAX_CLIENT_TYPE_CONFIGURABLE 8
+#define HW_FENCE_MAX_CLIENT_TYPE_CONFIGURABLE 10
 
 /**
  * HW_FENCE_MAX_STATIC_CLIENTS_INDEX:
  * Maximum number of static clients, i.e. clients without configurable numbers of sub-clients
  */
-#define HW_FENCE_MAX_STATIC_CLIENTS_INDEX HW_FENCE_CLIENT_ID_IFE0
+#define HW_FENCE_MAX_STATIC_CLIENTS_INDEX HW_FENCE_CLIENT_ID_IPE
 
 /**
  * enum hw_fence_mem_reserve - Types of reservations for the carved-out memory.

+ 15 - 13
hw_fence/src/hw_fence_drv_priv.c

@@ -568,10 +568,10 @@ int hw_fence_init_controller_signal(struct hw_fence_driver_data *drv_data,
 	 *
 	 * NOTE: For each Client HW-Core, the client drivers might be the ones making
 	 * it's own initialization (in case that any hw-sequence must be enforced),
-	 * however, if that is  not the case, any per-client ipcc init to enable the
+	 * however, if that is not the case, any per-client ipcc init to enable the
 	 * signaling, can go here.
 	 */
-	switch ((int)hw_fence_client->client_id) {
+	switch ((int)hw_fence_client->client_id_ext) {
 	case HW_FENCE_CLIENT_ID_CTX0:
 		/* nothing to initialize for gpu client */
 		break;
@@ -594,8 +594,8 @@ int hw_fence_init_controller_signal(struct hw_fence_driver_data *drv_data,
 	case HW_FENCE_CLIENT_ID_CTL5:
 #ifdef HW_DPU_IPCC
 		/* initialize ipcc signals for dpu clients */
-		HWFNC_DBG_H("init_controller_signal: DPU client:%d initialized:%d\n",
-			hw_fence_client->client_id, drv_data->ipcc_dpu_initialized);
+		HWFNC_DBG_H("init_controller_signal: DPU client_id_ext:%d initialized:%d\n",
+			hw_fence_client->client_id_ext, drv_data->ipcc_dpu_initialized);
 		if (!drv_data->ipcc_dpu_initialized) {
 			drv_data->ipcc_dpu_initialized = true;
 
@@ -604,10 +604,12 @@ int hw_fence_init_controller_signal(struct hw_fence_driver_data *drv_data,
 		}
 #endif /* HW_DPU_IPCC */
 		break;
-	case HW_FENCE_CLIENT_ID_IPE:
+	case HW_FENCE_CLIENT_ID_IPE ... HW_FENCE_CLIENT_ID_IPE +
+			MSM_HW_FENCE_MAX_SIGNAL_PER_CLIENT - 1:
 		/* nothing to initialize for IPE client */
 		break;
-	case HW_FENCE_CLIENT_ID_VPU:
+	case HW_FENCE_CLIENT_ID_VPU ... HW_FENCE_CLIENT_ID_VPU +
+			MSM_HW_FENCE_MAX_SIGNAL_PER_CLIENT - 1:
 		/* nothing to initialize for VPU client */
 		break;
 	case HW_FENCE_CLIENT_ID_IFE0 ... HW_FENCE_CLIENT_ID_IFE7 +
@@ -615,7 +617,7 @@ int hw_fence_init_controller_signal(struct hw_fence_driver_data *drv_data,
 		/* nothing to initialize for IFE clients */
 		break;
 	default:
-		HWFNC_ERR("Unexpected client:%d\n", hw_fence_client->client_id);
+		HWFNC_ERR("Unexpected client_id_ext:%d\n", hw_fence_client->client_id_ext);
 		ret = -EINVAL;
 		break;
 	}
@@ -1207,10 +1209,10 @@ int hw_fence_process_fence_array(struct hw_fence_driver_data *drv_data,
 	enum hw_fence_client_data_id data_id;
 
 	if (client_data) {
-		data_id = hw_fence_get_client_data_id(hw_fence_client->client_id);
+		data_id = hw_fence_get_client_data_id(hw_fence_client->client_id_ext);
 		if (data_id >= HW_FENCE_MAX_CLIENTS_WITH_DATA) {
-			HWFNC_ERR("Populating non-zero client_data:%llu with invalid client:%d\n",
-				client_data, hw_fence_client->client_id);
+			HWFNC_ERR("Populating client_data:%llu with invalid client_id_ext:%d\n",
+				client_data, hw_fence_client->client_id_ext);
 			return -EINVAL;
 		}
 	}
@@ -1349,9 +1351,9 @@ int hw_fence_register_wait_client(struct hw_fence_driver_data *drv_data,
 	enum hw_fence_client_data_id data_id;
 
 	if (client_data) {
-		data_id = hw_fence_get_client_data_id(hw_fence_client->client_id);
+		data_id = hw_fence_get_client_data_id(hw_fence_client->client_id_ext);
 		if (data_id >= HW_FENCE_MAX_CLIENTS_WITH_DATA) {
-			HWFNC_ERR("Populating non-zero client_data:%llu with invalid client:%d\n",
+			HWFNC_ERR("Populating client_data:%llu with invalid client_id_ext:%d\n",
 				client_data, hw_fence_client->client_id);
 			return -EINVAL;
 		}
@@ -1424,7 +1426,7 @@ static void _signal_all_wait_clients(struct hw_fence_driver_data *drv_data,
 	for (wait_client_id = 0; wait_client_id <= drv_data->rxq_clients_num; wait_client_id++) {
 		if (hw_fence->wait_client_mask & BIT(wait_client_id)) {
 			hw_fence_wait_client = drv_data->clients[wait_client_id];
-			data_id = hw_fence_get_client_data_id(wait_client_id);
+			data_id = hw_fence_get_client_data_id(hw_fence_wait_client->client_id_ext);
 
 			if (data_id < HW_FENCE_MAX_CLIENTS_WITH_DATA)
 				client_data = hw_fence->client_data[data_id];

+ 2 - 8
hw_fence/src/hw_fence_drv_utils.c

@@ -30,12 +30,6 @@
 #define HW_FENCE_MAX_CLIENT_TYPE (HW_FENCE_MAX_CLIENT_TYPE_STATIC + \
 	HW_FENCE_MAX_CLIENT_TYPE_CONFIGURABLE)
 
-/**
- * HW_FENCE_MAX_STATIC_CLIENTS_INDEX:
- * Maximum number of static clients, i.e. clients without configurable numbers of sub-clients
- */
-#define HW_FENCE_MAX_STATIC_CLIENTS_INDEX HW_FENCE_CLIENT_ID_IFE0
-
 /**
  * HW_FENCE_MIN_RXQ_CLIENTS:
  * Minimum number of static hw fence clients with rxq
@@ -52,8 +46,8 @@
 #define HW_FENCE_CLIENT_TYPE_MAX_GPU 1
 #define HW_FENCE_CLIENT_TYPE_MAX_DPU 6
 #define HW_FENCE_CLIENT_TYPE_MAX_VAL 7
-#define HW_FENCE_CLIENT_TYPE_MAX_IPE 1
-#define HW_FENCE_CLIENT_TYPE_MAX_VPU 1
+#define HW_FENCE_CLIENT_TYPE_MAX_IPE 32
+#define HW_FENCE_CLIENT_TYPE_MAX_VPU 32
 #define HW_FENCE_CLIENT_TYPE_MAX_IFE 32
 
 /**

+ 3 - 3
hw_fence/src/msm_hw_fence.c

@@ -313,10 +313,10 @@ int msm_hw_fence_wait_update_v2(void *client_handle,
 	}
 
 	hw_fence_client = (struct msm_hw_fence_client *)client_handle;
-	data_id = hw_fence_get_client_data_id(hw_fence_client->client_id);
+	data_id = hw_fence_get_client_data_id(hw_fence_client->client_id_ext);
 	if (client_data_list && data_id >= HW_FENCE_MAX_CLIENTS_WITH_DATA) {
-		HWFNC_ERR("Populating non-NULL client_data_list with unsupported client id:%d\n",
-			hw_fence_client->client_id);
+		HWFNC_ERR("Populating non-NULL client_data_list with invalid client_id_ext:%d\n",
+			hw_fence_client->client_id_ext);
 		return -EINVAL;
 	}