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

Commit ea80f742 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: cvp: Fence path for Lahaina"

parents 241d31cd 385d8d83
Loading
Loading
Loading
Loading
+30 −40
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@
#define FIRMWARE_SIZE			0X00A00000
#define REG_ADDR_OFFSET_BITMASK	0x000FFFFF
#define QDSS_IOVA_START 0x80001000
#define MIN_PAYLOAD_SIZE 3

const struct msm_cvp_hfi_defs cvp_hfi_defs[] = {
	{
@@ -346,32 +347,6 @@ int get_pkt_index(struct cvp_hal_session_cmd_pkt *hdr)
	return -EINVAL;
}

int set_feature_bitmask(int pkt_idx, unsigned long *bitmask)
{
	if (!bitmask) {
		dprintk(CVP_ERR, "%s: invalid bitmask\n", __func__);
		return -EINVAL;
	}

	if (cvp_hfi_defs[pkt_idx].type == HFI_CMD_SESSION_CVP_DME_FRAME) {
		set_bit(DME_BIT_OFFSET, bitmask);
		return 0;
	}

	if (cvp_hfi_defs[pkt_idx].type == HFI_CMD_SESSION_CVP_ICA_FRAME) {
		set_bit(ICA_BIT_OFFSET, bitmask);
		return 0;
	}

	if (cvp_hfi_defs[pkt_idx].type == HFI_CMD_SESSION_CVP_FD_FRAME) {
		set_bit(FD_BIT_OFFSET, bitmask);
		return 0;
	}

	dprintk(CVP_ERR, "%s: invalid pkt_idx %d\n", __func__, pkt_idx);
	return -EINVAL;
}

int get_hfi_version(void)
{
	struct msm_cvp_core *core;
@@ -1201,20 +1176,13 @@ static int __tzbsp_set_cvp_state(enum tzbsp_subsys_state state)
	int rc = 0;

	rc = qcom_scm_set_remote_state(state, TZBSP_CVP_PAS_ID);
	dprintk(CVP_DBG, "Set state %d, resp %d\n", state, rc);

	if (rc < 0) {
	if (rc) {
		dprintk(CVP_ERR, "Failed qcom_scm_set_remote_state %d\n", rc);
		return rc;
	}

	dprintk(CVP_DBG, "Set state %d, resp %d\n", state, rc);
	if (rc) {
		dprintk(CVP_ERR,
			"Failed to set cvp core state to suspend: %d\n",
			rc);
		return -EINVAL;
	}

	return 0;
}

@@ -2896,15 +2864,35 @@ static void __flush_debug_queue(struct iris_hfi_device *device, u8 *packet)
		log_level = CVP_ERR;
	}

#define SKIP_INVALID_PKT(pkt_size, payload_size, pkt_hdr_size) ({ \
		if (pkt_size < pkt_hdr_size || \
			payload_size < MIN_PAYLOAD_SIZE || \
			payload_size > \
			(pkt_size - pkt_hdr_size + sizeof(u8))) { \
			dprintk(CVP_ERR, \
				"%s: invalid msg size - %d\n", \
				__func__, pkt->msg_size); \
			continue; \
		} \
	})

	while (!__iface_dbgq_read(device, packet)) {
		struct cvp_hfi_msg_sys_coverage_packet *pkt =
			(struct cvp_hfi_msg_sys_coverage_packet *) packet;
		struct cvp_hfi_packet_header *pkt =
			(struct cvp_hfi_packet_header *) packet;

		if (pkt->packet_type == HFI_MSG_SYS_COV) {
			dprintk(CVP_ERR, "STM_LOG not supported\n");
		} else {
		if (pkt->size < sizeof(struct cvp_hfi_packet_header)) {
			dprintk(CVP_ERR, "Invalid pkt size - %s\n",
				__func__);
			continue;
		}

		if (pkt->packet_type == HFI_MSG_SYS_DEBUG) {
			struct cvp_hfi_msg_sys_debug_packet *pkt =
				(struct cvp_hfi_msg_sys_debug_packet *) packet;

			SKIP_INVALID_PKT(pkt->size,
				pkt->msg_size, sizeof(*pkt));

			/*
			 * All fw messages starts with new line character. This
			 * causes dprintk to print this message in two lines
@@ -2912,9 +2900,11 @@ static void __flush_debug_queue(struct iris_hfi_device *device, u8 *packet)
			 * from the message fixes this to print it in a single
			 * line.
			 */
			pkt->rg_msg_data[pkt->msg_size-1] = '\0';
			dprintk(log_level, "%s", &pkt->rg_msg_data[1]);
		}
	}
#undef SKIP_INVALID_PKT

	if (local_packet)
		kfree(packet);
+0 −7
Original line number Diff line number Diff line
@@ -98,12 +98,6 @@
#define HFI_MODEL_BUFFERS_OFFSET 7
#define HFI_MODEL_BUF_NUM 1

#define DFS_BIT_OFFSET (CVP_KMD_HFI_DFS_FRAME_CMD - CVP_KMD_CMD_START)
#define DME_BIT_OFFSET (CVP_KMD_HFI_DME_FRAME_CMD - CVP_KMD_CMD_START)
#define PERSIST_BIT_OFFSET (CVP_KMD_HFI_PERSIST_CMD - CVP_KMD_CMD_START)
#define ICA_BIT_OFFSET (CVP_KMD_HFI_ICA_FRAME_CMD - CVP_KMD_CMD_START)
#define FD_BIT_OFFSET (CVP_KMD_HFI_FD_FRAME_CMD - CVP_KMD_CMD_START)

#define HFI_VERSION_MAJOR_MASK 0xFF000000
#define HFI_VERSION_MAJOR_SHFIT 24
#define HFI_VERSION_MINOR_MASK 0x00FFFFE0
@@ -428,7 +422,6 @@ void cvp_hfi_deinitialize(enum msm_cvp_hfi_type hfi_type,

int get_pkt_index(struct cvp_hal_session_cmd_pkt *hdr);
int get_signal_from_pkt_type(unsigned int type);
int set_feature_bitmask(int pkt_index, unsigned long *bitmask);
int get_hfi_version(void);
unsigned int get_msg_size(void);
unsigned int get_msg_session_id(void *msg);
+14 −13
Original line number Diff line number Diff line
@@ -285,11 +285,16 @@ struct cvp_hfi_client {
	u32 transaction_id;
	u32 data1;
	u32 data2;
	union {
		u64 kdata;
		struct {
			u32 kdata1;
			u32 kdata2;
		};
	};
	u32 reserved1;
	u32 reserved2;
};
} __packed;

struct cvp_hfi_client_d {
	u32 transaction_id;
@@ -317,7 +322,7 @@ struct cvp_hfi_cmd_session_set_buffers_packet {
	u32 session_id;
	struct cvp_hfi_client client_data;
	struct cvp_hfi_buf_type buf_type;
};
} __packed;

struct cvp_hfi_cmd_session_set_buffers_packet_d {
	u32 size;
@@ -337,7 +342,7 @@ struct cvp_session_release_buffers_packet {
	u32 buffer_type;
	u32 num_buffers;
	u32 buffer_idx;
};
} __packed;

struct cvp_session_release_buffers_packet_d {
	u32 size;
@@ -355,7 +360,7 @@ struct cvp_hfi_cmd_session_hdr {
	u32 session_id;
	struct cvp_hfi_client client_data;
	u32 stream_idx;
};
} __packed;

struct cvp_hfi_msg_session_hdr {
	u32 size;
@@ -364,7 +369,7 @@ struct cvp_hfi_msg_session_hdr {
	u32 error_type;
	struct cvp_hfi_client client_data;
	u32 stream_idx;
};
} __packed;

struct cvp_hfi_msg_session_hdr_d {
	u32 size;
@@ -415,7 +420,7 @@ struct cvp_hfi_msg_session_op_cfg_packet {
	struct cvp_hfi_client client_data;
	u32 stream_idx;
	u32 op_conf_id;
};
} __packed;

struct cvp_hfi_msg_release_buffer_ref_event_packet {
	u32 packet_buffer;
@@ -479,13 +484,9 @@ struct cvp_hfi_msg_sys_debug_packet {
	u8 rg_msg_data[1];
};

struct cvp_hfi_msg_sys_coverage_packet {
struct cvp_hfi_packet_header {
	u32 size;
	u32 packet_type;
	u32 msg_size;
	u32 time_stamp_hi;
	u32 time_stamp_lo;
	u8 rg_msg_data[1];
};

struct cvp_hfi_sfr_struct {
+12 −142
Original line number Diff line number Diff line
@@ -17,11 +17,6 @@

extern struct msm_cvp_drv *cvp_driver;

static int _deprecated_hfi_msg_process(u32 device_id,
	struct cvp_hfi_msg_session_hdr *pkt,
	struct msm_cvp_cb_info *info,
	struct msm_cvp_inst *inst);

static enum cvp_status hfi_map_err_status(u32 hfi_err)
{
	enum cvp_status cvp_err;
@@ -450,6 +445,7 @@ static int hfi_process_session_cvp_msg(u32 device_id,
	struct msm_cvp_inst *inst = NULL;
	struct msm_cvp_core *core;
	void *session_id;
	struct cvp_session_queue *sq;

	if (!pkt) {
		dprintk(CVP_ERR, "%s: invalid param\n", __func__);
@@ -467,24 +463,10 @@ static int hfi_process_session_cvp_msg(u32 device_id,
		return -EINVAL;
	}

	if (inst->deprecate_bitmask) {
		if (pkt->packet_type == HFI_MSG_SESSION_CVP_DME
			|| pkt->packet_type == HFI_MSG_SESSION_CVP_ICA
			|| pkt->packet_type == HFI_MSG_SESSION_CVP_FD) {
			u64 ktid;
			u32 kdata1, kdata2;

			kdata1 = pkt->client_data.kdata1;
			kdata2 = pkt->client_data.kdata2;
			ktid = ((u64)kdata2 << 32) | kdata1;
			msm_cvp_unmap_buf_cpu(inst, ktid);

			return _deprecated_hfi_msg_process(device_id,
				pkt, info, inst);
		}
		dprintk(CVP_ERR, "Invalid deprecate_bitmask %#x\n",
					inst->deprecate_bitmask);
	}
	if (pkt->client_data.kdata & FENCE_BIT)
		sq = &inst->session_queue_fence;
	else
		sq = &inst->session_queue;

	sess_msg = kmem_cache_alloc(cvp_driver->msg_cache, GFP_KERNEL);
	if (sess_msg == NULL) {
@@ -499,139 +481,27 @@ static int hfi_process_session_cvp_msg(u32 device_id,
		__func__, pkt->packet_type,
		hfi_map_err_status(get_msg_errorcode(pkt)), session_id);

	spin_lock(&inst->session_queue.lock);
	if (inst->session_queue.msg_count >= MAX_NUM_MSGS_PER_SESSION) {
	spin_lock(&sq->lock);
	if (sq->msg_count >= MAX_NUM_MSGS_PER_SESSION) {
		dprintk(CVP_ERR, "Reached session queue size limit\n");
		goto error_handle_msg;
	}
	list_add_tail(&sess_msg->node, &inst->session_queue.msgs);
	inst->session_queue.msg_count++;
	spin_unlock(&inst->session_queue.lock);
	list_add_tail(&sess_msg->node, &sq->msgs);
	sq->msg_count++;
	spin_unlock(&sq->lock);

	wake_up_all(&inst->session_queue.wq);
	wake_up_all(&sq->wq);

	info->response_type = HAL_NO_RESP;

	return 0;

error_handle_msg:
	spin_unlock(&inst->session_queue.lock);
	spin_unlock(&sq->lock);
	kmem_cache_free(cvp_driver->msg_cache, sess_msg);
	return -ENOMEM;
}

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

	if (!pkt) {
		dprintk(CVP_ERR, "%s: invalid param\n", __func__);
		return -EINVAL;
	} else if (pkt->size < get_msg_size()) {
		dprintk(CVP_ERR, "%s: bad_pkt_size %d\n", __func__, pkt->size);
		return -E2BIG;
	}

	cmd_done.device_id = device_id;
	cmd_done.session_id = (void *)(uintptr_t)get_msg_session_id(pkt);
	cmd_done.status = hfi_map_err_status(get_msg_errorcode(pkt));
	cmd_done.size = 0;

	dprintk(CVP_DBG,
		"%s: device_id=%d cmd_done.status=%d sessionid=%#x\n",
		__func__, device_id, cmd_done.status, cmd_done.session_id);
	info->response_type = HAL_SESSION_DME_FRAME_CMD_DONE;
	info->response.cmd = cmd_done;

	return 0;
}

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

	if (!pkt) {
		dprintk(CVP_ERR, "%s: invalid param\n", __func__);
		return -EINVAL;
	} else if (pkt->size < get_msg_size()) {
		dprintk(CVP_ERR, "%s: bad_pkt_size %d\n", __func__, pkt->size);
		return -E2BIG;
	}

	cmd_done.device_id = device_id;
	cmd_done.session_id = (void *)(uintptr_t)get_msg_session_id(pkt);
	cmd_done.status = hfi_map_err_status(get_msg_errorcode(pkt));
	cmd_done.size = 0;

	dprintk(CVP_DBG,
		"%s: device_id=%d cmd_done.status=%d sessionid=%#x\n",
		__func__, device_id, cmd_done.status, cmd_done.session_id);
	info->response_type = HAL_SESSION_ICA_FRAME_CMD_DONE;
	info->response.cmd = cmd_done;

	return 0;
}

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

	if (!pkt) {
		dprintk(CVP_ERR, "%s: invalid param\n", __func__);
		return -EINVAL;
	} else if (pkt->size < get_msg_size()) {
		dprintk(CVP_ERR, "%s: bad_pkt_size %d\n", __func__, pkt->size);
		return -E2BIG;
	}

	cmd_done.device_id = device_id;
	cmd_done.session_id = (void *)(uintptr_t)get_msg_session_id(pkt);
	cmd_done.status = hfi_map_err_status(get_msg_errorcode(pkt));
	cmd_done.size = 0;

	dprintk(CVP_DBG,
		"%s: device_id=%d cmd_done.status=%d sessionid=%#x\n",
		__func__, device_id, cmd_done.status, cmd_done.session_id);
	info->response_type = HAL_SESSION_FD_FRAME_CMD_DONE;
	info->response.cmd = cmd_done;

	return 0;
}

static int _deprecated_hfi_msg_process(u32 device_id,
	struct cvp_hfi_msg_session_hdr *pkt,
	struct msm_cvp_cb_info *info,
	struct msm_cvp_inst *inst)
{
	if (pkt->packet_type == HFI_MSG_SESSION_CVP_DME)
		if (test_bit(DME_BIT_OFFSET,
				&inst->deprecate_bitmask))
			return hfi_process_session_cvp_dme(
					device_id, (void *)pkt, info);

	if (pkt->packet_type == HFI_MSG_SESSION_CVP_ICA)
		if (test_bit(ICA_BIT_OFFSET,
				&inst->deprecate_bitmask))
			return hfi_process_session_cvp_ica(
				device_id, (void *)pkt, info);

	if (pkt->packet_type == HFI_MSG_SESSION_CVP_FD)
		if (test_bit(FD_BIT_OFFSET,
				&inst->deprecate_bitmask))
			return hfi_process_session_cvp_fd(
				device_id, (void *)pkt, info);

	dprintk(CVP_ERR, "Deprecatd MSG doesn't match bitmask %x %lx\n",
			pkt->packet_type, inst->deprecate_bitmask);
	return -EINVAL;
}

static void hfi_process_sys_get_prop_image_version(
		struct cvp_hfi_msg_sys_property_info_packet *pkt)
{
+431 −495

File changed.

Preview size limit exceeded, changes collapsed.

Loading