From ef90082f0b724a31c26eff2f6c1b9cefb606c057 Mon Sep 17 00:00:00 2001 From: Shravya Samala Date: Thu, 1 Oct 2020 16:20:45 +0530 Subject: [PATCH] msm: camera: ope: Fix false hw hang detection While preparing config packet at HW layer, we are setting Ope request timer even before processing command buffer and IO cfg. This is leading to false hw hand detection. Expectation is Ope request timer has to start after req is submitted to HW. CRs-Fixed: 2788900 Change-Id: Idd1420b2ee1aed4bfe947cf5617bbec9b39147d3 Signed-off-by: Shravya Samala --- drivers/cam_ope/ope_hw_mgr/cam_ope_hw_mgr.c | 26 +++++++++------------ 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/drivers/cam_ope/ope_hw_mgr/cam_ope_hw_mgr.c b/drivers/cam_ope/ope_hw_mgr/cam_ope_hw_mgr.c index 1485e3a5eebe..69dbdc77a4ee 100644 --- a/drivers/cam_ope/ope_hw_mgr/cam_ope_hw_mgr.c +++ b/drivers/cam_ope/ope_hw_mgr/cam_ope_hw_mgr.c @@ -1337,7 +1337,7 @@ static int cam_ope_mgr_calculate_num_path( ((clk_info->axi_path[i].path_data_type - CAM_AXI_PATH_DATA_OPE_START_OFFSET) >= CAM_OPE_MAX_PER_PATH_VOTES)) { - CAM_WARN(CAM_OPE, + CAM_DBG(CAM_OPE, "Invalid path %d, start offset=%d, max=%d", ctx_data->clk_info.axi_path[i].path_data_type, CAM_AXI_PATH_DATA_OPE_START_OFFSET, @@ -3191,21 +3191,13 @@ static int cam_ope_mgr_prepare_hw_update(void *hw_priv, CAM_ERR(CAM_OPE, "Invalid ctx req slot = %d", request_idx); return -EINVAL; } - ktime_get_boottime_ts64(&ts); - ctx_data->last_req_time = (uint64_t)((ts.tv_sec * 1000000000) + - ts.tv_nsec); - CAM_DBG(CAM_REQ, "req_id= %llu ctx_id= %d lrt=%llu", - packet->header.request_id, ctx_data->ctx_id, - ctx_data->last_req_time); - cam_ope_req_timer_modify(ctx_data, OPE_REQUEST_TIMEOUT); - set_bit(request_idx, ctx_data->bitmap); + ctx_data->req_list[request_idx] = kzalloc(sizeof(struct cam_ope_request), GFP_KERNEL); if (!ctx_data->req_list[request_idx]) { CAM_ERR(CAM_OPE, "mem allocation failed ctx:%d req_idx:%d", ctx_data->ctx_id, request_idx); rc = -ENOMEM; - mutex_unlock(&ctx_data->ctx_mutex); goto req_mem_alloc_failed; } @@ -3219,14 +3211,12 @@ static int cam_ope_mgr_prepare_hw_update(void *hw_priv, CAM_ERR(CAM_OPE, "Cdm mem alloc failed ctx:%d req_idx:%d", ctx_data->ctx_id, request_idx); rc = -ENOMEM; - mutex_unlock(&ctx_data->ctx_mutex); goto req_cdm_mem_alloc_failed; } rc = cam_ope_mgr_process_cmd_desc(hw_mgr, packet, ctx_data, &ope_cmd_buf_addr, request_idx); if (rc) { - mutex_unlock(&ctx_data->ctx_mutex); CAM_ERR(CAM_OPE, "cmd desc processing failed :%d ctx: %d req_id:%d", rc, ctx_data->ctx_id, packet->header.request_id); @@ -3236,7 +3226,6 @@ static int cam_ope_mgr_prepare_hw_update(void *hw_priv, rc = cam_ope_mgr_process_io_cfg(hw_mgr, packet, prepare_args, ctx_data, request_idx); if (rc) { - mutex_unlock(&ctx_data->ctx_mutex); CAM_ERR(CAM_OPE, "IO cfg processing failed: %d ctx: %d req_id:%d", rc, ctx_data->ctx_id, packet->header.request_id); @@ -3246,7 +3235,6 @@ static int cam_ope_mgr_prepare_hw_update(void *hw_priv, rc = cam_ope_mgr_create_kmd_buf(hw_mgr, packet, prepare_args, ctx_data, request_idx, ope_cmd_buf_addr); if (rc) { - mutex_unlock(&ctx_data->ctx_mutex); CAM_ERR(CAM_OPE, "create kmd buf failed: %d ctx: %d request_id:%d", rc, ctx_data->ctx_id, packet->header.request_id); @@ -3256,7 +3244,6 @@ static int cam_ope_mgr_prepare_hw_update(void *hw_priv, rc = cam_ope_process_generic_cmd_buffer(packet, ctx_data, request_idx, NULL); if (rc) { - mutex_unlock(&ctx_data->ctx_mutex); CAM_ERR(CAM_OPE, "Failed: %d ctx: %d req_id: %d req_idx: %d", rc, ctx_data->ctx_id, packet->header.request_id, request_idx); @@ -3268,6 +3255,14 @@ static int cam_ope_mgr_prepare_hw_update(void *hw_priv, prepare_args->priv = ctx_data->req_list[request_idx]; prepare_args->pf_data->packet = packet; ope_req->hang_data.packet = packet; + ktime_get_boottime_ts64(&ts); + ctx_data->last_req_time = (uint64_t)((ts.tv_sec * 1000000000) + + ts.tv_nsec); + CAM_DBG(CAM_REQ, "req_id= %llu ctx_id= %d lrt=%llu", + packet->header.request_id, ctx_data->ctx_id, + ctx_data->last_req_time); + cam_ope_req_timer_modify(ctx_data, OPE_REQUEST_TIMEOUT); + set_bit(request_idx, ctx_data->bitmap); mutex_unlock(&ctx_data->ctx_mutex); CAM_DBG(CAM_REQ, "Prepare Hw update Successful request_id: %d ctx: %d", @@ -3282,6 +3277,7 @@ req_cdm_mem_alloc_failed: ctx_data->req_list[request_idx] = NULL; req_mem_alloc_failed: clear_bit(request_idx, ctx_data->bitmap); + mutex_unlock(&ctx_data->ctx_mutex); return rc; }