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

Commit 4abd438f authored by Jilai Wang's avatar Jilai Wang
Browse files

msm: npu: Don't allow IPC commands to be interrupted by signal



This change is to disallow IPC commands to be interrupted by signal.

Change-Id: Iaf35f7a0475208cde81874c3689fae069580f0f6
Signed-off-by: default avatarJilai Wang <jilaiw@codeaurora.org>
parent 95ec895e
Loading
Loading
Loading
Loading
+9 −21
Original line number Diff line number Diff line
@@ -1712,7 +1712,7 @@ int32_t npu_host_unload_network(struct npu_client *client,

	mutex_unlock(&host_ctx->lock);

	ret = wait_for_completion_interruptible_timeout(
	ret = wait_for_completion_timeout(
		&network->cmd_done,
		(host_ctx->fw_dbg_mode & FW_DBG_MODE_INC_TIMEOUT) ?
		NW_DEBUG_TIMEOUT : NW_CMD_TIMEOUT);
@@ -1724,10 +1724,6 @@ 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) {
@@ -1842,7 +1838,7 @@ int32_t npu_host_exec_network(struct npu_client *client,

	mutex_unlock(&host_ctx->lock);

	ret = wait_for_completion_interruptible_timeout(
	ret = wait_for_completion_timeout(
		&network->cmd_done,
		(host_ctx->fw_dbg_mode & FW_DBG_MODE_INC_TIMEOUT) ?
		NW_DEBUG_TIMEOUT : NW_CMD_TIMEOUT);
@@ -1855,10 +1851,6 @@ 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) {
@@ -1874,10 +1866,10 @@ int32_t npu_host_exec_network(struct npu_client *client,
	mutex_unlock(&host_ctx->lock);

	/*
	 * treat network execution timed our or interrupted by signal
	 * as error in order to force npu fw to stop execution
	 * treat network execution timed out as error in order to
	 * force npu fw to stop execution
	 */
	if ((ret == -ETIMEDOUT) || (ret == -ERESTARTSYS)) {
	if (ret == -ETIMEDOUT) {
		NPU_ERR("Error handling after execution failure\n");
		host_error_hdlr(npu_dev, true);
	}
@@ -1980,7 +1972,7 @@ int32_t npu_host_exec_network_v2(struct npu_client *client,

	mutex_unlock(&host_ctx->lock);

	ret = wait_for_completion_interruptible_timeout(
	ret = wait_for_completion_timeout(
		&network->cmd_done,
		(host_ctx->fw_dbg_mode & FW_DBG_MODE_INC_TIMEOUT) ?
		NW_DEBUG_TIMEOUT : NW_CMD_TIMEOUT);
@@ -1993,10 +1985,6 @@ 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) {
@@ -2026,10 +2014,10 @@ int32_t npu_host_exec_network_v2(struct npu_client *client,
	mutex_unlock(&host_ctx->lock);

	/*
	 * treat network execution timed our or interrupted by signal
	 * as error in order to force npu fw to stop execution
	 * treat network execution timed out as error in order to
	 * force npu fw to stop execution
	 */
	if ((ret == -ETIMEDOUT) || (ret == -ERESTARTSYS)) {
	if (ret == -ETIMEDOUT) {
		NPU_ERR("Error handling after execution failure\n");
		host_error_hdlr(npu_dev, true);
	}