From patchwork Mon Oct 16 09:04:24 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: 13422759 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 1B6E0CDB474 for ; Mon, 16 Oct 2023 09:05:17 +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=UC2hvM4wbSgZpYTHoLIScytRTfJSMjee2CJ7kBoTMfE=; b=j1x+pxIfmu1kxM c9856wk8gz6DKZqFyACOl3Y2OecmmLfq/wM6MTlDSj8oAWtzsyqF9xOzET3UJJhL9nqcpGuwU2zPi pktYLEpU//9xqu8NVWAny7RsRSSGc75SLkbn1RUwK3PyCLl+FrtsAJ1z6gchKPQ9wPAZt5uA2xPOh U4f7SxlK6yrgWTQJ7dIVz6ugPPh9TAVF03cOy1IABNjvmVJs/Hs+yRF759Kfrm6ANQeA0drxmxbcA Wim5XZqSpq/KlcRw++SmEuumxDaT7Mkzo/BogVsfIImWEiuuvAKcn2sD4i1Vl9Jh7NaHZF/0QETig Mmre1PIr4OCtS8QRId7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qsJWq-008vbw-2j; Mon, 16 Oct 2023 09:04:48 +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 1qsJWj-008vXs-2z for linux-arm-kernel@lists.infradead.org; Mon, 16 Oct 2023 09:04:44 +0000 Received: from pps.filterd (m0369458.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 39G7phQ3017535; Mon, 16 Oct 2023 11:04:33 +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=+KwoOYk zj5H40O26JJtXUk+e+fUkDGx8/XQV9xP6wMQ=; b=Ld8tDPOJUx/PdAwqC83sDwF hOEpOVz72illBdLRDATN6RcyFLmvxC1pX5z6MYJixiNn5eD7lTlkaaIRRMy6Tpze IcSod+O4XpZWbmG+8HkfuXo7NXhVzmRW+ZXvdKSlC/wZ5HDAF6mhrzQbSFDnlYSF jrQOKWjU8N1ez4faEUFRMQ4cgllDpWGd8ua/iNAcRUE319+g6yNtZ9ku7uXOCUna b4awdUmBPLwmPd0GJuxiDfCXgs1sJZj0TwwcI3ffsRxieuf/0OkyePWy6sdWGgmg Gmi+Ksm1/iSVpMSrVObVMBzL6RX3NOhB72m5XrX2cMXZDS3QtlMx1DtrwF9e0Jg= = 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 3tr4hym8x7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 16 Oct 2023 11:04:33 +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 0B6BE10005C; Mon, 16 Oct 2023 11:04:30 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id ED43D218610; Mon, 16 Oct 2023 11:04:30 +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; Mon, 16 Oct 2023 11:04:30 +0200 From: Etienne Carriere To: CC: Jens Wiklander , Sumit Garg , , , Jerome Forissier , Etienne Carriere Subject: [PATCH v11 0/4] tee: introduce TEE system sssion Date: Mon, 16 Oct 2023 11:04:24 +0200 Message-ID: <20231016090428.1369071-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.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-16_02,2023-10-12_01,2023-05-22_02 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231016_020442_494427_80654099 X-CRM114-Status: GOOD ( 12.07 ) 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 | 130 ++++++++++++++++++++++++++++-- drivers/tee/optee/core.c | 5 +- drivers/tee/optee/ffa_abi.c | 13 +-- drivers/tee/optee/optee_private.h | 29 ++++++- drivers/tee/optee/smc_abi.c | 31 ++++--- drivers/tee/tee_core.c | 8 ++ include/linux/tee_drv.h | 16 ++++ 8 files changed, 209 insertions(+), 27 deletions(-) --- Changes since v11: - Changes patch 3/4, other are unchanged.