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

Commit 7e2a87eb authored by Zhenlin Lian's avatar Zhenlin Lian
Browse files

Revert "qseecom: Add shmbrdige to allocate memory"



This reverts commit b6b130b0.

Change-Id: I1ab38440b496657974a20ed7d98fb3e1a99842a1
Signed-off-by: default avatarZhenlin Lian <lianzhenlin@codeaurora.org>
parent 71add667
Loading
Loading
Loading
Loading
+7 −16
Original line number Diff line number Diff line
@@ -4319,10 +4319,8 @@ static int __qseecom_send_modfd_cmd(struct qseecom_dev_handle *data,
	struct qseecom_send_modfd_cmd_req req;
	struct qseecom_send_cmd_req send_cmd_req;
	void *origin_req_buf_kvirt, *origin_rsp_buf_kvirt;
	u32 tzbuflen;
	phys_addr_t pa;
	u8 *va = NULL;
	struct qtee_shm shm = {0};

	ret = copy_from_user(&req, argp, sizeof(req));
	if (ret) {
@@ -4354,11 +4352,11 @@ static int __qseecom_send_modfd_cmd(struct qseecom_dev_handle *data,
				(uintptr_t)req.resp_buf);

	/* Allocate kernel buffer for request and response*/
	tzbuflen = PAGE_ALIGN(req.cmd_req_len + req.resp_len);
	va = __qseecom_alloc_tzbuf(tzbuflen, &pa, &shm);
	if (!va) {
		pr_err("error allocating in buffer\n");
		return -ENOMEM;
	ret = __qseecom_alloc_coherent_buf(req.cmd_req_len + req.resp_len,
					&va, &pa);
	if (ret) {
		pr_err("Failed to allocate coherent buf, ret %d\n", ret);
		return ret;
	}

	req.cmd_req_buf = va;
@@ -4375,11 +4373,7 @@ static int __qseecom_send_modfd_cmd(struct qseecom_dev_handle *data,
		ret = __qseecom_update_cmd_buf(&req, false, data);
		if (ret)
			goto out;

		dmac_flush_range(req.cmd_req_buf, req.cmd_req_buf + tzbuflen);
		ret = __qseecom_send_cmd(data, &send_cmd_req, true);
		dmac_flush_range(req.cmd_req_buf, req.cmd_req_buf + tzbuflen);

		if (ret)
			goto out;
		ret = __qseecom_update_cmd_buf(&req, true, data);
@@ -4389,11 +4383,7 @@ static int __qseecom_send_modfd_cmd(struct qseecom_dev_handle *data,
		ret = __qseecom_update_cmd_buf_64(&req, false, data);
		if (ret)
			goto out;

		dmac_flush_range(req.cmd_req_buf, req.cmd_req_buf + tzbuflen);
		ret = __qseecom_send_cmd(data, &send_cmd_req, true);
		dmac_flush_range(req.cmd_req_buf, req.cmd_req_buf + tzbuflen);

		if (ret)
			goto out;
		ret = __qseecom_update_cmd_buf_64(&req, true, data);
@@ -4407,7 +4397,8 @@ static int __qseecom_send_modfd_cmd(struct qseecom_dev_handle *data,

out:
	if (req.cmd_req_buf)
		__qseecom_free_tzbuf(&shm);
		__qseecom_free_coherent_buf(req.cmd_req_len + req.resp_len,
			req.cmd_req_buf, (phys_addr_t)send_cmd_req.cmd_req_buf);

	return ret;
}