From patchwork Tue Oct 3 14:06:33 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: 13407691 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 12BC5E7AD57 for ; Tue, 3 Oct 2023 14:07:32 +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: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:In-Reply-To:References: List-Owner; bh=0zR7Trm6zXrdX8f3dUeyLkIzkT+tZen+0Izv3QpqmU0=; b=DrRKZZC5CxJBp4 BMQ0xriAq/PQ3PFAR0A1MqZ9K+tj+7RXuZe2UMTpYfF5Z2o7utQqjkB5sAZW2CIc/1Dbw6rMEzBgd 0jsdk+Pg6W0uX2EU0FtgMuratMdOh9ZBI47NMtoWRp1WxI+crL/8pZqjvsymxWbsWX3KRra/S5s6n zXHxezuoCKM31zUa3KKTxSHeV+cVRJpe4WhaU4sLQM/bUEQj3SOmr5X6v4jD1mXUlV4EU9dW1GMxb WKSEvnIyLSv7jEPC7XDtWIOriZaiVWdqZzxUqt4CpvNRzE7rLy1xxKDXrRcUvku/IbVXaHdsDh9Ga cMdiN8Ip6B7E9VpQhA6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qng3G-00ElKn-0a; Tue, 03 Oct 2023 14:07:06 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qng39-00ElGp-34 for linux-arm-kernel@lists.infradead.org; Tue, 03 Oct 2023 14:07:04 +0000 Received: from pps.filterd (m0369457.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 3939vt3H021867; Tue, 3 Oct 2023 16:06:49 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=selector1; bh=emMaldt 7Wcp009BwjeoAIdRywLgtoN6eLJ90SwnYl2Q=; b=QuDIBnQt6n6Vs9mSOlA5Vao SFsmrjRXjLz+HkyEmmqziw5o4UaxQ/46fH+WZE7BHaY3UYuQ4732Q9RSC207q+Yj YyfbB0S6XHcV/WwRsG50n05rd2aqKJkKVu6x0I713aQLgzu3H5ZeQinumfwJ3ki2 EQYiHhnO+OJMPqGPqKTf030mjdkUMGrQhRfrxvX36WW9IltdYoqCy9JVGV6yz5jR bQrOtWkjO06PY4WYv/YDdw7eyIr0lwV24QAeUybzoY4x5sLnCYp5ex0KYTwuYspn hYA7Qyv9GOUk1D4PHNuVhR2HlueHbWroQLNtnNs2FE3zR9FdqXpSA6Ghcrg+j+Q= = 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 3texmj2bsb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 03 Oct 2023 16:06:49 +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 2C1B6100057; Tue, 3 Oct 2023 16:06:47 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 12A4A2634F9; Tue, 3 Oct 2023 16:06:47 +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:46 +0200 From: Etienne Carriere To: CC: Jens Wiklander , Sumit Garg , , , Jerome Forissier , Etienne Carriere Subject: [PATCH v10 0/4] tee: introduce TEE system sssion Date: Tue, 3 Oct 2023 16:06:33 +0200 Message-ID: <20231003140637.31346-1-etienne.carriere@foss.st.com> X-Mailer: git-send-email 2.25.1 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_070700_293913_5E9C49E3 X-CRM114-Status: GOOD ( 12.75 ) 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 This series introduces TEE system sessions for TEE service sessions that require TEE to provision resources to prevent deadlock when clients call the TEE. This deadlock situation can happen when a TEE service is used by low level system resources as for example when Linux kernel uses SCMI service embedded in TEE for clock, reset, regulator, etc... controls. This case is detailled in patch 2/4: > This feature is needed to prevent a system deadlock when several TEE > client applications invoke TEE, consuming all TEE thread contexts > available in the secure world. The deadlock can happen in the OP-TEE > driver for example if all these TEE threads issue an RPC call from TEE > to Linux OS to access an eMMC RPMB partition (TEE secure storage) which > device clock or regulator controller is accessed through an OP-TEE SCMI > services. In that case, Linux SCMI driver must reach OP-TEE SCMI > service without waiting until one of the consumed TEE threads is freed. Etienne Carriere (4): tee: optee: system call property tee: system session tee: optee: support tracking system threads firmware: arm_scmi: optee: use optee system invocation drivers/firmware/arm_scmi/optee.c | 4 + drivers/tee/optee/call.c | 152 +++++++++++++++++++++++++++--- drivers/tee/optee/core.c | 5 +- drivers/tee/optee/ffa_abi.c | 13 +-- drivers/tee/optee/optee_private.h | 33 ++++++- drivers/tee/optee/smc_abi.c | 31 ++++-- drivers/tee/tee_core.c | 8 ++ include/linux/tee_drv.h | 16 ++++ 8 files changed, 227 insertions(+), 35 deletions(-)