Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cd038fc1 authored by Rama Aparna Mallavarapu's avatar Rama Aparna Mallavarapu
Browse files

msm: npu: allow IPC commands to be interrupted by signal



This change is to allow IPC commands to be interrupted by signal
for the sys band and app kill.

Change-Id: I41ead32510b1f192e97b07c243ebde524b007630
Signed-off-by: default avatarRama Aparna Mallavarapu <aparnam@codeaurora.org>
parent cc8cf81b
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -1784,7 +1784,7 @@ int32_t npu_host_load_network_v2(struct npu_client *client,

	mutex_unlock(&host_ctx->lock);

	ret = wait_for_completion_timeout(
	ret = wait_for_completion_interruptible_timeout(
		&network->cmd_done,
		(host_ctx->fw_dbg_mode & FW_DBG_MODE_INC_TIMEOUT) ?
		NW_DEBUG_TIMEOUT : NW_CMD_TIMEOUT);
@@ -1795,6 +1795,9 @@ int32_t npu_host_load_network_v2(struct npu_client *client,
		NPU_ERR("npu: NPU_IPC_CMD_LOAD time out\n");
		ret = -ETIMEDOUT;
		goto error_load_network;
	} else if (ret < 0) {
		NPU_ERR("NPU_IPC_CMD_LOAD_V2 is interrupted by signal\n");
		goto error_free_network;
	}

	if (network->fw_error) {
@@ -1898,7 +1901,7 @@ int32_t npu_host_unload_network(struct npu_client *client,

	mutex_unlock(&host_ctx->lock);

	ret = wait_for_completion_timeout(
	ret = wait_for_completion_interruptible_timeout(
		&network->cmd_done,
		(host_ctx->fw_dbg_mode & FW_DBG_MODE_INC_TIMEOUT) ?
		NW_DEBUG_TIMEOUT : NW_CMD_TIMEOUT);
@@ -1910,6 +1913,10 @@ int32_t npu_host_unload_network(struct npu_client *client,
		network->cmd_pending = false;
		ret = -ETIMEDOUT;
		goto free_network;
	} else if (ret < 0) {
		NPU_ERR("Wait for unload done interrupted by signal\n");
		network->cmd_pending = false;
		goto free_network;
	}

	if (network->fw_error) {
@@ -2024,7 +2031,7 @@ int32_t npu_host_exec_network(struct npu_client *client,

	mutex_unlock(&host_ctx->lock);

	ret = wait_for_completion_timeout(
	ret = wait_for_completion_interruptible_timeout(
		&network->cmd_done,
		(host_ctx->fw_dbg_mode & FW_DBG_MODE_INC_TIMEOUT) ?
		NW_DEBUG_TIMEOUT : NW_CMD_TIMEOUT);
@@ -2037,6 +2044,10 @@ int32_t npu_host_exec_network(struct npu_client *client,
		network->cmd_pending = false;
		ret = -ETIMEDOUT;
		goto exec_done;
	} else if (ret == -ERESTARTSYS) {
		NPU_ERR("Wait for execution done interrupted by signal\n");
		network->cmd_pending = false;
		goto exec_done;
	}

	if (network->fw_error) {
@@ -2158,7 +2169,7 @@ int32_t npu_host_exec_network_v2(struct npu_client *client,

	mutex_unlock(&host_ctx->lock);

	ret = wait_for_completion_timeout(
	ret = wait_for_completion_interruptible_timeout(
		&network->cmd_done,
		(host_ctx->fw_dbg_mode & FW_DBG_MODE_INC_TIMEOUT) ?
		NW_DEBUG_TIMEOUT : NW_CMD_TIMEOUT);
@@ -2171,6 +2182,10 @@ int32_t npu_host_exec_network_v2(struct npu_client *client,
		network->cmd_pending = false;
		ret = -ETIMEDOUT;
		goto free_exec_packet;
	} else if (ret == -ERESTARTSYS) {
		NPU_ERR("Wait for execution_v2 done interrupted by signal\n");
		network->cmd_pending = false;
		goto free_exec_packet;
	}

	if (network->fw_error) {