From patchwork Mon Oct 30 08:48:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne CARRIERE - foss X-Patchwork-Id: 13440158 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 90A75C4167D for ; Mon, 30 Oct 2023 08:48:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gs+TBZLXuNLLWK4GXcxX2HDbOl8G91QFqCTqa8nxfrE=; b=rp+31QS28Zbw0G AcvMwST0XYILzQQCIhD5xnigBlED1KONW5NiBdiavk/kx4qyKk6RpWyOo9zhzoLBa0YvqDiY5ty5M 62pNCrJT++nX0yp4j+m+gJvcDwXgaVNC14tNUGjtwMbwg1rUcddROxcRUxEkTbyOYbm+5wbZFhJa2 9nc8rc+m8K6nJazjDsYpBhoaD2oTM8JHhTuYMohxRXZk8xUz/+xwDdr6dzfcS2bdcTuSbaW43glTy HF1SD8J84v7lLHGLiCzy7BnhhJ62TTvUl9B0wiCUwT3eNp36WRNN2YBY9QFfHxf+MfCqP00LCE1IG oyaO1eKKJjtRHKDFv+Jg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxNwo-002rI8-2G; Mon, 30 Oct 2023 08:48:34 +0000 Received: from mx07-00178001.pphosted.com ([185.132.182.106]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxNwb-002rEP-1F for linux-arm-kernel@lists.infradead.org; Mon, 30 Oct 2023 08:48:24 +0000 Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 39U7wRe8022531; Mon, 30 Oct 2023 09:48:18 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= selector1; bh=r/afhNXpV7Z+kfMPN2QKEnD/8zSsiiqd9EI3fLKtFyg=; b=NV rYFsIBPFKVCrbUy7lBCh/9bR7741Sm47akncNczVAz2A44EwPYhjecn5o2Ea1NF9 G0hafDTwNuvNDLhBxtHhKVZyv7nrikZvia3oDlfs4FPqUQuRPxvlEl8dZmgaXNxP mlE65FIvbYGXEW6TYUqVElzLcJv5XqZrKg9Sy8+md5RAgpajr4hpEVNuSyttyhq0 Mj2k3ntqcoAUEyZJm6afG9daTtkUSnh8vVvj/SrHC+nlEQqBAgzJE5RXJOjh7ObO 8nJw5dHzgNYtz+Z0zBTY0c+3QkgXRVj5bZJ+xXCXeQMZf+yjp9wl3oIwogwAeIvA 1O5q3ntJBUI2f8INhd/A== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3u0tuf6fyp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 30 Oct 2023 09:48:18 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id BBBEF10006C; Mon, 30 Oct 2023 09:48:17 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id ABF6121860E; Mon, 30 Oct 2023 09:48:17 +0100 (CET) Received: from localhost (10.201.20.20) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 30 Oct 2023 09:48:17 +0100 From: Etienne Carriere To: CC: Jens Wiklander , Sumit Garg , Jerome Forissier , , , Etienne Carriere , Sudeep Holla , Cristian Marussi Subject: [PATCH v12 4/4] firmware: arm_scmi: optee: use optee system invocation Date: Mon, 30 Oct 2023 09:48:12 +0100 Message-ID: <20231030084812.905549-5-etienne.carriere@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231030084812.905549-1-etienne.carriere@foss.st.com> References: <20231030084812.905549-1-etienne.carriere@foss.st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.20.20] X-ClientProxiedBy: SHFCAS1NODE2.st.com (10.75.129.73) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-30_06,2023-10-27_01,2023-05-22_02 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231030_014821_742863_B0A473F9 X-CRM114-Status: GOOD ( 13.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Changes SCMI optee transport to call tee_client_system_session() to request optee driver to provision an entry context in OP-TEE for processing OP-TEE messages. This prevents possible deadlock in case OP-TEE threads are all consumed while these may be waiting for a clock or regulator to be enable which SCMI OP-TEE service which requires a free thread context to execute. Cc: Sudeep Holla Cc: Cristian Marussi Acked-by: Sudeep Holla Reviewed-by: Sumit Garg Signed-off-by: Etienne Carriere --- No change since v11 No change since v10 Changes since v9: - Applied Sumit R-b tag: https://lore.kernel.org/lkml/CAFA6WYMyJrW25sdZRkQHDje72+tLDw4T+bjB6tmVf8XH0De1RQ@mail.gmail.com/ - Added Cc: tags and updated my e-mail address. No change since v8 No change since v7 No change since v6 Changes since v5: - Applied Sudeep's review tag Changes since v4: - Updated to new API function tee_client_system_session() introduced in patch v5 2/3. No change since v3 Changes since v2: - Fixed syntax issues (missing ';' chars), reported by kernel test robot. Changes since v1: - Updated to use new tee API functions tee_client_request_system_context() and tee_client_release_system_context(). --- drivers/firmware/arm_scmi/optee.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/firmware/arm_scmi/optee.c b/drivers/firmware/arm_scmi/optee.c index e123de6e8c67..25bfb465484d 100644 --- a/drivers/firmware/arm_scmi/optee.c +++ b/drivers/firmware/arm_scmi/optee.c @@ -440,6 +440,10 @@ static int scmi_optee_chan_setup(struct scmi_chan_info *cinfo, struct device *de if (ret) goto err_free_shm; + ret = tee_client_system_session(scmi_optee_private->tee_ctx, channel->tee_session); + if (ret) + dev_warn(dev, "Could not switch to system session, do best effort\n"); + ret = get_channel(channel); if (ret) goto err_close_sess;