Browse Source

msm: eva: Avoid printing unnecessary warnings

When handling HFI response of config packets.

Change-Id: I16e373d07c1cc7617624160921bcca972381277b
Signed-off-by: George Shen <[email protected]>
George Shen 3 years ago
parent
commit
022b7d2d1b
4 changed files with 16 additions and 4 deletions
  1. 1 1
      msm/eva/cvp.c
  2. 1 0
      msm/eva/cvp_hfi_api.h
  3. 7 1
      msm/eva/msm_cvp.c
  4. 7 2
      msm/eva/msm_cvp_platform.c

+ 1 - 1
msm/eva/cvp.c

@@ -437,7 +437,7 @@ static int msm_probe_cvp_device(struct platform_device *pdev)
 		goto err_fail_sub_device_probe;
 	}
 
-	atomic64_set(&core->kernel_trans_id, 0);
+	atomic64_set(&core->kernel_trans_id, get_pkt_array_size());
 
 	if (core->resources.dsp_enabled) {
 		rc = cvp_dsp_device_init();

+ 1 - 0
msm/eva/cvp_hfi_api.h

@@ -293,6 +293,7 @@ void cvp_hfi_deinitialize(enum msm_cvp_hfi_type hfi_type,
 			struct cvp_hfi_device *hdev);
 
 int get_pkt_index(struct cvp_hal_session_cmd_pkt *hdr);
+int get_pkt_array_size(void);
 int get_hfi_version(void);
 unsigned int get_msg_size(struct cvp_hfi_msg_session_hdr *hdr);
 unsigned int get_msg_session_id(void *msg);

+ 7 - 1
msm/eva/msm_cvp.c

@@ -118,7 +118,8 @@ static int cvp_wait_process_message(struct msm_cvp_inst *inst,
 
 	hdr = (struct cvp_hfi_msg_session_hdr *)&msg->pkt;
 	memcpy(out, &msg->pkt, get_msg_size(hdr));
-	msm_cvp_unmap_frame(inst, hdr->client_data.kdata);
+	if (hdr->client_data.kdata >= get_pkt_array_size())
+		msm_cvp_unmap_frame(inst, hdr->client_data.kdata);
 	kmem_cache_free(cvp_driver->msg_cache, msg);
 
 exit:
@@ -166,6 +167,7 @@ static int msm_cvp_session_process_hfi(
 	struct msm_cvp_inst *s;
 	bool is_config_pkt;
 	enum buf_map_type map_type;
+	struct cvp_hfi_cmd_session_hdr *cmd_hdr;
 
 	if (!inst || !inst->core || !in_pkt) {
 		dprintk(CVP_ERR, "%s: invalid params\n", __func__);
@@ -222,6 +224,10 @@ static int msm_cvp_session_process_hfi(
 	pkt_type = in_pkt->pkt_data[1];
 	map_type = cvp_find_map_type(pkt_type);
 
+	cmd_hdr = (struct cvp_hfi_cmd_session_hdr *)in_pkt;
+	/* The kdata will be overriden by transaction ID if the cmd has buf */
+	cmd_hdr->client_data.kdata = pkt_idx;
+
 	if (map_type == MAP_PERSIST)
 		rc = msm_cvp_map_user_persist(inst, in_pkt, offset, buf_num);
 	else if (map_type == UNMAP_PERSIST)

+ 7 - 2
msm/eva/msm_cvp_platform.c

@@ -379,11 +379,16 @@ const struct msm_cvp_hfi_defs cvp_hfi_defs[] = {
 
 };
 
+int get_pkt_array_size(void)
+{
+	return ARRAY_SIZE(cvp_hfi_defs);
+}
+
 int get_pkt_index(struct cvp_hal_session_cmd_pkt *hdr)
 {
-	int i, pkt_num = ARRAY_SIZE(cvp_hfi_defs);
+	int i;
 
-	for (i = 0; i < pkt_num; i++)
+	for (i = 0; i < get_pkt_array_size(); i++)
 		if (cvp_hfi_defs[i].type == hdr->packet_type)
 			return i;