Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3dc1e1ab authored by George Shen's avatar George Shen
Browse files

msm: cvp: Add debug logging of HFI message



Dump received HFI message header and received
IOCTL command control data if CVP_DBG flag
is enabled.

Change-Id: Ib158eb23f71f71e0e7f6a6ef3b052380f983c0e8
Signed-off-by: default avatarGeorge Shen <sqiao@codeaurora.org>
parent 4a6d5df1
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -3169,6 +3169,14 @@ static void **get_session_id(struct msm_cvp_cb_info *info)
	return session_id;
}

static void print_msg_hdr(struct hfi_msg_session_hdr *hdr)
{
	dprintk(CVP_DBG, "HFI MSG received: %x %x %x %x %x %x %x\n",
		hdr->size, hdr->packet_type, hdr->session_id,
		hdr->client_data.transaction_id, hdr->client_data.data1,
		hdr->client_data.data2, hdr->error_type);
}

static int __response_handler(struct venus_hfi_device *device)
{
	struct msm_cvp_cb_info *packets;
@@ -3213,8 +3221,11 @@ static int __response_handler(struct venus_hfi_device *device)
	while (!__iface_msgq_read(device, raw_packet)) {
		void **session_id = NULL;
		struct msm_cvp_cb_info *info = &packets[packet_count++];
		struct hfi_msg_session_hdr *hdr =
			(struct hfi_msg_session_hdr *)raw_packet;
		int rc = 0;

		print_msg_hdr(hdr);
		rc = cvp_hfi_process_msg_packet(device->device_id,
			(struct cvp_hal_msg_pkt_hdr *)raw_packet, info);
		if (rc) {
+20 −4
Original line number Diff line number Diff line
@@ -149,6 +149,24 @@ static void _set_deprecate_bitmask(struct cvp_kmd_arg *kp,
	}
}

static void print_hfi_short(struct cvp_kmd_arg __user *up)
{
	struct cvp_kmd_hfi_packet *pkt;
	unsigned int words[5];

	pkt = &up->data.hfi_pkt;
	if (get_user(words[0], &up->type) ||
			get_user(words[1], &up->buf_offset) ||
			get_user(words[2], &up->buf_num) ||
			get_user(words[3], &pkt->pkt_data[0]) ||
			get_user(words[4], &pkt->pkt_data[1]))
		dprintk(CVP_ERR, "Failed to print ioctl cmd\n");

	dprintk(CVP_DBG, "IOCTL cmd type %d, offset %d, num %d, pkt %d %d\n",
			words[0], words[1], words[2], words[3], words[4]);
}


static int convert_from_user(struct cvp_kmd_arg *kp,
		unsigned long arg,
		struct msm_cvp_inst *inst)
@@ -163,6 +181,8 @@ static int convert_from_user(struct cvp_kmd_arg *kp,
		return -EINVAL;
	}

	print_hfi_short(up);

	if (get_user(kp->type, &up->type))
		return -EFAULT;

@@ -267,8 +287,6 @@ static int convert_from_user(struct cvp_kmd_arg *kp,
			return -EFAULT;
		}

		dprintk(CVP_DBG, "system call cmd pkt: %d 0x%x\n",
				pkt_hdr.size, pkt_hdr.packet_type);
		rc = _copy_pkt_from_user(kp, up, (pkt_hdr.size >> 2));
		break;
	}
@@ -280,8 +298,6 @@ static int convert_from_user(struct cvp_kmd_arg *kp,
			return -EFAULT;
		}

		dprintk(CVP_DBG, "system call cmd pkt: %d 0x%x\n",
				pkt_hdr.size, pkt_hdr.packet_type);
		rc = _copy_fence_pkt_from_user(kp, up, (pkt_hdr.size >> 2));
		break;
	}