video: driver: treat sesion_open and session_close failure as fatal

do core_deinit for sesion_open and session_close failures, to
handle recurring clock prepare failure.

Change-Id: I1c305f9e6269f7176b8283dbe91712f9e31448f5
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
This commit is contained in:
Govindaraj Rajagopal
2021-05-26 12:08:02 +05:30
parent 421d199f44
commit b0e9eab96d
3 changed files with 41 additions and 20 deletions

View File

@@ -883,8 +883,10 @@ void *msm_vidc_open(void *vidc_core, u32 session_type)
msm_vidc_scale_power(inst, true); msm_vidc_scale_power(inst, true);
rc = msm_vidc_session_open(inst); rc = msm_vidc_session_open(inst);
if (rc) if (rc) {
msm_vidc_core_deinit(core, true);
goto error; goto error;
}
inst->debugfs_root = inst->debugfs_root =
msm_vidc_debugfs_init_inst(inst, core->debugfs_root); msm_vidc_debugfs_init_inst(inst, core->debugfs_root);

View File

@@ -4032,7 +4032,7 @@ int msm_vidc_core_deinit(struct msm_vidc_core *core, bool force)
/* unlink all sessions from core, if any */ /* unlink all sessions from core, if any */
list_for_each_entry_safe(inst, dummy, &core->instances, list) { list_for_each_entry_safe(inst, dummy, &core->instances, list) {
msm_vidc_change_inst_state(inst, MSM_VIDC_ERROR, __func__); msm_vidc_change_inst_state(inst, MSM_VIDC_ERROR, __func__);
list_del(&inst->list); list_del_init(&inst->list);
} }
msm_vidc_change_core_state(core, MSM_VIDC_CORE_DEINIT, __func__); msm_vidc_change_core_state(core, MSM_VIDC_CORE_DEINIT, __func__);

View File

@@ -911,7 +911,8 @@ static int __iface_cmdq_write_relaxed(struct msm_vidc_core *core,
goto err_q_null; goto err_q_null;
} }
if (__resume(core)) { rc = __resume(core);
if (rc) {
d_vpr_e("%s: Power on failed\n", __func__); d_vpr_e("%s: Power on failed\n", __func__);
goto err_q_write; goto err_q_write;
} }
@@ -1092,14 +1093,18 @@ static int __sys_set_debug(struct msm_vidc_core *core, u32 debug)
rc = hfi_packet_sys_debug_config(core, core->packet, rc = hfi_packet_sys_debug_config(core, core->packet,
core->packet_size, debug); core->packet_size, debug);
if (rc) { if (rc)
d_vpr_e("Debug mode setting to FW failed\n"); goto exit;
return -ENOTEMPTY;
}
if (__iface_cmdq_write(core, core->packet)) rc = __iface_cmdq_write(core, core->packet);
return -ENOTEMPTY; if (rc)
return 0; goto exit;
exit:
if (rc)
d_vpr_e("Debug mode setting to FW failed\n");
return rc;
} }
/* /*
static int __sys_set_coverage(struct msm_vidc_core *core, static int __sys_set_coverage(struct msm_vidc_core *core,
@@ -1529,7 +1534,7 @@ failed_to_reset:
static int __prepare_enable_clks(struct msm_vidc_core *core) static int __prepare_enable_clks(struct msm_vidc_core *core)
{ {
struct clock_info *cl = NULL, *cl_fail = NULL; struct clock_info *cl = NULL;
int rc = 0, c = 0; int rc = 0, c = 0;
if (!core) { if (!core) {
@@ -1555,7 +1560,6 @@ static int __prepare_enable_clks(struct msm_vidc_core *core)
rc = clk_prepare_enable(cl->clk); rc = clk_prepare_enable(cl->clk);
if (rc) { if (rc) {
d_vpr_e("Failed to enable clocks\n"); d_vpr_e("Failed to enable clocks\n");
cl_fail = cl;
goto fail_clk_enable; goto fail_clk_enable;
} }
@@ -2697,7 +2701,7 @@ irqreturn_t venus_hfi_isr(int irq, void *data)
void venus_hfi_work_handler(struct work_struct *work) void venus_hfi_work_handler(struct work_struct *work)
{ {
struct msm_vidc_core *core; struct msm_vidc_core *core;
int num_responses = 0; int num_responses = 0, rc = 0;
d_vpr_l("%s()\n", __func__); d_vpr_l("%s()\n", __func__);
core = container_of(work, struct msm_vidc_core, device_work); core = container_of(work, struct msm_vidc_core, device_work);
@@ -2707,7 +2711,8 @@ void venus_hfi_work_handler(struct work_struct *work)
} }
core_lock(core, __func__); core_lock(core, __func__);
if (__resume(core)) { rc = __resume(core);
if (rc) {
d_vpr_e("%s: Power on failed\n", __func__); d_vpr_e("%s: Power on failed\n", __func__);
core_unlock(core, __func__); core_unlock(core, __func__);
goto err_no_work; goto err_no_work;
@@ -2718,7 +2723,6 @@ void venus_hfi_work_handler(struct work_struct *work)
num_responses = __response_handler(core); num_responses = __response_handler(core);
err_no_work: err_no_work:
if (!call_venus_op(core, watchdog, core, core->intr_status)) if (!call_venus_op(core, watchdog, core, core->intr_status))
enable_irq(core->dt->irq); enable_irq(core->dt->irq);
} }
@@ -2886,6 +2890,8 @@ int venus_hfi_core_deinit(struct msm_vidc_core *core)
int venus_hfi_noc_error_info(struct msm_vidc_core *core) int venus_hfi_noc_error_info(struct msm_vidc_core *core)
{ {
int rc = 0;
if (!core || !core->capabilities) { if (!core || !core->capabilities) {
d_vpr_e("%s: Invalid parameters: %pK\n", d_vpr_e("%s: Invalid parameters: %pK\n",
__func__, core); __func__, core);
@@ -2900,7 +2906,8 @@ int venus_hfi_noc_error_info(struct msm_vidc_core *core)
goto unlock; goto unlock;
/* resume venus before accessing noc registers */ /* resume venus before accessing noc registers */
if (__resume(core)) { rc = __resume(core);
if (rc) {
d_vpr_e("%s: Power on failed\n", __func__); d_vpr_e("%s: Power on failed\n", __func__);
goto unlock; goto unlock;
} }
@@ -2909,7 +2916,7 @@ int venus_hfi_noc_error_info(struct msm_vidc_core *core)
unlock: unlock:
core_unlock(core, __func__); core_unlock(core, __func__);
return 0; return rc;
} }
int venus_hfi_suspend(struct msm_vidc_core *core) int venus_hfi_suspend(struct msm_vidc_core *core)
@@ -3533,12 +3540,15 @@ int venus_hfi_scale_clocks(struct msm_vidc_inst* inst, u64 freq)
core = inst->core; core = inst->core;
core_lock(core, __func__); core_lock(core, __func__);
if (__resume(core)) { rc = __resume(core);
i_vpr_e(inst, "Resume from power collapse failed\n"); if (rc) {
rc = -EINVAL; i_vpr_e(inst, "%s: Resume from power collapse failed\n", __func__);
goto exit; goto exit;
} }
rc = __set_clocks(core, freq); rc = __set_clocks(core, freq);
if (rc)
goto exit;
exit: exit:
core_unlock(core, __func__); core_unlock(core, __func__);
@@ -3557,7 +3567,16 @@ int venus_hfi_scale_buses(struct msm_vidc_inst *inst, u64 bw_ddr, u64 bw_llcc)
core = inst->core; core = inst->core;
core_lock(core, __func__); core_lock(core, __func__);
rc = __resume(core);
if (rc) {
i_vpr_e(inst, "%s: Resume from power collapse failed\n", __func__);
goto exit;
}
rc = __vote_buses(core, bw_ddr, bw_llcc); rc = __vote_buses(core, bw_ddr, bw_llcc);
if (rc)
goto exit;
exit:
core_unlock(core, __func__); core_unlock(core, __func__);
return rc; return rc;