Procházet zdrojové kódy

video: driver: add support to bugon for requested types

Added change to enable bugon at handle_system_error for
error types requested via debugfs property.

Fatal:
adb shell "echo 0x1 > /d/msm_vidc/enable_bugon"

NoC:
adb shell "echo 0x2 > /d/msm_vidc/enable_bugon"

WD Timeout:
adb shell "echo 0x4 > /d/msm_vidc/enable_bugon".

Change-Id: Iecc1b076c7ca53acee837d68e1a7446dbaef6e94
Signed-off-by: Govindaraj Rajagopal <[email protected]>
Govindaraj Rajagopal před 4 roky
rodič
revize
63614e76b8

+ 15 - 0
driver/vidc/inc/msm_vidc_debug.h

@@ -35,6 +35,7 @@ extern bool msm_vidc_lossless_encode;
 extern bool msm_vidc_syscache_disable;
 extern int msm_vidc_clock_voting;
 extern bool msm_vidc_fw_dump;
+extern unsigned int msm_vidc_enable_bugon;
 
 /* To enable messages OR these values and
  * echo the result to debugfs file.
@@ -120,6 +121,14 @@ enum vidc_msg_prio {
 		} \
 	} while (0)
 
+#define MSM_VIDC_FATAL(value)	\
+	do { \
+		if (value) { \
+			d_vpr_e("bug on\n"); \
+			BUG_ON(value); \
+		} \
+	} while (0)
+
 enum msm_vidc_debugfs_event {
 	MSM_VIDC_DEBUGFS_EVENT_ETB,
 	MSM_VIDC_DEBUGFS_EVENT_EBD,
@@ -127,6 +136,12 @@ enum msm_vidc_debugfs_event {
 	MSM_VIDC_DEBUGFS_EVENT_FBD,
 };
 
+enum msm_vidc_bug_on_error {
+	MSM_VIDC_BUG_ON_FATAL             = BIT(0),
+	MSM_VIDC_BUG_ON_NOC               = BIT(1),
+	MSM_VIDC_BUG_ON_WD_TIMEOUT        = BIT(2),
+};
+
 struct dentry *msm_vidc_debugfs_init_drv(void);
 struct dentry *msm_vidc_debugfs_init_core(void *core);
 struct dentry *msm_vidc_debugfs_init_inst(void *inst,

+ 5 - 0
driver/vidc/src/msm_vidc_debug.c

@@ -86,6 +86,9 @@ int msm_vidc_clock_voting = !1;
 bool msm_vidc_fw_dump = !true;
 EXPORT_SYMBOL(msm_vidc_fw_dump);
 
+unsigned int msm_vidc_enable_bugon = !1;
+EXPORT_SYMBOL(msm_vidc_enable_bugon);
+
 #define MAX_DBG_BUF_SIZE 4096
 
 struct core_inst_pair {
@@ -249,6 +252,8 @@ struct dentry* msm_vidc_debugfs_init_drv()
 			&msm_vidc_lossless_encode);
 	debugfs_create_bool("msm_vidc_fw_dump", 0644, dir,
 			&msm_vidc_fw_dump);
+	debugfs_create_u32("enable_bugon", 0644, dir,
+			&msm_vidc_enable_bugon);
 
 	return dir;
 

+ 16 - 1
driver/vidc/src/venus_hfi_response.c

@@ -436,10 +436,25 @@ void fw_coredump(struct msm_vidc_core *core)
 int handle_system_error(struct msm_vidc_core *core,
 	struct hfi_packet *pkt)
 {
-	d_vpr_e("%s: system error received\n", __func__);
+	bool bug_on = false;
 
+	d_vpr_e("%s: system error received\n", __func__);
 	print_sfr_message(core);
 	venus_hfi_noc_error_info(core);
+
+	/* enable force bugon for requested type */
+	if (pkt->type == HFI_SYS_ERROR_FATAL)
+		bug_on = !!(msm_vidc_enable_bugon & MSM_VIDC_BUG_ON_FATAL);
+	else if (pkt->type == HFI_SYS_ERROR_NOC)
+		bug_on = !!(msm_vidc_enable_bugon & MSM_VIDC_BUG_ON_NOC);
+	else if (pkt->type == HFI_SYS_ERROR_WD_TIMEOUT)
+		bug_on = !!(msm_vidc_enable_bugon & MSM_VIDC_BUG_ON_WD_TIMEOUT);
+
+	if (bug_on) {
+		d_vpr_e("%s: force bugon for type %#x\n", __func__, pkt->type);
+		MSM_VIDC_FATAL(true);
+	}
+
 	msm_vidc_core_deinit(core, true);
 
 	return 0;