Browse Source

msm: eva: Add control of EVA SSR behavior

For better debugging, it's conveninet to stall device when
EVA SSR happens.

Change-Id: I1bfd97d99ad3b6c0276282be9de4e7bb2456227d
Signed-off-by: George Shen <[email protected]>
George Shen 3 years ago
parent
commit
a610c57ca1
4 changed files with 31 additions and 0 deletions
  1. 1 0
      msm/eva/msm_cvp_common.c
  2. 28 0
      msm/eva/msm_cvp_debug.c
  3. 1 0
      msm/eva/msm_cvp_res_parse.c
  4. 1 0
      msm/eva/msm_cvp_resources.h

+ 1 - 0
msm/eva/msm_cvp_common.c

@@ -691,6 +691,7 @@ static void handle_sys_error(enum hal_command_response cmd, void *data)
 	mutex_unlock(&core->lock);
 
 	dprintk(CVP_WARN, "SYS_ERROR handled.\n");
+	BUG_ON(core->resources.fatal_ssr);
 }
 
 void msm_cvp_comm_session_clean(struct msm_cvp_inst *inst)

+ 28 - 0
msm/eva/msm_cvp_debug.c

@@ -386,6 +386,29 @@ static int _max_ssr_get(void *data, u64 *val)
 
 DEFINE_DEBUGFS_ATTRIBUTE(max_ssr_fops, _max_ssr_get, _max_ssr_set, "%llu\n");
 
+static int _ssr_stall_set(void *data, u64 val)
+{
+	struct msm_cvp_core *core;
+	core = list_first_entry(&cvp_driver->cores, struct msm_cvp_core, list);
+	if (core)
+		core->resources.fatal_ssr = (val >= 1) ? true : false;
+
+	return 0;
+}
+
+static int _ssr_stall_get(void *data, u64 *val)
+{
+	struct msm_cvp_core *core;
+	core = list_first_entry(&cvp_driver->cores, struct msm_cvp_core, list);
+	if (core)
+		*val = core->resources.fatal_ssr ? 1 : 0;
+
+	return 0;
+}
+
+DEFINE_DEBUGFS_ATTRIBUTE(ssr_stall_fops, _ssr_stall_get, _ssr_stall_set, "%llu\n");
+
+
 struct dentry *msm_cvp_debugfs_init_core(struct msm_cvp_core *core,
 		struct dentry *parent)
 {
@@ -430,6 +453,11 @@ struct dentry *msm_cvp_debugfs_init_core(struct msm_cvp_core *core,
 		goto failed_create_dir;
 	}
 
+	if (!debugfs_create_file("ssr_stall", 0644, dir,
+			NULL, &ssr_stall_fops)) {
+		dprintk(CVP_ERR, "debugfs_create: ssr_stall fail\n");
+		goto failed_create_dir;
+	}
 failed_create_dir:
 	return dir;
 }

+ 1 - 0
msm/eva/msm_cvp_res_parse.c

@@ -804,6 +804,7 @@ int cvp_read_platform_resources_from_drv_data(
 
 	res->vpu_ver = platform_data->vpu_ver;
 	res->ubwc_config = platform_data->ubwc_config;
+	res->fatal_ssr = false;
 	return rc;
 
 }

+ 1 - 0
msm/eva/msm_cvp_resources.h

@@ -176,6 +176,7 @@ struct msm_cvp_platform_resources {
 	int msm_cvp_firmware_unload_delay;
 	uint32_t msm_cvp_pwr_collapse_delay;
 	bool non_fatal_pagefaults;
+	bool fatal_ssr;
 	struct msm_cvp_mem_cdsp mem_cdsp;
 	uint32_t vpu_ver;
 	uint32_t fw_cycles;