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

Commit 04c6aea0 authored by George Shen's avatar George Shen
Browse files

msm: cvp: Support CVP session flush



Added cvp session flush support for Lahaina.

Change-Id: Id1bd806abf5ab5b41ad876203016f54b58e73a82
Signed-off-by: default avatarGeorge Shen <sqiao@codeaurora.org>
parent c744f806
Loading
Loading
Loading
Loading
+34 −13
Original line number Diff line number Diff line
@@ -2447,6 +2447,28 @@ static int iris_hfi_session_send(void *sess,
	return rc;
}

static int iris_hfi_session_flush(void *sess)
{
	struct cvp_hal_session *session = sess;
	struct iris_hfi_device *device;
	int rc = 0;

	if (!session || !session->device) {
		dprintk(CVP_ERR, "Invalid Params %s\n", __func__);
		return -EINVAL;
	}

	device = session->device;

	mutex_lock(&device->lock);

	rc = __send_session_cmd(session, HFI_CMD_SESSION_CVP_FLUSH);

	mutex_unlock(&device->lock);

	return rc;
}

static int __check_core_registered(struct iris_hfi_device *device,
		phys_addr_t fw_addr, u8 *reg_addr, u32 reg_size,
		phys_addr_t irq)
@@ -2673,26 +2695,20 @@ static int __power_collapse(struct iris_hfi_device *device, bool force)
	return -EAGAIN;
}

static void print_sfr_message(struct iris_hfi_device *device)
static void __process_sys_error(struct iris_hfi_device *device)
{
	struct cvp_hfi_sfr_struct *vsfr = NULL;
	u32 vsfr_size = 0;
	void *p = NULL;

	vsfr = (struct cvp_hfi_sfr_struct *)device->sfr.align_virtual_addr;
	if (vsfr) {
		if (vsfr->bufSize != device->sfr.mem_size) {
			dprintk(CVP_ERR, "Invalid SFR buf size %d actual %d\n",
			vsfr->bufSize, device->sfr.mem_size);
			return;
		}
		vsfr_size = vsfr->bufSize - sizeof(u32);
		p = memchr(vsfr->rg_data, '\0', vsfr_size);
		void *p = memchr(vsfr->rg_data, '\0', vsfr->bufSize);
		/*
		 * SFR isn't guaranteed to be NULL terminated
		 * since SYS_ERROR indicates that Iris is in the
		 * process of crashing.
		 */
		if (p == NULL)
			vsfr->rg_data[vsfr_size - 1] = '\0';
			vsfr->rg_data[vsfr->bufSize - 1] = '\0';

		dprintk(CVP_ERR, "SFR Message from FW: %s\n",
				vsfr->rg_data);
@@ -2816,7 +2832,7 @@ static void process_system_msg(struct msm_cvp_cb_info *info,

	switch (info->response_type) {
	case HAL_SYS_ERROR:
		print_sfr_message(device);
		__process_sys_error(device);
		break;
	case HAL_SYS_RELEASE_RESOURCE_DONE:
		dprintk(CVP_DBG, "Received SYS_RELEASE_RESOURCE\n");
@@ -2925,6 +2941,8 @@ static int __response_handler(struct iris_hfi_device *device)
	}

	if (device->intr_status & CVP_FATAL_INTR_BMSK) {
		struct cvp_hfi_sfr_struct *vsfr = (struct cvp_hfi_sfr_struct *)
			device->sfr.align_virtual_addr;
		struct msm_cvp_cb_info info = {
			.response_type = HAL_SYS_WATCHDOG_TIMEOUT,
			.response.cmd = {
@@ -2932,7 +2950,9 @@ static int __response_handler(struct iris_hfi_device *device)
			}
		};

		print_sfr_message(device);
		if (vsfr)
			dprintk(CVP_ERR, "SFR Message from FW: %s\n",
					vsfr->rg_data);
		if (device->intr_status & CVP_WRAPPER_INTR_MASK_CPU_NOC_BMSK)
			dprintk(CVP_ERR, "Received Xtensa NOC error\n");

@@ -4585,6 +4605,7 @@ static void iris_init_hfi_callbacks(struct cvp_hfi_device *hdev)
	hdev->session_set_buffers = iris_hfi_session_set_buffers;
	hdev->session_release_buffers = iris_hfi_session_release_buffers;
	hdev->session_send = iris_hfi_session_send;
	hdev->session_flush = iris_hfi_session_flush;
	hdev->scale_clocks = iris_hfi_scale_clocks;
	hdev->vote_bus = iris_hfi_vote_buses;
	hdev->get_fw_info = iris_hfi_get_fw_info;
+8 −4
Original line number Diff line number Diff line
@@ -98,6 +98,8 @@
	(HFI_CMD_SESSION_CVP_START + 0x054)
#define HFI_CMD_SESSION_CVP_RELEASE_PERSIST_BUFFERS\
	(HFI_CMD_SESSION_CVP_START + 0x055)
#define HFI_CMD_SESSION_CVP_FLUSH\
	(HFI_CMD_SESSION_CVP_START + 0x057)
#define  HFI_CMD_SESSION_CVP_ICA_FRAME\
	(HFI_CMD_SESSION_CVP_START + 0x100)
#define  HFI_CMD_SESSION_CVP_ICA_CONFIG\
@@ -144,6 +146,8 @@
	(HFI_MSG_SESSION_CVP_START + 0x037)
#define HFI_MSG_SESSION_CVP_RELEASE_PERSIST_BUFFERS\
	(HFI_MSG_SESSION_CVP_START + 0x038)
#define HFI_MSG_SESSION_CVP_FLUSH\
	(HFI_CMD_SESSION_CVP_START + 0x03A)

#define CVP_IFACEQ_MAX_PKT_SIZE       1024
#define CVP_IFACEQ_MED_PKT_SIZE       768
+2 −2
Original line number Diff line number Diff line
@@ -340,8 +340,8 @@ struct cvp_hfi_device {
	int (*session_abort)(void *session);
	int (*session_set_buffers)(void *sess, u32 iova, u32 size);
	int (*session_release_buffers)(void *sess);
	int (*session_send)(void *sess,
		struct cvp_kmd_hfi_packet *in_pkt);
	int (*session_send)(void *sess, struct cvp_kmd_hfi_packet *in_pkt);
	int (*session_flush)(void *sess);
	int (*scale_clocks)(void *dev, u32 freq);
	int (*vote_bus)(void *dev, struct cvp_bus_vote_data *data,
			int num_data);
+9 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@
#define HFI_ERR_SESSION_BUFFERCOUNT_TOOSMALL	(HFI_COMMON_BASE + 0x1011)
#define HFI_ERR_SESSION_INVALID_SCALE_FACTOR	(HFI_COMMON_BASE + 0x1012)
#define HFI_ERR_SESSION_UPSCALE_NOT_SUPPORTED	(HFI_COMMON_BASE + 0x1013)
#define HFI_ERR_SESSION_FLUSHED			(HFI_COMMON_BASE + 0x101C)

#define HFI_EVENT_SYS_ERROR				(HFI_COMMON_BASE + 0x1)
#define HFI_EVENT_SESSION_ERROR			(HFI_COMMON_BASE + 0x2)
@@ -455,4 +456,12 @@ struct cvp_buf_type {
	};
};

struct cvp_hfi_msg_sys_session_flush_done_packet {
	u32 size;
	u32 packet_type;
	u32 session_id;
	u32 error_type;
	struct cvp_hfi_client client_data;
};

#endif
+28 −0
Original line number Diff line number Diff line
@@ -327,6 +327,31 @@ static int hfi_process_session_set_buf_done(u32 device_id,
	return 0;
}

static int hfi_process_session_flush_done(u32 device_id,
	struct cvp_hfi_msg_sys_session_flush_done_packet *pkt,
	struct msm_cvp_cb_info *info)
{
	struct msm_cvp_cb_cmd_done cmd_done = {0};

	dprintk(CVP_DBG, "RECEIVED: SESSION_FLUSH_DONE[%#x]\n",
			pkt->session_id);

	if (!pkt || pkt->size <
		sizeof(struct cvp_hfi_msg_sys_session_flush_done_packet)) {
		dprintk(CVP_ERR, "%s: bad packet/packet size: %d\n",
				__func__, pkt ? pkt->size : 0);
		return -E2BIG;
	}
	cmd_done.device_id = device_id;
	cmd_done.session_id = (void *)(uintptr_t)pkt->session_id;
	cmd_done.status = hfi_map_err_status(pkt->error_type);
	cmd_done.size = 0;

	info->response_type = HAL_SESSION_FLUSH_DONE;
	info->response.cmd = cmd_done;

	return 0;
}

static int hfi_process_session_rel_buf_done(u32 device_id,
		struct cvp_hfi_msg_session_hdr *pkt,
@@ -610,6 +635,9 @@ int cvp_hfi_process_msg_packet(u32 device_id,
	case HFI_MSG_SYS_SESSION_ABORT_DONE:
		pkt_func = (pkt_func_def)hfi_process_session_abort_done;
		break;
	case HFI_MSG_SESSION_CVP_FLUSH:
		pkt_func = (pkt_func_def)hfi_process_session_flush_done;
		break;
	case HFI_MSG_SESSION_CVP_OPERATION_CONFIG:
	case HFI_MSG_SESSION_CVP_SET_PERSIST_BUFFERS:
	case HFI_MSG_SESSION_CVP_RELEASE_PERSIST_BUFFERS:
Loading