msm: eva: Support Synx V2 only
Simplify code base for future generations of driver. Change-Id: I9ed940184da3b2224c74092ac31163de29c84f64 Signed-off-by: George Shen <quic_sqiao@quicinc.com>
This commit is contained in:
@@ -213,12 +213,7 @@ struct eva_kmd_hfi_fence_packet {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct eva_kmd_fence {
|
struct eva_kmd_fence {
|
||||||
#ifdef CVP_CONFIG_SYNX_V2
|
|
||||||
__u32 h_synx;
|
__u32 h_synx;
|
||||||
#else
|
|
||||||
__s32 h_synx;
|
|
||||||
__u32 secure_key;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct eva_kmd_fence_ctrl {
|
struct eva_kmd_fence_ctrl {
|
||||||
|
@@ -36,7 +36,6 @@ enum queue_state {
|
|||||||
|
|
||||||
#ifdef CONFIG_EVA_PINEAPPLE
|
#ifdef CONFIG_EVA_PINEAPPLE
|
||||||
#define CVP_MMRM_ENABLED 1
|
#define CVP_MMRM_ENABLED 1
|
||||||
#define CVP_CONFIG_SYNX_V2 1
|
|
||||||
#define CVP_SYNX_ENABLED 1
|
#define CVP_SYNX_ENABLED 1
|
||||||
#define CVP_FASTRPC_ENABLED 1
|
#define CVP_FASTRPC_ENABLED 1
|
||||||
#endif /* End of CONFIG_EVA_PINEAPPLE */
|
#endif /* End of CONFIG_EVA_PINEAPPLE */
|
||||||
|
@@ -2192,13 +2192,11 @@ static int iris_hfi_core_init(void *device)
|
|||||||
goto err_load_fw;
|
goto err_load_fw;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CVP_CONFIG_SYNX_V2
|
|
||||||
rc = cvp_synx_recover();
|
rc = cvp_synx_recover();
|
||||||
if (rc) {
|
if (rc) {
|
||||||
dprintk(CVP_ERR, "Failed to recover synx\n");
|
dprintk(CVP_ERR, "Failed to recover synx\n");
|
||||||
goto err_core_init;
|
goto err_core_init;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* mmrm registration */
|
/* mmrm registration */
|
||||||
if (msm_cvp_mmrm_enabled) {
|
if (msm_cvp_mmrm_enabled) {
|
||||||
|
@@ -308,7 +308,6 @@ struct cvp_hfi_client {
|
|||||||
u32 reserved2;
|
u32 reserved2;
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
#ifdef CVP_CONFIG_SYNX_V2
|
|
||||||
struct cvp_hfi_buf_type {
|
struct cvp_hfi_buf_type {
|
||||||
u32 iova;
|
u32 iova;
|
||||||
u32 size;
|
u32 size;
|
||||||
@@ -320,16 +319,6 @@ struct cvp_hfi_buf_type {
|
|||||||
u32 input_handle;
|
u32 input_handle;
|
||||||
u32 output_handle;
|
u32 output_handle;
|
||||||
};
|
};
|
||||||
#else
|
|
||||||
struct cvp_hfi_buf_type {
|
|
||||||
u32 iova;
|
|
||||||
u32 size;
|
|
||||||
u32 offset;
|
|
||||||
u32 flags;
|
|
||||||
u32 reserved1;
|
|
||||||
u32 reserved2;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct cvp_hfi_cmd_session_set_buffers_packet {
|
struct cvp_hfi_cmd_session_set_buffers_packet {
|
||||||
u32 size;
|
u32 size;
|
||||||
|
@@ -595,7 +595,6 @@ exit:
|
|||||||
static int cvp_populate_fences( struct eva_kmd_hfi_packet *in_pkt,
|
static int cvp_populate_fences( struct eva_kmd_hfi_packet *in_pkt,
|
||||||
unsigned int offset, unsigned int num, struct msm_cvp_inst *inst)
|
unsigned int offset, unsigned int num, struct msm_cvp_inst *inst)
|
||||||
{
|
{
|
||||||
#ifdef CVP_CONFIG_SYNX_V2
|
|
||||||
u32 i, buf_offset, fence_cnt;
|
u32 i, buf_offset, fence_cnt;
|
||||||
struct eva_kmd_fence fences[MAX_HFI_FENCE_SIZE];
|
struct eva_kmd_fence fences[MAX_HFI_FENCE_SIZE];
|
||||||
struct cvp_fence_command *f;
|
struct cvp_fence_command *f;
|
||||||
@@ -748,7 +747,6 @@ fence_cmd_queue:
|
|||||||
free_exit:
|
free_exit:
|
||||||
cvp_free_fence_data(f);
|
cvp_free_fence_data(f);
|
||||||
exit:
|
exit:
|
||||||
#endif /* CVP_CONFIG_SYNX_V2 */
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -12,8 +12,6 @@
|
|||||||
|
|
||||||
#ifdef CVP_SYNX_ENABLED
|
#ifdef CVP_SYNX_ENABLED
|
||||||
|
|
||||||
#ifdef CVP_CONFIG_SYNX_V2
|
|
||||||
|
|
||||||
static int cvp_sess_init_synx_v2(struct msm_cvp_inst *inst)
|
static int cvp_sess_init_synx_v2(struct msm_cvp_inst *inst)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -283,276 +281,6 @@ static struct msm_cvp_synx_ops cvp_synx = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#else
|
|
||||||
static int cvp_sess_init_synx_v1(struct msm_cvp_inst *inst)
|
|
||||||
{
|
|
||||||
struct synx_initialization_params params;
|
|
||||||
|
|
||||||
params.name = "cvp-kernel-client";
|
|
||||||
if (synx_initialize(&inst->synx_session_id, ¶ms)) {
|
|
||||||
|
|
||||||
dprintk(CVP_ERR, "%s synx_initialize failed\n", __func__);
|
|
||||||
return -EFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int cvp_sess_deinit_synx_v1(struct msm_cvp_inst *inst)
|
|
||||||
{
|
|
||||||
if (!inst) {
|
|
||||||
dprintk(CVP_ERR, "Used invalid sess in deinit_synx\n");
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
synx_uninitialize(inst->synx_session_id);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void cvp_dump_fence_queue_v1(struct msm_cvp_inst *inst)
|
|
||||||
{
|
|
||||||
struct cvp_fence_queue *q;
|
|
||||||
struct cvp_fence_command *f;
|
|
||||||
struct synx_session ssid;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
q = &inst->fence_cmd_queue;
|
|
||||||
ssid = inst->synx_session_id;
|
|
||||||
mutex_lock(&q->lock);
|
|
||||||
dprintk(CVP_WARN, "inst %x fence q mode %d, ssid %d\n",
|
|
||||||
hash32_ptr(inst->session), q->mode, ssid.client_id);
|
|
||||||
|
|
||||||
dprintk(CVP_WARN, "fence cmdq wait list:\n");
|
|
||||||
list_for_each_entry(f, &q->wait_list, list) {
|
|
||||||
dprintk(CVP_WARN, "frame pkt type 0x%x\n", f->pkt->packet_type);
|
|
||||||
for (i = 0; i < f->output_index; i++)
|
|
||||||
dprintk(CVP_WARN, "idx %d client hdl %d, state %d\n",
|
|
||||||
i, f->synx[i],
|
|
||||||
synx_get_status(ssid, f->synx[i]));
|
|
||||||
}
|
|
||||||
|
|
||||||
dprintk(CVP_WARN, "fence cmdq schedule list:\n");
|
|
||||||
list_for_each_entry(f, &q->sched_list, list) {
|
|
||||||
dprintk(CVP_WARN, "frame pkt type 0x%x\n", f->pkt->packet_type);
|
|
||||||
for (i = 0; i < f->output_index; i++)
|
|
||||||
dprintk(CVP_WARN, "idx %d client hdl %d, state %d\n",
|
|
||||||
i, f->synx[i],
|
|
||||||
synx_get_status(ssid, f->synx[i]));
|
|
||||||
}
|
|
||||||
mutex_unlock(&q->lock);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int cvp_import_synx_v1(struct msm_cvp_inst *inst,
|
|
||||||
struct cvp_fence_command *fc,
|
|
||||||
u32 *fence)
|
|
||||||
{
|
|
||||||
int rc = 0, rr = 0;
|
|
||||||
int i;
|
|
||||||
struct eva_kmd_fence *fs;
|
|
||||||
struct synx_import_params params;
|
|
||||||
s32 h_synx;
|
|
||||||
struct synx_session ssid;
|
|
||||||
|
|
||||||
if (fc->signature != 0xFEEDFACE) {
|
|
||||||
dprintk(CVP_ERR, "%s Deprecated synx path\n", __func__);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
fs = (struct eva_kmd_fence *)fence;
|
|
||||||
ssid = inst->synx_session_id;
|
|
||||||
|
|
||||||
for (i = 0; i < fc->num_fences; ++i) {
|
|
||||||
h_synx = fs[i].h_synx;
|
|
||||||
|
|
||||||
if (h_synx) {
|
|
||||||
params.h_synx = h_synx;
|
|
||||||
params.secure_key = fs[i].secure_key;
|
|
||||||
params.new_h_synx = &fc->synx[i];
|
|
||||||
|
|
||||||
rc = synx_import(ssid, ¶ms);
|
|
||||||
if (rc) {
|
|
||||||
dprintk(CVP_ERR,
|
|
||||||
"%s: %d synx_import failed\n",
|
|
||||||
__func__, h_synx);
|
|
||||||
rr = rc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return rr;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int cvp_release_synx_v1(struct msm_cvp_inst *inst,
|
|
||||||
struct cvp_fence_command *fc)
|
|
||||||
{
|
|
||||||
int rc = 0;
|
|
||||||
int i;
|
|
||||||
s32 h_synx;
|
|
||||||
struct synx_session ssid;
|
|
||||||
|
|
||||||
if (fc->signature != 0xFEEDFACE) {
|
|
||||||
dprintk(CVP_ERR, "%s deprecated synx_path\n", __func__);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ssid = inst->synx_session_id;
|
|
||||||
for (i = 0; i < fc->num_fences; ++i) {
|
|
||||||
h_synx = fc->synx[i];
|
|
||||||
if (h_synx) {
|
|
||||||
rc = synx_release(ssid, h_synx);
|
|
||||||
if (rc)
|
|
||||||
dprintk(CVP_ERR,
|
|
||||||
"%s: synx_release %d, %d failed\n",
|
|
||||||
__func__, h_synx, i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int cvp_cancel_synx_impl(struct msm_cvp_inst *inst,
|
|
||||||
enum cvp_synx_type type,
|
|
||||||
struct cvp_fence_command *fc,
|
|
||||||
int synx_state)
|
|
||||||
{
|
|
||||||
int rc = 0;
|
|
||||||
int i;
|
|
||||||
int h_synx;
|
|
||||||
struct synx_session ssid;
|
|
||||||
int start = 0, end = 0;
|
|
||||||
|
|
||||||
ssid = inst->synx_session_id;
|
|
||||||
|
|
||||||
if (type == CVP_INPUT_SYNX) {
|
|
||||||
start = 0;
|
|
||||||
end = fc->output_index;
|
|
||||||
} else if (type == CVP_OUTPUT_SYNX) {
|
|
||||||
start = fc->output_index;
|
|
||||||
end = fc->num_fences;
|
|
||||||
} else {
|
|
||||||
dprintk(CVP_ERR, "%s Incorrect synx type\n", __func__);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = start; i < end; ++i) {
|
|
||||||
h_synx = fc->synx[i];
|
|
||||||
if (h_synx) {
|
|
||||||
rc = synx_signal(ssid, h_synx, synx_state);
|
|
||||||
dprintk(CVP_SYNX, "Cancel synx %d session %llx\n",
|
|
||||||
h_synx, inst);
|
|
||||||
if (rc)
|
|
||||||
dprintk(CVP_ERR,
|
|
||||||
"%s: synx_signal %d %d %d failed\n",
|
|
||||||
__func__, h_synx, i, synx_state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return rc;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static int cvp_cancel_synx_v1(struct msm_cvp_inst *inst, enum cvp_synx_type type,
|
|
||||||
struct cvp_fence_command *fc, int synx_state)
|
|
||||||
{
|
|
||||||
if (fc->signature != 0xFEEDFACE) {
|
|
||||||
dprintk(CVP_ERR, "%s deprecated synx path\n", __func__);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return cvp_cancel_synx_impl(inst, type, fc, synx_state);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int cvp_wait_synx(struct synx_session ssid, u32 *synx, u32 num_synx,
|
|
||||||
u32 *synx_state)
|
|
||||||
{
|
|
||||||
int i = 0, rc = 0;
|
|
||||||
unsigned long timeout_ms = 2000;
|
|
||||||
int h_synx;
|
|
||||||
|
|
||||||
while (i < num_synx) {
|
|
||||||
h_synx = synx[i];
|
|
||||||
if (h_synx) {
|
|
||||||
rc = synx_wait(ssid, h_synx, timeout_ms);
|
|
||||||
if (rc) {
|
|
||||||
*synx_state = synx_get_status(ssid, h_synx);
|
|
||||||
if (*synx_state == SYNX_STATE_SIGNALED_CANCEL) {
|
|
||||||
dprintk(CVP_SYNX,
|
|
||||||
"%s: synx_wait %d cancel %d state %d\n",
|
|
||||||
current->comm, i, rc, *synx_state);
|
|
||||||
} else {
|
|
||||||
dprintk(CVP_ERR,
|
|
||||||
"%s: synx_wait %d failed %d state %d\n",
|
|
||||||
current->comm, i, rc, *synx_state);
|
|
||||||
*synx_state = SYNX_STATE_SIGNALED_ERROR;
|
|
||||||
}
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
dprintk(CVP_SYNX, "Wait synx %d returned succes\n",
|
|
||||||
h_synx);
|
|
||||||
}
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int cvp_signal_synx(struct synx_session ssid, u32 *synx, u32 num_synx,
|
|
||||||
u32 synx_state)
|
|
||||||
{
|
|
||||||
int i = 0, rc = 0;
|
|
||||||
int h_synx;
|
|
||||||
|
|
||||||
while (i < num_synx) {
|
|
||||||
h_synx = synx[i];
|
|
||||||
if (h_synx) {
|
|
||||||
rc = synx_signal(ssid, h_synx, synx_state);
|
|
||||||
if (rc) {
|
|
||||||
dprintk(CVP_ERR,
|
|
||||||
"%s: synx_signal %d %d failed\n",
|
|
||||||
current->comm, h_synx, i);
|
|
||||||
synx_state = SYNX_STATE_SIGNALED_ERROR;
|
|
||||||
}
|
|
||||||
dprintk(CVP_SYNX, "Signaled synx %d\n", h_synx);
|
|
||||||
}
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int cvp_synx_ops_v1(struct msm_cvp_inst *inst, enum cvp_synx_type type,
|
|
||||||
struct cvp_fence_command *fc, u32 *synx_state)
|
|
||||||
{
|
|
||||||
struct synx_session ssid;
|
|
||||||
|
|
||||||
ssid = inst->synx_session_id;
|
|
||||||
|
|
||||||
if (fc->signature != 0xFEEDFACE) {
|
|
||||||
dprintk(CVP_ERR, "%s deprecated synx, type %d\n", __func__);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type == CVP_INPUT_SYNX) {
|
|
||||||
return cvp_wait_synx(ssid, fc->synx, fc->output_index,
|
|
||||||
synx_state);
|
|
||||||
} else if (type == CVP_OUTPUT_SYNX) {
|
|
||||||
return cvp_signal_synx(ssid, &fc->synx[fc->output_index],
|
|
||||||
(fc->num_fences - fc->output_index),
|
|
||||||
*synx_state);
|
|
||||||
} else {
|
|
||||||
dprintk(CVP_ERR, "%s Incorrect SYNX type\n", __func__);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct msm_cvp_synx_ops cvp_synx = {
|
|
||||||
.cvp_sess_init_synx = cvp_sess_init_synx_v1,
|
|
||||||
.cvp_sess_deinit_synx = cvp_sess_deinit_synx_v1,
|
|
||||||
.cvp_release_synx = cvp_release_synx_v1,
|
|
||||||
.cvp_import_synx = cvp_import_synx_v1,
|
|
||||||
.cvp_synx_ops = cvp_synx_ops_v1,
|
|
||||||
.cvp_cancel_synx = cvp_cancel_synx_v1,
|
|
||||||
.cvp_dump_fence_queue = cvp_dump_fence_queue_v1,
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* End of CVP_CONFIG_SYNX_V2 */
|
|
||||||
#else
|
#else
|
||||||
static int cvp_sess_init_synx_stub(struct msm_cvp_inst *inst)
|
static int cvp_sess_init_synx_stub(struct msm_cvp_inst *inst)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user