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

Add support for signal-based reservation of hw fence client ids for
ipe and vpu clients.

Change-Id: I4e4a835424756c6e5fa8d5c2d340dfadc4d11541
Signed-off-by: Grace An <quic_gracan@quicinc.com>
This commit is contained in:
Grace An
2023-02-07 10:26:37 -08:00
committed by Gerrit - the friendly Code Review server
parent 5eec9ba76c
commit 88f51cfe04
5 changed files with 32 additions and 34 deletions

View File

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

View File

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */ /* 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 #ifndef __HW_FENCE_DRV_UTILS_H
@@ -8,21 +8,21 @@
/** /**
* HW_FENCE_MAX_CLIENT_TYPE_STATIC: * 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: * 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: * HW_FENCE_MAX_STATIC_CLIENTS_INDEX:
* Maximum number of static clients, i.e. clients without configurable numbers of sub-clients * 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. * enum hw_fence_mem_reserve - Types of reservations for the carved-out memory.

View File

@@ -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 * 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), * 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. * 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: case HW_FENCE_CLIENT_ID_CTX0:
/* nothing to initialize for gpu client */ /* nothing to initialize for gpu client */
break; break;
@@ -594,8 +594,8 @@ int hw_fence_init_controller_signal(struct hw_fence_driver_data *drv_data,
case HW_FENCE_CLIENT_ID_CTL5: case HW_FENCE_CLIENT_ID_CTL5:
#ifdef HW_DPU_IPCC #ifdef HW_DPU_IPCC
/* initialize ipcc signals for dpu clients */ /* initialize ipcc signals for dpu clients */
HWFNC_DBG_H("init_controller_signal: DPU client:%d initialized:%d\n", HWFNC_DBG_H("init_controller_signal: DPU client_id_ext:%d initialized:%d\n",
hw_fence_client->client_id, drv_data->ipcc_dpu_initialized); hw_fence_client->client_id_ext, drv_data->ipcc_dpu_initialized);
if (!drv_data->ipcc_dpu_initialized) { if (!drv_data->ipcc_dpu_initialized) {
drv_data->ipcc_dpu_initialized = true; 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 */ #endif /* HW_DPU_IPCC */
break; 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 */ /* nothing to initialize for IPE client */
break; 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 */ /* nothing to initialize for VPU client */
break; break;
case HW_FENCE_CLIENT_ID_IFE0 ... HW_FENCE_CLIENT_ID_IFE7 + 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 */ /* nothing to initialize for IFE clients */
break; break;
default: 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; ret = -EINVAL;
break; 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; enum hw_fence_client_data_id data_id;
if (client_data) { 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) { 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); client_data, hw_fence_client->client_id_ext);
return -EINVAL; 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; enum hw_fence_client_data_id data_id;
if (client_data) { 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) { 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); client_data, hw_fence_client->client_id);
return -EINVAL; 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++) { 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)) { if (hw_fence->wait_client_mask & BIT(wait_client_id)) {
hw_fence_wait_client = drv_data->clients[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) if (data_id < HW_FENCE_MAX_CLIENTS_WITH_DATA)
client_data = hw_fence->client_data[data_id]; client_data = hw_fence->client_data[data_id];

View File

@@ -30,12 +30,6 @@
#define HW_FENCE_MAX_CLIENT_TYPE (HW_FENCE_MAX_CLIENT_TYPE_STATIC + \ #define HW_FENCE_MAX_CLIENT_TYPE (HW_FENCE_MAX_CLIENT_TYPE_STATIC + \
HW_FENCE_MAX_CLIENT_TYPE_CONFIGURABLE) 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: * HW_FENCE_MIN_RXQ_CLIENTS:
* Minimum number of static hw fence clients with rxq * 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_GPU 1
#define HW_FENCE_CLIENT_TYPE_MAX_DPU 6 #define HW_FENCE_CLIENT_TYPE_MAX_DPU 6
#define HW_FENCE_CLIENT_TYPE_MAX_VAL 7 #define HW_FENCE_CLIENT_TYPE_MAX_VAL 7
#define HW_FENCE_CLIENT_TYPE_MAX_IPE 1 #define HW_FENCE_CLIENT_TYPE_MAX_IPE 32
#define HW_FENCE_CLIENT_TYPE_MAX_VPU 1 #define HW_FENCE_CLIENT_TYPE_MAX_VPU 32
#define HW_FENCE_CLIENT_TYPE_MAX_IFE 32 #define HW_FENCE_CLIENT_TYPE_MAX_IFE 32
/** /**

View File

@@ -313,10 +313,10 @@ int msm_hw_fence_wait_update_v2(void *client_handle,
} }
hw_fence_client = (struct msm_hw_fence_client *)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) { 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", HWFNC_ERR("Populating non-NULL client_data_list with invalid client_id_ext:%d\n",
hw_fence_client->client_id); hw_fence_client->client_id_ext);
return -EINVAL; return -EINVAL;
} }