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

Commit e618f72d authored by Pavan Kumar Chilamkurthi's avatar Pavan Kumar Chilamkurthi
Browse files

msm: camera: core: Handle request abort and signal fence CANCEL



Handle request abort cases from underlying hw mgr, hw layers.
This will handle in differentiating ERROR vs ABORT returned
from firmware in case of ICP and signal the fence accordingly.
By the time flush is issued to firmware, if a request is not
yet processed, firmware signals with Abort, which needs to be
propogated as CANCEL instead of ERROR to core context layer
so that context layer signals the fence accordingly as
ERROR or CANCEL.

CRs-Fixed: 2702771
Change-Id: I8fe6bd1c8f5cf09b99196a1caac1283032418f8c
Signed-off-by: default avatarPavan Kumar Chilamkurthi <pchilamk@codeaurora.org>
parent b4f16aac
Loading
Loading
Loading
Loading
+11 −12
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ static inline int cam_context_validate_thread(void)
}

int cam_context_buf_done_from_hw(struct cam_context *ctx,
	void *done_event_data, uint32_t bubble_state)
	void *done_event_data, uint32_t evt_id)
{
	int j;
	int result;
@@ -84,21 +84,20 @@ int cam_context_buf_done_from_hw(struct cam_context *ctx,
	 */
	list_del_init(&req->list);
	spin_unlock(&ctx->lock);
	if (!bubble_state) {
	if (evt_id == CAM_CTX_EVT_ID_SUCCESS)
		result = CAM_SYNC_STATE_SIGNALED_SUCCESS;
	} else {
		CAM_DBG(CAM_REQ,
			"[%s][ctx_id %d] : req[%llu] is done with error",
			ctx->dev_name, ctx->ctx_id, req->request_id);

		for (j = 0; j < req->num_out_map_entries; j++)
			CAM_DBG(CAM_REQ, "fence %d signaled with error",
				req->out_map_entries[j].sync_id);

	else  if (evt_id == CAM_CTX_EVT_ID_CANCEL)
		result = CAM_SYNC_STATE_SIGNALED_CANCEL;
	else
		result = CAM_SYNC_STATE_SIGNALED_ERROR;
	}

	CAM_DBG(CAM_REQ,
		"[%s][ctx_id %d] : req[%llu] : Signaling %d",
		ctx->dev_name, ctx->ctx_id, req->request_id, result);

	for (j = 0; j < req->num_out_map_entries; j++) {
		CAM_DBG(CAM_REQ, "fence %d signal with %d",
			req->out_map_entries[j].sync_id, result);
		cam_sync_signal(req->out_map_entries[j].sync_id, result);
		req->out_map_entries[j].sync_id = -1;
	}
+2 −2
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 */

#ifndef _CAM_CONTEXT_UTILS_H_
@@ -9,7 +9,7 @@
#include <linux/types.h>

int cam_context_buf_done_from_hw(struct cam_context *ctx,
	void *done_event_data, uint32_t bubble_state);
	void *done_event_data, uint32_t evt_id);
int32_t cam_context_release_dev_to_hw(struct cam_context *ctx,
	struct cam_release_dev_cmd *cmd);
int32_t cam_context_prepare_dev_to_hw(struct cam_context *ctx,
+4 −0
Original line number Diff line number Diff line
@@ -35,6 +35,10 @@ enum cam_context_dump_id {
	CAM_CTX_DUMP_TYPE_MAX,
};

#define CAM_CTX_EVT_ID_SUCCESS 0
#define CAM_CTX_EVT_ID_ERROR   1
#define CAM_CTX_EVT_ID_CANCEL  2

/* hardware event callback function type */
typedef int (*cam_hw_event_cb_func)(void *context, uint32_t evt_id,
	void *evt_data);
+3 −4
Original line number Diff line number Diff line
@@ -947,7 +947,7 @@ static int32_t cam_fd_mgr_workq_irq_cb(void *priv, void *data)
	struct cam_fd_mgr_work_data *work_data;
	struct cam_fd_mgr_frame_request *frame_req = NULL;
	enum cam_fd_hw_irq_type irq_type;
	bool frame_abort = true;
	uint32_t evt_id = CAM_CTX_EVT_ID_ERROR;
	int rc;

	if (!data || !priv) {
@@ -1013,12 +1013,11 @@ static int32_t cam_fd_mgr_workq_irq_cb(void *priv, void *data)
			if (rc) {
				CAM_ERR(CAM_FD, "Failed in CMD_PRESTART %d",
					rc);
				frame_abort = true;
				goto notify_context;
			}
		}

		frame_abort = false;
		evt_id = CAM_CTX_EVT_ID_SUCCESS;
	}

	trace_cam_irq_handled("FD", irq_type);
@@ -1035,7 +1034,7 @@ static int32_t cam_fd_mgr_workq_irq_cb(void *priv, void *data)
		buf_data.request_id = frame_req->request_id;

		rc = frame_req->hw_ctx->event_cb(frame_req->hw_ctx->cb_priv,
			frame_abort, &buf_data);
			evt_id, &buf_data);
		if (rc)
			CAM_ERR(CAM_FD, "Error in event cb handling %d", rc);
	}
+14 −6
Original line number Diff line number Diff line
@@ -1995,7 +1995,7 @@ static int cam_icp_mgr_cleanup_ctx(struct cam_icp_hw_ctx_data *ctx_data)
			continue;
		buf_data.request_id = hfi_frame_process->request_id[i];
		ctx_data->ctxt_event_cb(ctx_data->context_priv,
			false, &buf_data);
			CAM_CTX_EVT_ID_SUCCESS, &buf_data);
		hfi_frame_process->request_id[i] = 0;
		if (ctx_data->hfi_frame_process.in_resource[i] > 0) {
			CAM_DBG(CAM_ICP, "Delete merged sync in object: %d",
@@ -2096,6 +2096,7 @@ static int cam_icp_mgr_handle_frame_process(uint32_t *msg_ptr, int flag)
	struct hfi_frame_process_info *hfi_frame_process;
	struct cam_hw_done_event_data buf_data;
	uint32_t clk_type;
	uint32_t event_id;

	ioconfig_ack = (struct hfi_msg_ipebps_async_ack *)msg_ptr;
	request_id = ioconfig_ack->user_data2;
@@ -2138,12 +2139,13 @@ static int cam_icp_mgr_handle_frame_process(uint32_t *msg_ptr, int flag)
	idx = i;

	if (flag == ICP_FRAME_PROCESS_FAILURE) {
		if (ioconfig_ack->err_type == CAMERAICP_EABORTED)
		if (ioconfig_ack->err_type == CAMERAICP_EABORTED) {
			CAM_WARN(CAM_ICP,
				"ctx_id %d req %llu dev %d has been aborted[flushed]",
				ctx_data->ctx_id, request_id,
				ctx_data->icp_dev_acquire_info->dev_type);
		else
			event_id = CAM_CTX_EVT_ID_CANCEL;
		} else {
			CAM_ERR(CAM_ICP,
				"Done with error: %u err_type= [%s] on ctx_id %d dev %d for req %llu",
				ioconfig_ack->err_type,
@@ -2152,10 +2154,14 @@ static int cam_icp_mgr_handle_frame_process(uint32_t *msg_ptr, int flag)
				ctx_data->ctx_id,
				ctx_data->icp_dev_acquire_info->dev_type,
				request_id);
			event_id = CAM_CTX_EVT_ID_ERROR;
		}
	} else {
		event_id = CAM_CTX_EVT_ID_SUCCESS;
	}

	buf_data.request_id = hfi_frame_process->request_id[idx];
	ctx_data->ctxt_event_cb(ctx_data->context_priv, flag, &buf_data);
	ctx_data->ctxt_event_cb(ctx_data->context_priv, event_id, &buf_data);
	hfi_frame_process->request_id[idx] = 0;
	if (ctx_data->hfi_frame_process.in_resource[idx] > 0) {
		CAM_DBG(CAM_ICP, "Delete merged sync in object: %d",
@@ -3890,7 +3896,8 @@ static int cam_icp_mgr_handle_config_err(
	struct cam_hw_done_event_data buf_data;

	buf_data.request_id = *(uint64_t *)config_args->priv;
	ctx_data->ctxt_event_cb(ctx_data->context_priv, false, &buf_data);
	ctx_data->ctxt_event_cb(ctx_data->context_priv, CAM_CTX_EVT_ID_SUCCESS,
		&buf_data);

	ctx_data->hfi_frame_process.request_id[idx] = 0;
	ctx_data->hfi_frame_process.fw_process_flag[idx] = false;
@@ -4962,7 +4969,8 @@ static int cam_icp_mgr_send_abort_status(struct cam_icp_hw_ctx_data *ctx_data)
		if (!hfi_frame_process->request_id[idx])
			continue;

		ctx_data->ctxt_event_cb(ctx_data->context_priv, true,
		ctx_data->ctxt_event_cb(ctx_data->context_priv,
			CAM_CTX_EVT_ID_CANCEL,
			&hfi_frame_process->request_id[idx]);

		/* now release memory for hfi frame process command */
Loading