|
@@ -72,31 +72,6 @@ void print_hfi_queue_info(struct cvp_hfi_device *hdev)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-struct msm_cvp_core *get_cvp_core(int core_id)
|
|
|
-{
|
|
|
- struct msm_cvp_core *core;
|
|
|
- int found = 0;
|
|
|
-
|
|
|
- if (core_id > MSM_CVP_CORES_MAX) {
|
|
|
- dprintk(CVP_ERR, "Core id = %d is greater than max = %d\n",
|
|
|
- core_id, MSM_CVP_CORES_MAX);
|
|
|
- return NULL;
|
|
|
- }
|
|
|
- mutex_lock(&cvp_driver->lock);
|
|
|
- list_for_each_entry(core, &cvp_driver->cores, list) {
|
|
|
- if (core->id == core_id) {
|
|
|
- found = 1;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- mutex_unlock(&cvp_driver->lock);
|
|
|
- if (found)
|
|
|
- return core;
|
|
|
- return NULL;
|
|
|
-}
|
|
|
-
|
|
|
static void handle_sys_init_done(enum hal_command_response cmd, void *data)
|
|
|
{
|
|
|
struct msm_cvp_cb_cmd_done *response = data;
|
|
@@ -116,7 +91,7 @@ static void handle_sys_init_done(enum hal_command_response cmd, void *data)
|
|
|
"Failed to get valid response for sys init\n");
|
|
|
return;
|
|
|
}
|
|
|
- core = get_cvp_core(response->device_id);
|
|
|
+ core = cvp_driver->cvp_core;
|
|
|
if (!core) {
|
|
|
dprintk(CVP_ERR, "Wrong device_id received\n");
|
|
|
return;
|
|
@@ -239,8 +214,7 @@ static void handle_session_set_buf_done(enum hal_command_response cmd,
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- inst = cvp_get_inst(get_cvp_core(response->device_id),
|
|
|
- response->session_id);
|
|
|
+ inst = cvp_get_inst(cvp_driver->cvp_core, response->session_id);
|
|
|
if (!inst) {
|
|
|
dprintk(CVP_WARN, "set_buf_done has an inactive session\n");
|
|
|
return;
|
|
@@ -275,8 +249,7 @@ static void handle_session_release_buf_done(enum hal_command_response cmd,
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- inst = cvp_get_inst(get_cvp_core(response->device_id),
|
|
|
- response->session_id);
|
|
|
+ inst = cvp_get_inst(cvp_driver->cvp_core, response->session_id);
|
|
|
if (!inst) {
|
|
|
dprintk(CVP_WARN,
|
|
|
"%s: Got a response for an inactive session\n",
|
|
@@ -321,7 +294,7 @@ static void handle_sys_release_res_done(
|
|
|
"Failed to get valid response for sys init\n");
|
|
|
return;
|
|
|
}
|
|
|
- core = get_cvp_core(response->device_id);
|
|
|
+ core = cvp_driver->cvp_core;
|
|
|
if (!core) {
|
|
|
dprintk(CVP_ERR, "Wrong device_id received\n");
|
|
|
return;
|
|
@@ -428,8 +401,7 @@ static void handle_session_init_done(enum hal_command_response cmd, void *data)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- inst = cvp_get_inst(get_cvp_core(response->device_id),
|
|
|
- response->session_id);
|
|
|
+ inst = cvp_get_inst(cvp_driver->cvp_core, response->session_id);
|
|
|
|
|
|
if (!inst) {
|
|
|
dprintk(CVP_WARN, "%s:Got a response for an inactive session\n",
|
|
@@ -471,8 +443,7 @@ static void handle_session_dump_notify(enum hal_command_response cmd,
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- inst = cvp_get_inst(get_cvp_core(response->device_id),
|
|
|
- response->session_id);
|
|
|
+ inst = cvp_get_inst(cvp_driver->cvp_core, response->session_id);
|
|
|
if (!inst) {
|
|
|
dprintk(CVP_WARN, "%s:Got a response for an inactive session\n",
|
|
|
__func__);
|
|
@@ -497,8 +468,7 @@ static void handle_release_res_done(enum hal_command_response cmd, void *data)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- inst = cvp_get_inst(get_cvp_core(response->device_id),
|
|
|
- response->session_id);
|
|
|
+ inst = cvp_get_inst(cvp_driver->cvp_core, response->session_id);
|
|
|
if (!inst) {
|
|
|
dprintk(CVP_WARN, "%s:Got a response for an inactive session\n",
|
|
|
__func__);
|
|
@@ -520,8 +490,7 @@ static void handle_session_ctrl(enum hal_command_response cmd, void *data)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- inst = cvp_get_inst(get_cvp_core(response->device_id),
|
|
|
- response->session_id);
|
|
|
+ inst = cvp_get_inst(cvp_driver->cvp_core, response->session_id);
|
|
|
if (!inst) {
|
|
|
dprintk(CVP_WARN, "%s:Got a response for an inactive session\n",
|
|
|
__func__);
|
|
@@ -551,8 +520,7 @@ static void handle_session_error(enum hal_command_response cmd, void *data)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- inst = cvp_get_inst(get_cvp_core(response->device_id),
|
|
|
- response->session_id);
|
|
|
+ inst = cvp_get_inst(cvp_driver->cvp_core, response->session_id);
|
|
|
if (!inst) {
|
|
|
dprintk(CVP_WARN, "%s: response for an inactive session\n",
|
|
|
__func__);
|
|
@@ -596,7 +564,7 @@ void handle_sys_error(enum hal_command_response cmd, void *data)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- core = get_cvp_core(response->device_id);
|
|
|
+ core = cvp_driver->cvp_core;
|
|
|
if (!core) {
|
|
|
dprintk(CVP_ERR,
|
|
|
"Got SYS_ERR but unable to identify core\n");
|
|
@@ -702,8 +670,7 @@ static void handle_session_close(enum hal_command_response cmd, void *data)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- inst = cvp_get_inst(get_cvp_core(response->device_id),
|
|
|
- response->session_id);
|
|
|
+ inst = cvp_get_inst(cvp_driver->cvp_core, response->session_id);
|
|
|
if (!inst) {
|
|
|
dprintk(CVP_WARN, "%s: response for an inactive session\n",
|
|
|
__func__);
|
|
@@ -784,53 +751,6 @@ static inline enum msm_cvp_thermal_level msm_comm_cvp_thermal_level(int level)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-static bool is_core_turbo(struct msm_cvp_core *core, unsigned long freq)
|
|
|
-{
|
|
|
- int i = 0;
|
|
|
- struct allowed_clock_rates_table *allowed_clks_tbl = NULL;
|
|
|
- u32 max_freq = 0;
|
|
|
-
|
|
|
- allowed_clks_tbl = core->resources.allowed_clks_tbl;
|
|
|
- for (i = 0; i < core->resources.allowed_clks_tbl_size; i++) {
|
|
|
- if (max_freq < allowed_clks_tbl[i].clock_rate)
|
|
|
- max_freq = allowed_clks_tbl[i].clock_rate;
|
|
|
- }
|
|
|
- return freq >= max_freq;
|
|
|
-}
|
|
|
-
|
|
|
-static bool is_thermal_permissible(struct msm_cvp_core *core)
|
|
|
-{
|
|
|
- enum msm_cvp_thermal_level tl;
|
|
|
- unsigned long freq = 0;
|
|
|
- bool is_turbo = false;
|
|
|
-
|
|
|
- if (!core->resources.thermal_mitigable)
|
|
|
- return true;
|
|
|
-
|
|
|
- if (msm_cvp_thermal_mitigation_disabled) {
|
|
|
- dprintk(CVP_CORE,
|
|
|
- "Thermal mitigation not enabled. debugfs %d\n",
|
|
|
- msm_cvp_thermal_mitigation_disabled);
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- tl = msm_comm_cvp_thermal_level(cvp_driver->thermal_level);
|
|
|
- freq = core->curr_freq;
|
|
|
-
|
|
|
- is_turbo = is_core_turbo(core, freq);
|
|
|
- dprintk(CVP_CORE,
|
|
|
- "Core freq %ld Thermal level %d Turbo mode %d\n",
|
|
|
- freq, tl, is_turbo);
|
|
|
-
|
|
|
- if (is_turbo && tl >= CVP_THERMAL_LOW) {
|
|
|
- dprintk(CVP_ERR,
|
|
|
- "CVP session not allowed. Turbo mode %d Thermal level %d\n",
|
|
|
- is_turbo, tl);
|
|
|
- return false;
|
|
|
- }
|
|
|
- return true;
|
|
|
-}
|
|
|
-
|
|
|
static int msm_comm_session_abort(struct msm_cvp_inst *inst)
|
|
|
{
|
|
|
int rc = 0, abort_completion = 0;
|
|
@@ -875,22 +795,9 @@ exit:
|
|
|
return rc;
|
|
|
}
|
|
|
|
|
|
-static void handle_thermal_event(struct msm_cvp_core *core)
|
|
|
-{
|
|
|
- dprintk(CVP_WARN, "Deprecated thermal_event handler\n");
|
|
|
-}
|
|
|
-
|
|
|
void msm_cvp_comm_handle_thermal_event(void)
|
|
|
{
|
|
|
- struct msm_cvp_core *core;
|
|
|
-
|
|
|
- list_for_each_entry(core, &cvp_driver->cores, list) {
|
|
|
- if (!is_thermal_permissible(core)) {
|
|
|
- dprintk(CVP_WARN,
|
|
|
- "Thermal level critical, stop all active sessions!\n");
|
|
|
- handle_thermal_event(core);
|
|
|
- }
|
|
|
- }
|
|
|
+ dprintk(CVP_WARN, "deprecated %s called\n", __func__);
|
|
|
}
|
|
|
|
|
|
int msm_cvp_comm_check_core_init(struct msm_cvp_core *core)
|
|
@@ -900,8 +807,8 @@ int msm_cvp_comm_check_core_init(struct msm_cvp_core *core)
|
|
|
|
|
|
mutex_lock(&core->lock);
|
|
|
if (core->state >= CVP_CORE_INIT_DONE) {
|
|
|
- dprintk(CVP_INFO, "CVP core: %d is already in state: %d\n",
|
|
|
- core->id, core->state);
|
|
|
+ dprintk(CVP_INFO, "CVP core: is already in state: %d\n",
|
|
|
+ core->state);
|
|
|
goto exit;
|
|
|
}
|
|
|
dprintk(CVP_CORE, "Waiting for SYS_INIT_DONE\n");
|
|
@@ -952,8 +859,8 @@ static int msm_comm_init_core(struct msm_cvp_inst *inst)
|
|
|
hdev = core->device;
|
|
|
mutex_lock(&core->lock);
|
|
|
if (core->state >= CVP_CORE_INIT) {
|
|
|
- dprintk(CVP_CORE, "CVP core: %d is already in state: %d\n",
|
|
|
- core->id, core->state);
|
|
|
+ dprintk(CVP_CORE, "CVP core: is already in state: %d\n",
|
|
|
+ core->state);
|
|
|
goto core_already_inited;
|
|
|
}
|
|
|
if (!core->capabilities) {
|
|
@@ -974,8 +881,7 @@ static int msm_comm_init_core(struct msm_cvp_inst *inst)
|
|
|
dprintk(CVP_CORE, "%s: core %pK\n", __func__, core);
|
|
|
rc = call_hfi_op(hdev, core_init, hdev->hfi_device_data);
|
|
|
if (rc) {
|
|
|
- dprintk(CVP_ERR, "Failed to init core, id = %d\n",
|
|
|
- core->id);
|
|
|
+ dprintk(CVP_ERR, "Failed to init core\n");
|
|
|
goto fail_core_init;
|
|
|
}
|
|
|
core->state = CVP_CORE_INIT;
|
|
@@ -1095,17 +1001,16 @@ exit:
|
|
|
return rc;
|
|
|
}
|
|
|
|
|
|
-int msm_cvp_comm_suspend(int core_id)
|
|
|
+int msm_cvp_comm_suspend(void)
|
|
|
{
|
|
|
struct cvp_hfi_device *hdev;
|
|
|
struct msm_cvp_core *core;
|
|
|
int rc = 0;
|
|
|
|
|
|
- core = get_cvp_core(core_id);
|
|
|
+ core = cvp_driver->cvp_core;
|
|
|
if (!core) {
|
|
|
dprintk(CVP_ERR,
|
|
|
- "%s: Failed to find core for core_id = %d\n",
|
|
|
- __func__, core_id);
|
|
|
+ "%s: Failed to find cvp core\n", __func__);
|
|
|
return -EINVAL;
|
|
|
}
|
|
|
|
|
@@ -1153,7 +1058,7 @@ int msm_cvp_comm_try_state(struct msm_cvp_inst *inst, int state)
|
|
|
int flipped_state;
|
|
|
struct msm_cvp_core *core;
|
|
|
|
|
|
- core = list_first_entry(&cvp_driver->cores, struct msm_cvp_core, list);
|
|
|
+ core = cvp_driver->cvp_core;
|
|
|
|
|
|
if (!inst) {
|
|
|
dprintk(CVP_ERR, "%s: invalid params %pK", __func__, inst);
|
|
@@ -1362,7 +1267,6 @@ void msm_cvp_comm_generate_sys_error(struct msm_cvp_inst *inst)
|
|
|
}
|
|
|
dprintk(CVP_WARN, "%s: inst %pK\n", __func__, inst);
|
|
|
core = inst->core;
|
|
|
- response.device_id = (u32) core->id;
|
|
|
handle_sys_error(cmd, (void *) &response);
|
|
|
|
|
|
}
|
|
@@ -1480,7 +1384,7 @@ bool is_cvp_inst_valid(struct msm_cvp_inst *inst)
|
|
|
struct msm_cvp_core *core;
|
|
|
struct msm_cvp_inst *sess;
|
|
|
|
|
|
- core = list_first_entry(&cvp_driver->cores, struct msm_cvp_core, list);
|
|
|
+ core = cvp_driver->cvp_core;
|
|
|
if (!core)
|
|
|
return false;
|
|
|
|