msm: camera: reqmgr: Propagate hw failures to user

Propagate error code to user in order to let the
user know more about the failure.

CRs-Fixed: 2860306
Change-Id: Icf030aa9df32eac97371059c2d282cfb53257401
Signed-off-by: Jigar Agrawal <jigar@codeaurora.org>
This commit is contained in:
Jigar Agrawal
2021-03-17 09:35:25 -07:00
parent f77f1673d3
commit 76857940be
7 changed files with 53 additions and 7 deletions

View File

@@ -2628,13 +2628,16 @@ end:
if (error_type == CAM_ISP_HW_ERROR_CSID_FATAL)
req_msg.u.err_msg.error_type =
CAM_REQ_MGR_ERROR_TYPE_FULL_RECOVERY;
else
else {
req_msg.u.err_msg.error_type =
CAM_REQ_MGR_ERROR_TYPE_RECOVERY;
}
req_msg.u.err_msg.link_hdl = ctx_isp->base->link_hdl;
req_msg.u.err_msg.request_id = error_request_id;
req_msg.u.err_msg.resource_size = 0x0;
req_msg.u.err_msg.error_code =
error_event_data->error_code;
if (cam_req_mgr_notify_message(&req_msg,
V4L_EVENT_CAM_REQ_MGR_ERROR,
@@ -6045,7 +6048,7 @@ static int cam_isp_context_dump_requests(void *data,
struct cam_isp_ctx_req *req_isp = NULL;
struct cam_isp_prepare_hw_update_data *hw_update_data = NULL;
struct cam_hw_mgr_dump_pf_data *pf_dbg_entry = NULL;
struct cam_req_mgr_message req_msg;
struct cam_req_mgr_message req_msg = {0};
struct cam_isp_context *ctx_isp;
uint32_t resource_type = 0;
bool mem_found = false, ctx_found = false, send_error = false;
@@ -6162,6 +6165,7 @@ static int cam_isp_context_dump_requests(void *data,
req_msg.u.err_msg.link_hdl = ctx->link_hdl;
req_msg.u.err_msg.request_id = 0;
req_msg.u.err_msg.resource_size = 0x0;
req_msg.u.err_msg.error_code = CAM_REQ_MGR_ISP_UNREPORTED_ERROR;
if (cam_req_mgr_notify_message(&req_msg,
V4L_EVENT_CAM_REQ_MGR_ERROR,

View File

@@ -10449,6 +10449,7 @@ static int cam_ife_hw_mgr_handle_csid_error(
g_ife_hw_mgr.debug_cfg.enable_csid_recovery) {
error_event_data.error_type = CAM_ISP_HW_ERROR_CSID_FATAL;
error_event_data.error_code = CAM_REQ_MGR_CSID_FATAL_ERROR;
rc = cam_ife_hw_mgr_find_affected_ctx(&error_event_data,
event_info->hw_idx, &recovery_data);
goto end;
@@ -10460,6 +10461,15 @@ static int cam_ife_hw_mgr_handle_csid_error(
cam_ife_hw_mgr_notify_overflow(event_info, ctx);
error_event_data.error_type = CAM_ISP_HW_ERROR_OVERFLOW;
if (event_info->err_type & CAM_ISP_HW_ERROR_CSID_FIFO_OVERFLOW)
error_event_data.error_code |=
CAM_REQ_MGR_CSID_FIFO_OVERFLOW_ERROR;
if (event_info->err_type & CAM_ISP_HW_ERROR_RECOVERY_OVERFLOW)
error_event_data.error_code |=
CAM_REQ_MGR_CSID_RECOVERY_OVERFLOW_ERROR;
if (event_info->err_type & CAM_ISP_HW_ERROR_CSID_FRAME_SIZE)
error_event_data.error_code |=
CAM_REQ_MGR_CSID_PIXEL_COUNT_MISMATCH;
rc = cam_ife_hw_mgr_find_affected_ctx(&error_event_data,
event_info->hw_idx, &recovery_data);
}
@@ -10680,6 +10690,8 @@ static int cam_ife_hw_mgr_handle_hw_err(
if (g_ife_hw_mgr.debug_cfg.enable_req_dump)
error_event_data.enable_req_dump = true;
error_event_data.error_code = CAM_REQ_MGR_ISP_UNREPORTED_ERROR;
rc = cam_ife_hw_mgr_find_affected_ctx(&error_event_data,
core_idx, &recovery_data);

View File

@@ -5473,7 +5473,8 @@ static int cam_tfe_hw_mgr_find_affected_ctx(
*/
if (notify_err_cb) {
notify_err_cb(tfe_hwr_mgr_ctx->common.cb_priv,
CAM_ISP_HW_EVENT_ERROR, (void *)error_event_data);
CAM_ISP_HW_EVENT_ERROR,
(void *)error_event_data);
} else {
CAM_WARN(CAM_ISP, "Error call back is not set");
goto end;
@@ -5506,6 +5507,7 @@ static int cam_tfe_hw_mgr_handle_csid_event(
break;
error_event_data.error_type = event_info->err_type;
error_event_data.error_code = CAM_REQ_MGR_CSID_FATAL_ERROR;
cam_tfe_hw_mgr_find_affected_ctx(&error_event_data,
event_info->hw_idx,
&recovery_data);
@@ -5548,6 +5550,8 @@ static int cam_tfe_hw_mgr_handle_hw_err(
else
error_event_data.recovery_enabled = false;
error_event_data.error_code = CAM_REQ_MGR_ISP_UNREPORTED_ERROR;
rc = cam_tfe_hw_mgr_find_affected_ctx(&error_event_data,
core_idx, &recovery_data);
if (rc || !(recovery_data.no_of_context))

View File

@@ -241,6 +241,7 @@ struct cam_isp_hw_eof_event_data {
* struct cam_isp_hw_error_event_data - Event payload for CAM_HW_EVENT_ERROR
*
* @error_type: Error type for the error event
* @error_code: HW Error Code that caused to trigger this event
* @timestamp: Timestamp for the error event
* @recovery_enabled: Identifies if the context needs to recover & reapply
* this request
@@ -248,6 +249,7 @@ struct cam_isp_hw_eof_event_data {
*/
struct cam_isp_hw_error_event_data {
uint32_t error_type;
uint32_t error_code;
uint64_t timestamp;
bool recovery_enabled;
bool enable_req_dump;

View File

@@ -352,6 +352,8 @@ static int __cam_req_mgr_notify_error_on_link(
msg.u.err_msg.request_id =
link->req.apply_data[pd].req_id;
msg.u.err_msg.link_hdl = link->link_hdl;
msg.u.err_msg.resource_size = 0;
msg.u.err_msg.error_code = CAM_REQ_MGR_LINK_STALLED_ERROR;
CAM_DBG(CAM_CRM, "Failed for device: %s while applying request: %lld",
dev->dev_info.name, link->req.apply_data[pd].req_id);
@@ -2195,6 +2197,8 @@ static int __cam_req_mgr_process_sof_freeze(void *priv, void *data)
msg.u.err_msg.error_type = CAM_REQ_MGR_ERROR_TYPE_SOF_FREEZE;
msg.u.err_msg.request_id = 0;
msg.u.err_msg.link_hdl = link->link_hdl;
msg.u.err_msg.error_code = CAM_REQ_MGR_ISP_UNREPORTED_ERROR;
msg.u.err_msg.resource_size = 0;
rc = cam_req_mgr_notify_message(&msg,
V4L_EVENT_CAM_REQ_MGR_ERROR, V4L_EVENT_CAM_REQ_MGR_EVENT);

View File

@@ -242,11 +242,12 @@ static void cam_v4l2_event_queue_notify_error(const struct v4l2_event *old,
break;
case V4L_EVENT_CAM_REQ_MGR_ERROR:
CAM_ERR_RATE_LIMIT(CAM_CRM,
"Failed to notify ERROR Sess %X ReqId %d Link %X Type %d",
"Failed to notify ERROR Sess %X ReqId %d Link %X Type %d ERR_code: %u",
ev_header->session_hdl,
ev_header->u.err_msg.request_id,
ev_header->u.err_msg.link_hdl,
ev_header->u.err_msg.error_type);
ev_header->u.err_msg.error_type,
ev_header->u.err_msg.error_code);
break;
default:
CAM_ERR(CAM_CRM, "Failed to notify crm event id %d",

View File

@@ -438,6 +438,22 @@ struct cam_mem_cache_ops_cmd {
#define CAM_REQ_MGR_ERROR_TYPE_FULL_RECOVERY 5
#define CAM_REQ_MGR_ERROR_TYPE_PAGE_FAULT 6
/**
* Request Manager : Error codes
* @CAM_REQ_MGR_ISP_UNREPORTED_ERROR : No Error Code reported
* @CAM_REQ_MGR_LINK_STALLED_ERROR : Unable to apply requests on link
* @CAM_REQ_MGR_CSID_FATAL_ERROR : CSID FATAL Error
* @CAM_REQ_MGR_CSID_FIFO_OVERFLOW_ERROR : CSID FIFO Overflow
* @CAM_REQ_MGR_CSID_RECOVERY_OVERFLOW_ERROR : CSID Recovery Overflow
* @CAM_REQ_MGR_CSID_PIXEL_COUNT_MISMATCH : CSID Pixel Count Mismatch
*/
#define CAM_REQ_MGR_ISP_UNREPORTED_ERROR 0
#define CAM_REQ_MGR_LINK_STALLED_ERROR BIT(0)
#define CAM_REQ_MGR_CSID_FATAL_ERROR BIT(1)
#define CAM_REQ_MGR_CSID_FIFO_OVERFLOW_ERROR BIT(2)
#define CAM_REQ_MGR_CSID_RECOVERY_OVERFLOW_ERROR BIT(3)
#define CAM_REQ_MGR_CSID_PIXEL_COUNT_MISMATCH BIT(5)
/**
* struct cam_req_mgr_error_msg
* @error_type: type of error
@@ -445,13 +461,16 @@ struct cam_mem_cache_ops_cmd {
* @device_hdl: device handle
* @linke_hdl: link_hdl
* @resource_size: size of the resource
* @error_code: Error code reported by the event.
* Note: This field is a bit field.
*/
struct cam_req_mgr_error_msg {
__u32 error_type;
__u32 request_id;
__s32 device_hdl;
__s32 link_hdl;
__u64 resource_size;
__u32 resource_size;
__u32 error_code;
};
/**