Browse Source

Merge "msm: camera: ope: Dump stripe info at the time of hang" into camera-kernel.lnx.5.0

Haritha Chintalapati 4 years ago
parent
commit
cf41c1c81b

+ 11 - 0
drivers/cam_cdm/cam_cdm_hw_core.c

@@ -519,6 +519,17 @@ void cam_hw_cdm_dump_core_debug_registers(struct cam_hw_info *cdm_hw,
 			(dump_reg[1] & CAM_CDM_CURRENT_BL_TAG) >>
 				CAM_CDM_CURRENT_BL_TAG_SHIFT);
 
+	cam_cdm_read_hw_reg(cdm_hw,
+		core->offsets->cmn_reg->wait_status, &dump_reg[0]);
+	cam_cdm_read_hw_reg(cdm_hw,
+		core->offsets->cmn_reg->comp_wait[0]->comp_wait_status,
+		&dump_reg[1]);
+	cam_cdm_read_hw_reg(cdm_hw,
+		core->offsets->cmn_reg->comp_wait[1]->comp_wait_status,
+		&dump_reg[2]);
+	CAM_INFO(CAM_CDM, "wait status 0x%x comp wait status 0x%x: 0x%x",
+		dump_reg[0], dump_reg[1], dump_reg[2]);
+
 	cam_hw_cdm_disable_core_dbg(cdm_hw);
 	if (pause_core)
 		cam_hw_cdm_pause_core(cdm_hw, false);

+ 9 - 1
drivers/cam_ope/ope_hw_mgr/cam_ope_hw_mgr.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
  */
 
 #include <linux/uaccess.h>
@@ -706,6 +706,7 @@ static int32_t cam_ope_process_request_timer(void *priv, void *data)
 				hw_mgr->ope_dev_intf[i]->hw_priv,
 				OPE_HW_DUMP_DEBUG,
 				NULL, 0);
+
 		task = cam_req_mgr_workq_get_task(ope_hw_mgr->msg_work);
 		if (!task) {
 			CAM_ERR(CAM_OPE, "no empty task");
@@ -1603,6 +1604,7 @@ static void cam_ope_ctx_cdm_callback(uint32_t handle, void *userdata,
 	struct timespec64 ts;
 	uint32_t evt_id = CAM_CTX_EVT_ID_SUCCESS;
 	bool dump_flag = true;
+	int i;
 
 	if (!userdata) {
 		CAM_ERR(CAM_OPE, "Invalid ctx from CDM callback");
@@ -1664,9 +1666,15 @@ static void cam_ope_ctx_cdm_callback(uint32_t handle, void *userdata,
 			 ope_req->request_id, ctx->ctx_id);
 		CAM_INFO(CAM_OPE, "Rst of CDM and OPE for error reqid = %lld",
 			ope_req->request_id);
+
 		if (status != CAM_CDM_CB_STATUS_HW_FLUSH) {
 			cam_ope_dump_req_data(ope_req);
 			dump_flag = false;
+
+			CAM_INFO(CAM_OPE, "bach_size: %d", ctx->req_list[cookie]->num_batch);
+			for (i = 0; i < ctx->req_list[cookie]->num_batch; i++)
+				CAM_INFO(CAM_OPE, "i: %d num_stripes: %d",
+					i, ctx->req_list[cookie]->num_stripes[i]);
 		}
 		rc = cam_ope_mgr_reset_hw();
 		evt_id = CAM_CTX_EVT_ID_ERROR;

+ 17 - 1
drivers/cam_ope/ope_hw_mgr/ope_hw/ope_core.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
  */
 
 #include <linux/of.h>
@@ -789,6 +789,11 @@ static uint32_t *ope_create_stripe_cmd(struct cam_ope_hw_mgr *hw_mgr,
 	uint32_t *print_ptr;
 	int num_dmi = 0;
 	struct cam_cdm_utils_ops *cdm_ops;
+	uint32_t reg_val_pair[2];
+	struct cam_hw_info *ope_dev;
+	struct cam_ope_device_core_info *core_info;
+	struct ope_hw *ope_hw;
+	struct cam_ope_top_reg *top_reg;
 
 	if (s_idx >= OPE_MAX_CMD_BUFS ||
 		batch_idx >= OPE_MAX_BATCH_SIZE) {
@@ -870,10 +875,21 @@ static uint32_t *ope_create_stripe_cmd(struct cam_ope_hw_mgr *hw_mgr,
 			}
 			CAM_DBG(CAM_OPE, "Stripe:%d Indirect:X", stripe_idx);
 		}
+
 		if (hw_mgr->frame_dump_enable)
 			dump_stripe_cmd(frm_proc, stripe_idx, i, k,
 				iova_addr, kmd_buf, buf_len);
 	}
+
+	ope_dev = hw_mgr->ope_dev_intf[0]->hw_priv;
+	core_info = (struct cam_ope_device_core_info *)ope_dev->core_info;
+	ope_hw = core_info->ope_hw_info->ope_hw;
+	top_reg = ope_hw->top_reg;
+
+	reg_val_pair[0] = top_reg->offset + top_reg->scratch_reg;
+	reg_val_pair[1] = stripe_idx;
+	kmd_buf = cdm_ops->cdm_write_regrandom(kmd_buf, 1, reg_val_pair);
+
 	return kmd_buf;
 }
 

+ 2 - 1
drivers/cam_ope/ope_hw_mgr/ope_hw/ope_hw.h

@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
- * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
  */
 
 #ifndef CAM_OPE_HW_H
@@ -82,6 +82,7 @@ struct cam_ope_top_reg {
 	uint32_t violation_status;
 	uint32_t throttle_cnt_cfg;
 	uint32_t debug_cfg;
+	uint32_t scratch_reg;
 	uint32_t num_debug_registers;
 	struct cam_ope_debug_register *debug_regs;
 };

+ 6 - 2
drivers/cam_ope/ope_hw_mgr/ope_hw/ope_hw_100.h

@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
- * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
  */
 
 #ifndef CAM_OPE_HW_100_H
@@ -146,6 +146,9 @@ static struct cam_ope_debug_register ope_debug_regs[OPE_MAX_DEBUG_REGISTER] = {
 	{
 		.offset = 0xD0,
 	},
+	{
+		.offset = 0xD4,
+	},
 };
 
 static struct cam_ope_top_reg ope_top_reg = {
@@ -163,7 +166,8 @@ static struct cam_ope_top_reg ope_top_reg = {
 	.violation_status    = 0x28,
 	.throttle_cnt_cfg    = 0x2C,
 	.debug_cfg           = 0xDC,
-	.num_debug_registers = 9,
+	.scratch_reg         = 0x1F0,
+	.num_debug_registers = 10,
 	.debug_regs          = ope_debug_regs,
 };
 

+ 4 - 0
drivers/cam_ope/ope_hw_mgr/ope_hw/top/ope_top.c

@@ -49,6 +49,10 @@ static int cam_ope_top_dump_debug_reg(struct ope_hw *ope_hw_info)
 		CAM_INFO(CAM_OPE, "status[%d-%d] : 0x%x 0x%x 0x%x",
 			i, i+2, val[0], val[1], val[2]);
 	}
+
+	CAM_INFO(CAM_OPE, "scrath reg: 0x%x, stripe_idx: %d",
+		top_reg->offset + top_reg->scratch_reg,
+		cam_io_r_mb(top_reg->base + top_reg->scratch_reg));
 	return 0;
 }