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

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

Merge "smcinvoke: Update the correct parameters and result from qseecom"

parents 15748c1c e8b05987
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
/*
 * QTI Secure Execution Environment Communicator (QSEECOM) driver
 *
 * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
 */

#define pr_fmt(fmt) "QSEECOM: %s: " fmt, __func__
@@ -2624,6 +2624,11 @@ static int __qseecom_reentrancy_process_incomplete_cmd(
			pr_warn("get cback req app_id = %d, resp->data = %d\n",
				data->client.app_id, resp->data);
			resp->resp_type = SMCINVOKE_RESULT_INBOUND_REQ_NEEDED;
			/* We are here because scm call sent to TZ has requested
			 * for another callback request. This call has been a
			 * success and hence setting result = 0
			 */
			resp->result = 0;
			break;
		default:
			pr_err("fail:resp res= %d,app_id = %d,lstr = %d\n",
@@ -5335,6 +5340,13 @@ int qseecom_process_listener_from_smcinvoke(struct scm_desc *desc)
		return -EINVAL;
	}

	/*
	 * smcinvoke expects result in scm call resp.ret[1] and type in ret[0],
	 * while qseecom expects result in ret[0] and type in ret[1].
	 * To simplify API interface and code changes in smcinvoke, here
	 * internally switch result and resp_type to let qseecom work with
	 * smcinvoke and upstream scm driver protocol.
	 */
	resp.result = desc->ret[0];	/*req_cmd*/
	resp.resp_type = desc->ret[1]; /*incomplete:unused;blocked:session_id*/
	resp.data = desc->ret[2];	/*listener_id*/
@@ -5355,8 +5367,8 @@ int qseecom_process_listener_from_smcinvoke(struct scm_desc *desc)
		pr_err("Failed on cmd %d for lsnr %d session %d, ret = %d\n",
			(int)desc->ret[0], (int)desc->ret[2],
			(int)desc->ret[1], ret);
	desc->ret[0] = resp.result;
	desc->ret[1] = resp.resp_type;
	desc->ret[0] = resp.resp_type;
	desc->ret[1] = resp.result;
	desc->ret[2] = resp.data;
	return ret;
}
+3 −2
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
 */

#define pr_fmt(fmt) "smcinvoke: %s: " fmt, __func__
@@ -1152,7 +1152,8 @@ static int prepare_send_scm_msg(const uint8_t *in_buf, phys_addr_t in_paddr,
		    desc.ret[0] == QSEOS_RESULT_BLOCKED_ON_LISTENER) {
			ret = qseecom_process_listener_from_smcinvoke(&desc);
			req->result = (int32_t)desc.ret[1];
			if (!req->result) {
			if (!req->result &&
			  desc.ret[0] != SMCINVOKE_RESULT_INBOUND_REQ_NEEDED) {
				dmac_inv_range(in_buf, in_buf + in_buf_len);
				ret = marshal_out_invoke_req(in_buf,
						in_buf_len, req, args_buf);