From patchwork Tue Oct 3 14:06:37 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: 13407690 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 665EBE7AD56 for ; Tue, 3 Oct 2023 14:07:31 +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=DmJRHaB6kRi6Ru24YTGmNMeBpI6T/RoPNs8EGQE1PFU=; b=y4dDg3N4MR/eDN n4kX/APa2NCtd+c9QzY7IuY0vcUT12NKPzuEH7nQHQbxWF6RRTHbhcR4iQThQdBEgsJrD3iRT8vaT zay4yZdZlRzJB53c3zynmuZpsV77RFYtHZ8Ag+uHswHnhCeKBiVfBDT1R3zOoolV5m4Fob0A5NW+g KFSrZqB4cy+4nOeDwWSkTW/KvLfMXyX7sd3aBnlxbfR5G+hNz43Q/YPOZlXUO1yTzdl2MHqjnsgWV qKKz09CJZ7Th/l909vAExtWDaCleiqbEi9vn11s90Ipvnnhe5jgCFJr032mls8Ics9lVL48RPv9jb bBsc80Wz4lJl0G6/6cVw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qng3D-00ElJc-3D; Tue, 03 Oct 2023 14:07:04 +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 1qng39-00ElGu-0h for linux-arm-kernel@lists.infradead.org; Tue, 03 Oct 2023 14:07:02 +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 393A7Dgf022752; Tue, 3 Oct 2023 16:06:51 +0200 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=U4vOdxSVlfELSeNY+vE9G1cuY4dw0I2hF391/hYQ6S0=; b=Zm xKyRlusO9cW0t9nMM5vjA/OLmoubXMVe281sYtDf6Wya/zUime6fD6zJ9bOGP2fE NRsqcJEyqXVm0ydD90RBQbJZvHWJu4fyKEfhQBIrAuybNiLP4H6FUVWPzXYCpZsf 7V5dpWK/NYl4pr79x+QhMiC4S/SG+PZdt99bkTmMrjWFvMJuRNDQI6/CTfVAv20q 7D/ToxEvzmg4g8Sy7FHFvCUdhL7ppE1EBs2y1Ntcp+WFGIyD4FnceL5DReRjeqlC kt857D9Q8H0lU7nEtFZ0nNHAeChDrS9nHXLjX9pCCtkTdugtCIQ/yUVhUzMZ79q/ 4yYrSPfqHfMfJHoT9/oQ== 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 3tggx31460-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 03 Oct 2023 16:06:51 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 0AD44100057; Tue, 3 Oct 2023 16:06:49 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id D731F2634FA; Tue, 3 Oct 2023 16:06:49 +0200 (CEST) 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; Tue, 3 Oct 2023 16:06:49 +0200 From: Etienne Carriere To: CC: Jens Wiklander , Sumit Garg , , , Jerome Forissier , Etienne Carriere , Sudeep Holla , Cristian Marussi Subject: [PATCH v10 4/4] firmware: arm_scmi: optee: use optee system invocation Date: Tue, 3 Oct 2023 16:06:37 +0200 Message-ID: <20231003140637.31346-5-etienne.carriere@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231003140637.31346-1-etienne.carriere@foss.st.com> References: <20231003140637.31346-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.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-03_11,2023-10-02_01,2023-05-22_02 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231003_070659_776008_24F9BF78 X-CRM114-Status: GOOD ( 13.67 ) 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 --- 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;