msm: camera: isp: LDAR Dump ISP information

When user space detects an error or does not receive
response for a request, Lets do a reset(LDAR) is triggered.
Before LDAR, user space sends flush command to the
kernel space.
In order to debug the cause for this situation and to dump
the information, user space sends a dump command to
kernel space before sending flush.
As a part of this command, it passes the culprit request id
and the buffer into which the information can be dumped.
Kernel space traverses across the drivers and find the culprit hw
and dumps the relevant information in the buffer.
This data is written to a file for offline processing.
This commit dumps the IFE, CSID registers, LUT tables and context
information, cmd buffers, timestamps information for
submit, apply, RUP, epoch and buffdones of the last 20
requests.

CRs-Fixed: 2612116
Change-Id: If83db59458c1e5ad778f3fa90cbc730122491c54
Signed-off-by: Gaurav Jindal <gjindal@codeaurora.org>
This commit is contained in:
Gaurav Jindal
2019-10-14 17:09:54 +05:30
committed by Gerrit - the friendly Code Review server
parent 2460a8e82a
commit e3f5738e43
17 changed files with 1568 additions and 46 deletions

View File

@@ -33,6 +33,27 @@
*/
#define CAM_ISP_CTX_STATE_MONITOR_MAX_ENTRIES 40
/*
* Threshold response time in us beyond which a request is not expected
* to be with IFE hw
*/
#define CAM_ISP_CTX_RESPONSE_TIME_THRESHOLD 100000
/* Number of words for dumping isp context */
#define CAM_ISP_CTX_DUMP_NUM_WORDS 5
/* Number of words for dumping isp context events*/
#define CAM_ISP_CTX_DUMP_EVENT_NUM_WORDS 3
/* Number of words for dumping request info*/
#define CAM_ISP_CTX_DUMP_REQUEST_NUM_WORDS 2
/* Maximum entries in event record */
#define CAM_ISP_CTX_EVENT_RECORD_MAX_ENTRIES 20
/* Maximum length of tag while dumping */
#define CAM_ISP_CONTEXT_DUMP_TAG_MAX_LEN 32
/* forward declaration */
struct cam_isp_context;
@@ -55,6 +76,19 @@ enum cam_isp_ctx_activated_substate {
CAM_ISP_CTX_ACTIVATED_MAX,
};
/**
* enum cam_isp_ctx_event_type - events for a request
*
*/
enum cam_isp_ctx_event {
CAM_ISP_CTX_EVENT_SUBMIT,
CAM_ISP_CTX_EVENT_APPLY,
CAM_ISP_CTX_EVENT_EPOCH,
CAM_ISP_CTX_EVENT_RUP,
CAM_ISP_CTX_EVENT_BUFDONE,
CAM_ISP_CTX_EVENT_MAX
};
/**
* enum cam_isp_state_change_trigger - Different types of ISP events
*
@@ -109,6 +143,7 @@ struct cam_isp_ctx_irq_ops {
* @bubble_report: Flag to track if bubble report is active on
* current request
* @hw_update_data: HW update data for this request
* @event_timestamp: Timestamp for different stage of request
* @reapply: True if reapplying after bubble
*
*/
@@ -125,6 +160,8 @@ struct cam_isp_ctx_req {
uint32_t num_acked;
int32_t bubble_report;
struct cam_isp_prepare_hw_update_data hw_update_data;
ktime_t event_timestamp
[CAM_ISP_CTX_EVENT_MAX];
bool bubble_detected;
bool reapply;
};
@@ -160,8 +197,23 @@ struct cam_isp_context_state_monitor {
struct cam_isp_context_req_id_info {
int64_t last_bufdone_req_id;
};
/**
*
*
* struct cam_isp_context_event_record - Information for last 20 Events
* for a request; Submit, Apply, EPOCH, RUP, Buf done.
*
* @req_id: Last applied request id
* @timestamp: Timestamp for the event
*
*/
struct cam_isp_context_event_record {
uint64_t req_id;
ktime_t timestamp;
};
/**
* struct cam_isp_context - ISP context object
*
* @base: Common context object pointer
@@ -187,6 +239,8 @@ struct cam_isp_context_req_id_info {
* @state_monitor_head: Write index to the state monitoring array
* @req_info Request id information about last buf done
* @cam_isp_ctx_state_monitor: State monitoring array
* @event_record_head: Write index to the state monitoring array
* @event_record: Event record array
* @rdi_only_context: Get context type information.
* true, if context is rdi only context
* @hw_acquired: Indicate whether HW resources are acquired
@@ -221,6 +275,10 @@ struct cam_isp_context {
struct cam_isp_context_state_monitor cam_isp_ctx_state_monitor[
CAM_ISP_CTX_STATE_MONITOR_MAX_ENTRIES];
struct cam_isp_context_req_id_info req_info;
atomic64_t event_record_head[
CAM_ISP_CTX_EVENT_MAX];
struct cam_isp_context_event_record event_record[
CAM_ISP_CTX_EVENT_MAX][CAM_ISP_CTX_EVENT_RECORD_MAX_ENTRIES];
bool rdi_only_context;
bool hw_acquired;
bool init_received;
@@ -229,6 +287,19 @@ struct cam_isp_context {
uint32_t isp_device_type;
};
/**
* struct cam_isp_context_dump_header - ISP context dump header
* @tag: Tag name for the header
* @word_size: Size of word
* @size: Size of data
*
*/
struct cam_isp_context_dump_header {
uint8_t tag[CAM_ISP_CONTEXT_DUMP_TAG_MAX_LEN];
uint64_t size;
uint32_t word_size;
};
/**
* cam_isp_context_init()
*