From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.84.61 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796222923; b=VDPPcVIGOFcfxudBQFqwrciJcuym6zHKst0gQ07/AtlgMzh34S0OO+dUd1pACBUxqr2k a0z9W/FbiedKeQ1P5/s4zAetJoLv79Lhe33YltBZDjEUaii5Tg2Ba2fbg1cF1pzrPJ+6E e14SNu5ToahU5dCIIpDMaTmbkoSvTEnIR0WpH0x+5bJGaCzuIHIQHuTcHtJh4wBIDoR9f 1VdgcpKQ19WsTqsNwXMlYiCUboGxTXQQBzVnbEBoVsphYaWVstULydfR/6G0rKYziyumz e0PF3TWZ+wpJCfCkDHSQn+2dKrqoHcyAa8p4UzLG/h0Nbn/ersBdA1CWXzpjSbq/j9Q== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796222923; h=DMARC-Filter:DKIM-Signature:Received:Received: X-MS-Exchange-Authentication-Results:Received-SPF:Received:Received: Received:From:Date:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-ID:References:In-Reply-To:To:CC: X-Mailer:X-Originating-IP:X-ClientProxiedBy:X-EOPAttributedMessage: X-MS-PublicTrafficType:X-MS-TrafficTypeDiagnostic: X-MS-Office365-Filtering-Correlation-Id:X-MS-Exchange-SenderADCheck: X-MS-Exchange-AntiSpam-Relay:X-Microsoft-Antispam: X-Microsoft-Antispam-Message-Info:X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=yYnXJNe9eh5USMX6wIM5kgKEavZq3pONMhEfGWvOsI0=; b=tHpKo/YRof0ni4yJJf3z6QFF0j759rJ/rNXKhfTLIkGFKeoVUlsxnYqZEEZoNEBH8UmL Adwja0SZYGbsZfyJdO0zUuyR9b42ECYsKxSmxTdo0kyWFNGz+eNN+0XYmImLV2Ytv8fIO mrxoIHz2woXePxjlsg4bQsso6y2iAGtAkmYBFOnP1C7sC7Q1mE8i/O+stjHzkxirNkkuX vsS8s64QMTAI3ZPPnlznqKmNw6lYOXMKVGrawRBtnvsGIFe2rEf/g49xPtP05RewuCIM5 totum+yWWSZ8W9loUaaBOS5Aj69E90YC6mu4ujBf6kJoipfPWRYSlKDPBlJbsVZi1/A== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=foss.st.com; spf=pass smtp.mailfrom=foss.st.com; dkim=pass header.d=foss.st.com header.i=@foss.st.com header.a=rsa-sha256 header.s=selector2 header.b="AwDvol/c"; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.84.61 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11010061.outbound.protection.outlook.com [52.101.84.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 16F6F606A333; Wed, 2 Dec 2026 14:48:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 16F6F606A333 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=foss.st.com header.i=@foss.st.com header.a=rsa-sha256 header.s=selector2 header.b=AwDvol/c ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QmdQlGkT6mHLs2RbXIhrUJtsVDwqh9VXmnjsV2SXsqZpUQrBJtpEGBxYzwlPOvd4aN3G0JloJv8oOwNHYAvLvfJ55jgb3BkI1Oeau4sYenEEMuGDE3ahAZ1h4rpEAg0CZ+D2hmtcTSWadedvcC2gywS3GkRyLI06/+xJujTHS3mKnCOcucAKMw021N+Ve3K4EntFuoTZqFkQTzCJu7J/wrP9l82QHvofP1jfUFYkGk/d6RRO/8yqDqDAJGM9+JbzSUYg54njIM8O/TMxAS4tQ5c7c81y0TIVCXvKuLz+0Z8W03CBFn0Eo1KPjQTnvB7tXVTqsJUCtLIwSIJH+GMGJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yYnXJNe9eh5USMX6wIM5kgKEavZq3pONMhEfGWvOsI0=; b=WWCO+/u/Vr3b36sPdo15/sntyxN+fnJ0ncjErRi6AdV0xvjojCuxz7FPCZxf9U9ktmjLe4j+jPyj9aJ42+DU6xc44ByIrK21lK/bT5vBZNpO2Yo0PPp7V68D/CZNE3rfW9+D0QqNf1WHHSMkMPg/YDjh7thjPeY5QBcvuDYYpwYMxweLkLbQlWXYYlhZn+XC5aPh4cznIC6oSLD6Frp08VBMCDa4DE6QmQYt6j0sNTfwGvIUl79hj61vJpOcX8YxdRFx7wfi3IyiTPjN8ndG5bE6YUlf+GGV4imxMn9GRdiEmQ8dc6h1z0j1sEiF+HdmDBm5SyeOhwRYx9ToR7ZiYw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 164.130.1.60) smtp.rcpttodomain=pengutronix.de smtp.mailfrom=foss.st.com; dmarc=fail (p=none sp=none pct=100) action=none header.from=foss.st.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yYnXJNe9eh5USMX6wIM5kgKEavZq3pONMhEfGWvOsI0=; b=AwDvol/cg2/rLmuDpFNCP/+70vG5Y/MmQbxkoTSeZC1FQE6JGptz+i8TbRqEYTqbCC0dM+Sqqn+LOpGIIotiRIZ3ZqUforLzfzVCkv85RalCeOXZA2qxV/V43rSYIY/QFtlzfFl9aVFDcq1WFXConfXerAF5IRMlypxbKV+ZtIFM525JEHIXHsKm6P6cmxzzfMAFL6nIkL/8fELUcEfle56tn/B1LftnTnwwnE/d6rSjSuH88B467rJuZ/rPK6+B1uWADGTAjROeWt/4DQvAjWBiCkceGoskAnxjZ0OawknqTLrG3gBlE8A8hNYsxANJeFDheEYCLcZpLfn2LngTEQ== Received: from AS4P189CA0009.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:5d7::13) by BR0PR10MB231668.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:2c8:5c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.709.5; Wed, 2 Dec 2026 14:48:37 +0000 Received: from CPH1EPF0000052D.eurprd05.prod.outlook.com (2603:10a6:20b:5d7:cafe::97) by AS4P189CA0009.outlook.office365.com (2603:10a6:20b:5d7::13) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.688.10 via Frontend Transport; Wed, 2 Dec 2026 14:48:37 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; spf=fail (sender IP is 164.130.1.60) smtp.mailfrom=foss.st.com; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=foss.st.com; Received-SPF: Fail (protection.outlook.com: domain of foss.st.com does not designate 164.130.1.60 as permitted sender) receiver=protection.outlook.com; client-ip=164.130.1.60; helo=smtpO365.st.com; Received: from smtpO365.st.com (164.130.1.60) by CPH1EPF0000052D.mail.protection.outlook.com (10.167.241.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.5 via Frontend Transport; Wed, 2 Dec 2026 14:48:36 +0000 Received: from STKDAG1NODE2.st.com (10.75.128.133) by smtpO365.st.com (10.250.44.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.56; Wed, 2 Dec 2026 15:49:55 +0100 Received: from localhost (10.48.87.127) by STKDAG1NODE2.st.com (10.75.128.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.56; Wed, 2 Dec 2026 15:48:36 +0100 From: Arnaud Pouliquen Date: Wed, 2 Dec 2026 15:48:20 +0100 Subject: [PATCH v23 4/6] remoteproc: Add TEE support X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-ID: <20261202-rproc_tee_v23-b4-v23-4-bac8e36eb405@foss.st.com> References: <20261202-rproc_tee_v23-b4-v23-0-bac8e36eb405@foss.st.com> In-Reply-To: <20261202-rproc_tee_v23-b4-v23-0-bac8e36eb405@foss.st.com> To: Bjorn Andersson , Mathieu Poirier , Rob Herring , "Krzysztof Kozlowski" , Conor Dooley , "Maxime Coquelin" , Alexandre Torgue , Fabien Dessenne , Arnaud Pouliquen , Philipp Zabel CC: , , , , , "Jens Wiklander" , X-Mailer: b4 0.13.0 X-ClientProxiedBy: STKCAS1NODE1.st.com (10.75.128.134) To STKDAG1NODE2.st.com (10.75.128.133) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CPH1EPF0000052D:EE_|BR0PR10MB231668:EE_ X-MS-Office365-Filtering-Correlation-Id: 0a8ec1ce-5dcf-4059-8771-08df508358cc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|36860700016|23010399003|1800799024|82310400026|921020|10067099003|56012099006|11063799006|5023799004|261022105027099003|261022075727099003|261022113327099003|261009220027099003|261021135927099003|261021130227099003|261022115727099003|261009221227099003|261021123027099003|261021133027099003|261021121427099003|261009221727099003|261009223327099003|261009223027099003|261102123227099003|261102130727099003|261026121527099003|261026140227099003|261026130827099003|261026135527099003|261028144727099003|18002099003|22082099003|6133799003|3023799007; X-Microsoft-Antispam-Message-Info: 3soRuw+tAtk2EMgkJjrTjYjS7dSX1r3ehcCdo+3ne3NJefBbHw4yElarLJZpRVbXJOTiB+5K9HIzuW1btVob2JXuhTGLth6Z57iYadbFRI8gMpCPx6KTqaZGClyVWQCQZazpXKaSMVojJF8zwo8YWCsO1uDKWSJez7ISU9kJoNXMzFD7O8wZVIIM3p1HdJsAKEOBDG7SfyDtWVMwGlziom+tWfjsQQnMk/5FSq14EQh6nkDRV8WX3+0x+oWXROsH5SxNJJBspN++45Fkn8evZ7BXwHBLLGK0UqwuHIFJOwDeAjT//XvlcKd9z9aiBDn7m5MUmID4hoLcQezlKBeqbrGmasS6N4AtGfPH+Ioitn4KO0SsYRiqGXyKGaaNq234aKVF0OJKNbXh2FowvmQPBl+xyntQJRY4x693+nw7v5eKcoriQdb8RMnmyPswmHMwgZfBGIVOSDqJH6Px1E2VbJuyL1MA+W/2+7qd0sYFVBQqbZQO9eza2hDQl/oQHDT0/v/bOuDG+dsGj9VvidrFqKZI3/u9a1HGcdhKEnr/evZ55SGufW/2fhoOziFtxC0JXqBOgcNDG6zvYml7uI0f09E+SRp1HYS+4lcUtyvgTAEfjYKDMpaNxdy95Sx6SFea8LZ8mbUY3A4VMbaQXXVEqDYWKfuQTLTz3YrPBRZ4/AtBK2JKZBrtrCaeB2/ga3fIlQB0hBo05iIEA3d0Wkr206tdPVgS8Wt4bvdlE9NnB95Jm9QvqkaHuxy4Chlfy522 X-Forefront-Antispam-Report: CIP:164.130.1.60;CTRY:IT;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:smtpO365.st.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(7416014)(376014)(36860700016)(23010399003)(1800799024)(82310400026)(921020)(10067099003)(56012099006)(11063799006)(5023799004)(261022105027099003)(261022075727099003)(261022113327099003)(261009220027099003)(261021135927099003)(261021130227099003)(261022115727099003)(261009221227099003)(261021123027099003)(261021133027099003)(261021121427099003)(261009221727099003)(261009223327099003)(261009223027099003)(261102123227099003)(261102130727099003)(261026121527099003)(261026140227099003)(261026130827099003)(261026135527099003)(261028144727099003)(18002099003)(22082099003)(6133799003)(3023799007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZWlhWBSGwYew2jOZYCHDLXEWKCF//yPMf8swvNWqm/gFAgGlfmF8dOFTfmG20wHePVEAPVClUbL/9AqmCeZp/NE6GiohW9+rY2Dd5jgJF/zVOYtRLa4+tevgLwuI6AtrG0ENWYRba/I+eSusmcuZLKZxbbkQIlNaEC/+Vwzr0EE1ioz4IQZRt/+BFbu5gnbua7ejK1fgNDU71tEs0l9JaLrVBCzLdoYb0k981I3DjY3vJP73c5xOAalfKw+m6J0aRFF8YyrAToqp9pwWSg8mjh+3AVHMAqiQsIF83rWszNVpo0cuWuulyp5ZUV0P2n4rWdsm9z0E1p7MambTnCWD/5uu7ajmIHJGyRjncIMX7J8x/NviD0gf8e/uH/9y7EFs/lSBC8q6Zy9lOjzW39G1/iOTRgTsks+Mb1OS7NQ0JnlkNs4l8hV68BzskZ3BEEWQ X-OriginatorOrg: foss.st.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2026 14:48:36.9604 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0a8ec1ce-5dcf-4059-8771-08df508358cc X-MS-Exchange-CrossTenant-Id: 75e027c9-20d5-47d5-b82f-77d7cd041e8f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=75e027c9-20d5-47d5-b82f-77d7cd041e8f;Ip=[164.130.1.60];Helo=[smtpO365.st.com] X-MS-Exchange-CrossTenant-AuthSource: CPH1EPF0000052D.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BR0PR10MB231668 Add a remoteproc TEE (Trusted Execution Environment) driver that will be probed by the TEE bus. If the associated Trusted application is supported on the secure part, this driver offers a client interface to load firmware by the secure part. This firmware could be authenticated by the secure trusted application. A specificity of the implementation is that the firmware has to be authenticated and optionally decrypted to access the resource table. Consequently, the boot sequence is: 1) rproc_parse_fw --> rproc_tee_parse_fw remoteproc TEE: - Requests the TEE application to authenticate and load the firmware in the remote processor memories. - Requests the TEE application for the address of the resource table. - Creates a copy of the resource table stored in rproc->cached_table. 2) rproc_load_segments --> rproc_tee_load_fw remoteproc TEE: - Requests the TEE application to load the firmware. Nothing is done at the TEE application as the firmware is already loaded. - In case of recovery, the TEE application has to reload the firmware. 3) rproc_tee_find_loaded_rsc_table remoteproc TEE requests the TEE application for the address of the resource table. 4) rproc_start --> rproc_tee_start - Requests the TEE application to start the remote processor. The shutdown sequence is: 5) rproc_stop --> rproc_tee_stop - Requests the TEE application to stop the remote processor. 6) rproc_tee_release_fw This function is used to request the TEE application to perform actions to return to the initial state on stop or on error during the boot sequence. Signed-off-by: Arnaud Pouliquen --- Version 23 updates: - Drop the TA-UUID compatible node: the TA is discovered on the TEE bus by UUID only, and st,rproc-tee now references the linaro,optee-tz node. rproc_tee_register() checks the phandle target compatible instead of comparing it with an of_node attached to the TEE client device. - Remove uuid_to_str(), of_find_compatible_node() and device_add_of_node()/device_remove_of_node(). - rproc_add() is now called without ctx_lock (deadlock with auto-boot) - teardown paths use mutex_lock() - rproc_tee_unregister() always calls rproc_del() - backend removal under ctx_lock, with sessions closed the resource-table address and size are checked - REMOTEPROC_TEE is now tristate - rproc_tee_pa_to_da() is removed (no more used since v22). Version 22 updates: - Revert to version 19, as the st,stm32-rproc-tee compatible has been rejected. As a consequence, we cannot have a rproc_stm32-tee.c driver and must reuse the rproc_stm32.c driver. - Protect rproc_to_trproc() with lockdep_assert_held(). Version 21 updates: - introduce uuid_to_str() to comput the compatible from the TEE UUID - update rproc_tee_register() to provide phandle referenced in the remoteproc driver client. - use device_link_add() to link the remoteproc driver client. Version 20 updates: - rework probe. the remoteproc-tee now probe the remoteproc devices defined in device tree as child. - creation of rproc-service-80a4c275-0a47-4905-8285-1486a9771a08 compatible - use of of_find_compatible_node() to find node in DT - use of of_platform_populate() to probe remoteproc devices - remove device_link_add() as now managed by of_platform_populate) - add "auto_boot" parameter in rproc_tee_register() - rename TA_RPROC_FW_CMD_* TEE CMD in TA_RPROC_CMD_* command - use of DEFINE_MUTEX Version 19 updates: - rework/fix function headers - use memremap instead of ioremap for the resource table. - realign comments to 80 chars limit, with few exceptions for readability - replace spinlock by mutex and and protect APIs from concurrent access - add support of 64-bit address in rproc_tee_get_loaded_rsc_table() - update copyright year Version 18 updates Fix warning: warning: EXPORT_SYMBOL() is used, but #include is missing --- drivers/remoteproc/Kconfig | 11 + drivers/remoteproc/Makefile | 1 + drivers/remoteproc/remoteproc_tee.c | 773 ++++++++++++++++++++++++++++++++++++ include/linux/remoteproc_tee.h | 88 ++++ 4 files changed, 873 insertions(+) diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig index 70dec8c3fe4e..dfab4fb2c5ee 100644 --- a/drivers/remoteproc/Kconfig +++ b/drivers/remoteproc/Kconfig @@ -32,6 +32,16 @@ config AMD_MBV_BRAM_REMOTEPROC If unsure, say N. +config REMOTEPROC_TEE + tristate "Remoteproc support by a TEE application" + depends on OPTEE + help + Support a remote processor that is managed by an application running in a Trusted + Execution Environment (TEE). This application is responsible for loading the remote + processor firmware image and managing its lifecycle. + + It's safe to say N if the remote processor is not managed by a TEE. + config IMX_REMOTEPROC tristate "i.MX remoteproc support" depends on ARCH_MXC @@ -326,6 +336,7 @@ config ST_SLIM_REMOTEPROC config STM32_RPROC tristate "STM32 remoteproc support" depends on ARCH_STM32 || COMPILE_TEST + depends on REMOTEPROC_TEE || !REMOTEPROC_TEE select MAILBOX help Say y here to support STM32 MCU processors via the diff --git a/drivers/remoteproc/Makefile b/drivers/remoteproc/Makefile index 689686de0d41..fb72038d0274 100644 --- a/drivers/remoteproc/Makefile +++ b/drivers/remoteproc/Makefile @@ -11,6 +11,7 @@ remoteproc-y += remoteproc_sysfs.o remoteproc-y += remoteproc_virtio.o remoteproc-y += remoteproc_elf_loader.o obj-$(CONFIG_REMOTEPROC_CDEV) += remoteproc_cdev.o +obj-$(CONFIG_REMOTEPROC_TEE) += remoteproc_tee.o obj-$(CONFIG_AMD_MBV_BRAM_REMOTEPROC) += amd_mbv_bram_rproc.o obj-$(CONFIG_IMX_REMOTEPROC) += imx_rproc.o obj-$(CONFIG_IMX_DSP_REMOTEPROC) += imx_dsp_rproc.o diff --git a/drivers/remoteproc/remoteproc_tee.c b/drivers/remoteproc/remoteproc_tee.c new file mode 100644 index 000000000000..a9e9cdb7f657 --- /dev/null +++ b/drivers/remoteproc/remoteproc_tee.c @@ -0,0 +1,773 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) STMicroelectronics 2025 + * Author: Arnaud Pouliquen + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "remoteproc_internal.h" + +#define MAX_TEE_PARAM_ARRAY_MEMBER 4 + +/* + * Authentication and load of the firmware image in the remote processor + * memories by the TEE. After this step the firmware is installed in destination + * memories, which can then be locked to prevent access by Linux. + * + * [in] params[0].value.a: remote processor identifier + * [in] params[1].memref: buffer containing a temporary copy of the signed + * image to load. + */ +#define TA_RPROC_CMD_LOAD_FW 1 + +/* + * Start the remote processor by the TEE + * + * [in] params[0].value.a: remote processor identifier + */ +#define TA_RPROC_CMD_START 2 + +/* + * Stop the remote processor by the TEE + * + * [in] params[0].value.a: remote processor identifier + */ +#define TA_RPROC_CMD_STOP 3 + +/* + * Return the address of the resource table, or 0 if not found. + * + * [in] params[0].value.a: remote processor identifier + * [out] params[1].value.a: 32bit LSB resource table memory address + * [out] params[1].value.b: 32bit MSB resource table memory address + * [out] params[2].value.a: 32bit LSB resource table memory size + * [out] params[2].value.b: 32bit MSB resource table memory size + */ +#define TA_RPROC_CMD_GET_RSC_TABLE 4 + +/* + * Release remote processor firmware images and associated resources. + * This command should be used in case an error occurs between the loading of + * the firmware images (TA_RPROC_CMD_LOAD_FW) and the starting of the remote + * processor (TA_RPROC_CMD_START) or after stopping the remote processor + * to release associated resources (TA_RPROC_CMD_STOP). + * + * [in] params[0].value.a: remote processor identifier + */ +#define TA_RPROC_CMD_RELEASE_FW 6 + +/** + * struct rproc_tee_context - Global TEE backend context + * @rproc_list: List of registered TEE-backed remoteprocs + * @tee_ctx: TEE context handle + * @dev: TEE client device + */ +struct rproc_tee_context { + struct list_head rproc_list; + struct tee_context *tee_ctx; + struct device *dev; +}; + +/** + * struct rproc_tee - TEE remoteproc structure + * @node: Reference in global list + * @rproc: Remoteproc reference + * @rproc_id: remote processor identifier + * @session_id: TEE session identifier + * @session_open: true until the TEE session is closed + */ +struct rproc_tee { + struct list_head node; + struct rproc *rproc; + u32 rproc_id; + u32 session_id; + bool session_open; +}; + +static struct rproc_tee_context rproc_tee_ctx = { + .rproc_list = LIST_HEAD_INIT(rproc_tee_ctx.rproc_list), +}; + +static DEFINE_MUTEX(ctx_lock); /* Protects concurrent manipulations of the rproc_tee_ctx*/ + +static struct rproc_tee *rproc_to_trproc(struct rproc *rproc) +{ + struct rproc_tee *trproc; + + lockdep_assert_held(&ctx_lock); + + list_for_each_entry(trproc, &rproc_tee_ctx.rproc_list, node) { + if (trproc->rproc == rproc) + return trproc; + } + + return NULL; +} + +static void rproc_tee_prepare_args(struct rproc_tee *trproc, int cmd, + struct tee_ioctl_invoke_arg *arg, + struct tee_param *param, + unsigned int num_params) +{ + memset(arg, 0, sizeof(*arg)); + memset(param, 0, MAX_TEE_PARAM_ARRAY_MEMBER * sizeof(*param)); + + arg->func = cmd; + arg->session = trproc->session_id; + arg->num_params = num_params + 1; + + param[0] = (struct tee_param) { + .attr = TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INPUT, + .u.value.a = trproc->rproc_id, + }; +} + +static int rproc_tee_sanity_check(struct device_node *tee_np) +{ + /* Only OP-TEE implements the remoteproc TA today */ + if (!of_device_is_compatible(tee_np, "linaro,optee-tz")) + return -EINVAL; + + /* Backend not probed yet */ + if (!rproc_tee_ctx.dev) + return -EPROBE_DEFER; + + return 0; +} + +/** + * rproc_tee_release_fw() - Release the firmware for a TEE-based remote processor + * @rproc: Pointer to the struct rproc representing the remote processor + * + * This function invokes the TA_RPROC_CMD_RELEASE_FW TEE client function to + * release the firmware. It should only be called when the remoteproc state is + * RPROC_OFFLINE or RPROC_DETACHED. The function requests the TEE remoteproc + * application to release the firmware loaded by rproc_tee_load_fw(). + * If the firmware release is skipped, the TA would keep the previous firmware + * loaded. + * + * The request is ignored if the rproc state is RPROC_DETACHED as the remote + * processor is still running. + */ +void rproc_tee_release_fw(struct rproc *rproc) +{ + struct tee_param param[MAX_TEE_PARAM_ARRAY_MEMBER]; + struct rproc_tee *trproc; + struct tee_ioctl_invoke_arg arg; + int ret; + + mutex_lock(&ctx_lock); + if (!rproc_tee_ctx.dev) { + dev_err(&rproc->dev, "no device available\n"); + goto out; + } + + trproc = rproc_to_trproc(rproc); + if (!trproc) { + dev_err(rproc_tee_ctx.dev, "no trproc available\n"); + goto out; + } + + /* + * If the remote processor state is RPROC_DETACHED, just ignore the + * request, as the remote processor is still running. + */ + if (rproc->state == RPROC_DETACHED) + goto out; + + if (rproc->state != RPROC_OFFLINE) { + dev_err(rproc_tee_ctx.dev, "unexpected rproc state: %d\n", rproc->state); + goto out; + } + + rproc_tee_prepare_args(trproc, TA_RPROC_CMD_RELEASE_FW, &arg, param, 0); + + ret = tee_client_invoke_func(rproc_tee_ctx.tee_ctx, &arg, param); + if (ret < 0 || arg.ret != 0) { + dev_err(rproc_tee_ctx.dev, + "TA_RPROC_CMD_RELEASE_FW invoke failed TEE err: %#x, ret:%d\n", + arg.ret, ret); + } + +out: + mutex_unlock(&ctx_lock); +} +EXPORT_SYMBOL_GPL(rproc_tee_release_fw); + +/** + * rproc_tee_load_fw() - Load firmware from TEE application + * @rproc: Pointer to the struct rproc representing the remote processor + * @fw: Pointer to the firmware structure containing the firmware data and size + * + * This function invokes the TA_RPROC_CMD_LOAD_FW TEE client function to load + * the firmware. It registers the fw->data as a shared memory region with the + * TEE, and requests the TEE to load the firmware. This function can be called + * twice during the remote processor boot: first by rproc_tee_parse_fw() to + * access the resource table, then through the rproc load() operation. The + * TEE application ignores the second request if the firmware is already + * loaded. + * + * Return: 0 on success, or an error code on failure + */ +int rproc_tee_load_fw(struct rproc *rproc, const struct firmware *fw) +{ + struct tee_param param[MAX_TEE_PARAM_ARRAY_MEMBER]; + struct rproc_tee *trproc; + struct tee_ioctl_invoke_arg arg; + struct tee_shm *fw_shm; + int ret; + + ret = mutex_lock_interruptible(&ctx_lock); + if (ret) + return ret; + + if (!rproc_tee_ctx.dev) { + ret = -ENODEV; + goto out; + } + + trproc = rproc_to_trproc(rproc); + if (!trproc) { + ret = -EINVAL; + goto out; + } + + fw_shm = tee_shm_register_kernel_buf(rproc_tee_ctx.tee_ctx, (void *)fw->data, fw->size); + if (IS_ERR(fw_shm)) { + ret = PTR_ERR(fw_shm); + goto out; + } + + rproc_tee_prepare_args(trproc, TA_RPROC_CMD_LOAD_FW, &arg, param, 1); + + /* Provide the address of the firmware image */ + param[1] = (struct tee_param) { + .attr = TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT, + .u.memref = { + .shm = fw_shm, + .size = fw->size, + .shm_offs = 0, + }, + }; + + ret = tee_client_invoke_func(rproc_tee_ctx.tee_ctx, &arg, param); + if (ret < 0 || arg.ret != 0) { + dev_err(rproc_tee_ctx.dev, + "TA_RPROC_CMD_LOAD_FW invoke failed TEE err: %#x, ret:%d\n", + arg.ret, ret); + if (!ret) + ret = -EIO; + } + + tee_shm_free(fw_shm); + +out: + mutex_unlock(&ctx_lock); + return ret; +} +EXPORT_SYMBOL_GPL(rproc_tee_load_fw); + +static int rproc_tee_get_loaded_rsc_table(struct rproc *rproc, phys_addr_t *rsc_pa, + size_t *table_sz) +{ + struct tee_param param[MAX_TEE_PARAM_ARRAY_MEMBER]; + struct rproc_tee *trproc; + struct tee_ioctl_invoke_arg arg; + u64 pa, size; + int ret; + + ret = mutex_lock_interruptible(&ctx_lock); + if (ret) + return ret; + + if (!rproc_tee_ctx.dev) { + ret = -ENODEV; + goto out; + } + + trproc = rproc_to_trproc(rproc); + if (!trproc) { + ret = -EINVAL; + goto out; + } + + rproc_tee_prepare_args(trproc, TA_RPROC_CMD_GET_RSC_TABLE, &arg, param, 2); + + param[1].attr = TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_OUTPUT; + param[2].attr = TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_OUTPUT; + + ret = tee_client_invoke_func(rproc_tee_ctx.tee_ctx, &arg, param); + if (ret < 0 || arg.ret != 0) { + dev_err(rproc_tee_ctx.dev, + "TA_RPROC_CMD_GET_RSC_TABLE invoke failed TEE err: %#x, ret:%d\n", + arg.ret, ret); + if (!ret) + ret = -EIO; + goto out; + } + + /* The TA returns each value as two 32-bit words (LSB in a, MSB in b) */ + pa = (param[1].u.value.b << 32) | lower_32_bits(param[1].u.value.a); + size = (param[2].u.value.b << 32) | lower_32_bits(param[2].u.value.a); + + if (!size) { + *rsc_pa = 0; + *table_sz = 0; + goto out; + } + + /* Reject values the kernel cannot represent instead of truncating them */ + if (!rproc_u64_fit_in_size_t(size) || pa > PHYS_ADDR_MAX) { + dev_err(rproc_tee_ctx.dev, + "invalid resource table %#llx+%#llx\n", pa, size); + ret = -EINVAL; + goto out; + } + + *rsc_pa = pa; + *table_sz = size; + +out: + mutex_unlock(&ctx_lock); + return ret; +} + +/** + * rproc_tee_parse_fw() - Get the resource table from TEE application + * @rproc: Pointer to the struct rproc representing the remote processor + * @fw: Pointer to the firmware structure containing the firmware data and size + * + * This function retrieves the loaded resource table and creates a cached_table + * copy. Since the firmware image is signed and potentially encrypted, the + * firmware must be loaded first to access the loaded resource table. + * + * Return: 0 on success, or an error code on failure + */ +int rproc_tee_parse_fw(struct rproc *rproc, const struct firmware *fw) +{ + phys_addr_t rsc_table; + void *rsc_va; + size_t table_sz; + int ret; + + if (!rproc) + return -EINVAL; + + /* We need first to Load the firmware, to be able to get the resource table. */ + ret = rproc_tee_load_fw(rproc, fw); + if (ret) + return ret; + + ret = rproc_tee_get_loaded_rsc_table(rproc, &rsc_table, &table_sz); + if (ret) + goto release_fw; + + /* A missing resource table is valid for some firmware images. */ + if (!table_sz) { + rproc->table_ptr = NULL; + rproc->table_sz = 0; + return 0; + } + + /* + * We assume here that the memory mapping is the same between the TEE + * and Linux kernel contexts. Else a new TEE remoteproc service could be + * needed to get a copy of the resource table. + */ + rsc_va = memremap(rsc_table, table_sz, MEMREMAP_WC); + if (!rsc_va) { + dev_err(rproc_tee_ctx.dev, "Unable to map memory region: %pa+%zx\n", + &rsc_table, table_sz); + ret = -ENOMEM; + goto release_fw; + } + + /* + * Create a copy of the resource table to have the same behavior as the + * ELF loader. This cached table will be used by the remoteproc core + * after the remoteproc stops to free resources and for crash recovery + * to reapply the settings. + * The cached table will be freed by the remoteproc core. + */ + rproc->cached_table = kmemdup(rsc_va, table_sz, GFP_KERNEL); + memunmap(rsc_va); + + if (!rproc->cached_table) { + ret = -ENOMEM; + goto release_fw; + } + + rproc->table_ptr = rproc->cached_table; + rproc->table_sz = table_sz; + + return 0; + +release_fw: + rproc_tee_release_fw(rproc); + return ret; +} +EXPORT_SYMBOL_GPL(rproc_tee_parse_fw); + +/** + * rproc_tee_find_loaded_rsc_table() - Find the loaded resource table loaded by + * the TEE application + * @rproc: Pointer to the struct rproc representing the remote processor + * @fw: Pointer to the firmware structure containing the firmware data and size + * + * This function retrieves the physical address and size of the resource table + * loaded by the TEE application. + * + * Return: pointer to the resource table if found, or NULL if not found or size + * is 0 + */ +struct resource_table *rproc_tee_find_loaded_rsc_table(struct rproc *rproc, + const struct firmware *fw) +{ + phys_addr_t rsc_table; + size_t table_sz; + int ret; + + ret = rproc_tee_get_loaded_rsc_table(rproc, &rsc_table, &table_sz); + if (ret) + return NULL; + + rproc->table_sz = table_sz; + if (!table_sz) + return NULL; + + /* + * At this step the memory area that contains the resource table should + * have been registered by the remote proc platform driver and allocated + * by rproc_alloc_registered_carveouts(). + */ + return rproc_pa_to_va(rproc, rsc_table, table_sz, NULL); +} +EXPORT_SYMBOL_GPL(rproc_tee_find_loaded_rsc_table); + +/** + * rproc_tee_start() - Request the TEE application to start the remote processor + * @rproc: Pointer to the struct rproc representing the remote processor + * + * This function invokes the TA_RPROC_CMD_START command to start the remote + * processor. + * + * Return: 0 on success, negative errno on failure + */ +int rproc_tee_start(struct rproc *rproc) +{ + struct tee_param param[MAX_TEE_PARAM_ARRAY_MEMBER]; + struct rproc_tee *trproc; + struct tee_ioctl_invoke_arg arg; + int ret; + + ret = mutex_lock_interruptible(&ctx_lock); + if (ret) + return ret; + + if (!rproc_tee_ctx.dev) { + ret = -ENODEV; + goto out; + } + + trproc = rproc_to_trproc(rproc); + if (!trproc) { + ret = -EINVAL; + goto out; + } + + rproc_tee_prepare_args(trproc, TA_RPROC_CMD_START, &arg, param, 0); + + ret = tee_client_invoke_func(rproc_tee_ctx.tee_ctx, &arg, param); + if (ret < 0 || arg.ret != 0) { + dev_err(rproc_tee_ctx.dev, + "TA_RPROC_CMD_START invoke failed TEE err: %#x, ret:%d\n", arg.ret, ret); + if (!ret) + ret = -EIO; + } + +out: + mutex_unlock(&ctx_lock); + return ret; +} +EXPORT_SYMBOL_GPL(rproc_tee_start); + +/** + * rproc_tee_stop() - Request the TEE application to stop the remote processor + * @rproc: Pointer to the struct rproc representing the remote processor + * + * This function invokes the TA_RPROC_CMD_STOP command to stop the remote + * processor. + * + * Return: 0 on success, negative errno on failure + */ +int rproc_tee_stop(struct rproc *rproc) +{ + struct tee_param param[MAX_TEE_PARAM_ARRAY_MEMBER]; + struct rproc_tee *trproc; + struct tee_ioctl_invoke_arg arg; + int ret; + + ret = mutex_lock_interruptible(&ctx_lock); + if (ret) + return ret; + + if (!rproc_tee_ctx.dev) { + ret = -ENODEV; + goto out; + } + + trproc = rproc_to_trproc(rproc); + if (!trproc) { + ret = -EINVAL; + goto out; + } + + rproc_tee_prepare_args(trproc, TA_RPROC_CMD_STOP, &arg, param, 0); + + ret = tee_client_invoke_func(rproc_tee_ctx.tee_ctx, &arg, param); + if (ret < 0 || arg.ret != 0) { + dev_err(rproc_tee_ctx.dev, + "TA_RPROC_CMD_STOP invoke failed TEE err: %#x, ret:%d\n", arg.ret, ret); + if (!ret) + ret = -EIO; + } + +out: + mutex_unlock(&ctx_lock); + return ret; +} +EXPORT_SYMBOL_GPL(rproc_tee_stop); + +/** + * rproc_tee_register() - Register a remote processor controlled by the TEE application + * @dev: Client rproc device + * @rproc: Pointer to the struct rproc representing the remote processor + * @tee_phandle: Backend phandle args (np + 1 cell: rproc_id) + * + * The phandle must point to the TEE firmware node. + * + * Return: 0 on success or a negative error code. + */ +int rproc_tee_register(struct device *dev, struct rproc *rproc, + const struct of_phandle_args *tee_phandle) +{ + struct tee_param param[MAX_TEE_PARAM_ARRAY_MEMBER]; + unsigned int rproc_id; + struct device_node *tee_np; + struct tee_ioctl_open_session_arg sess_arg; + struct tee_client_device *tee_device; + struct device_link *link; + struct rproc_tee *trproc; + int ret; + + if (!tee_phandle || !tee_phandle->np || tee_phandle->args_count < 1) + return -EINVAL; + + rproc_id = tee_phandle->args[0]; + tee_np = tee_phandle->np; + + ret = mutex_lock_interruptible(&ctx_lock); + if (ret) + return ret; + + ret = rproc_tee_sanity_check(tee_np); + if (ret) + goto out; + + trproc = kzalloc_obj(*trproc); + if (!trproc) { + ret = -ENOMEM; + goto out; + } + + tee_device = to_tee_client_device(rproc_tee_ctx.dev); + memset(&sess_arg, 0, sizeof(sess_arg)); + memcpy(sess_arg.uuid, tee_device->id.uuid.b, TEE_IOCTL_UUID_LEN); + + sess_arg.clnt_login = TEE_IOCTL_LOGIN_REE_KERNEL; + sess_arg.num_params = 1; + + param[0] = (struct tee_param) { + .attr = TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INPUT, + .u.value.a = rproc_id, + }; + + ret = tee_client_open_session(rproc_tee_ctx.tee_ctx, &sess_arg, param); + if (ret < 0 || sess_arg.ret != 0) { + dev_err(dev, "tee_client_open_session failed, err: %#x\n", + sess_arg.ret); + if (!ret) + ret = -EINVAL; + goto free_trproc; + } + + trproc->rproc_id = rproc_id; + trproc->session_id = sess_arg.session; + trproc->session_open = true; + trproc->rproc = rproc; + + /* Create device link between the rproc device and the TEE device */ + link = device_link_add(dev, rproc_tee_ctx.dev, + DL_FLAG_AUTOREMOVE_CONSUMER); + if (!link) { + ret = -ENOMEM; + goto close_tee; + } + + list_add(&trproc->node, &rproc_tee_ctx.rproc_list); + mutex_unlock(&ctx_lock); + + ret = rproc_add(rproc); + if (ret) + goto del_trproc; + + return 0; + +del_trproc: + mutex_lock(&ctx_lock); + list_del(&trproc->node); +close_tee: + /* The backend may have been removed while ctx_lock was released */ + if (trproc->session_open && + tee_client_close_session(rproc_tee_ctx.tee_ctx, trproc->session_id)) + dev_err(dev, "tee_client_close_session failed\n"); +free_trproc: + kfree(trproc); +out: + mutex_unlock(&ctx_lock); + return ret; +} +EXPORT_SYMBOL_GPL(rproc_tee_register); + +/** + * rproc_tee_unregister - Unregister a remote processor controlled by the TEE + * application. + * @dev: Pointer to client rproc device + * @rproc: Pointer to the struct rproc representing the remote processor + * + * This function unregisters a remote processor previously registered by the + * rproc_tee_register() function. + * + * Return: Returns 0 on success, or an error code on failure + */ +int rproc_tee_unregister(struct device *dev, struct rproc *rproc) +{ + struct rproc_tee *trproc; + int ret = 0; + + /* + * Always unregister the rproc: the caller frees it afterwards. ctx_lock + * must not be held, stopping the remote processor calls the TEE ops. + */ + rproc_del(rproc); + + mutex_lock(&ctx_lock); + + trproc = rproc_to_trproc(rproc); + if (!trproc) { + ret = -EINVAL; + goto out_unlock; + } + + /* The backend may have been removed while ctx_lock was released */ + if (trproc->session_open) { + ret = tee_client_close_session(rproc_tee_ctx.tee_ctx, + trproc->session_id); + if (ret < 0) + dev_err(dev, "tee_client_close_session failed, err: %d\n", + ret); + } + + list_del(&trproc->node); + kfree(trproc); + +out_unlock: + mutex_unlock(&ctx_lock); + return ret; +} +EXPORT_SYMBOL_GPL(rproc_tee_unregister); + +static int rproc_tee_ctx_match(struct tee_ioctl_version_data *ver, + const void *data) +{ + /* Today we support only OP-TEE; could be extended to other TEEs */ + return ver->impl_id == TEE_IMPL_ID_OPTEE; +} + +static const struct tee_client_device_id rproc_tee_id_table[] = { + {UUID_INIT(0x80a4c275, 0x0a47, 0x4905, 0x82, 0x85, 0x14, 0x86, 0xa9, 0x77, 0x1a, 0x08)}, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(tee, rproc_tee_id_table); + +static int rproc_tee_probe(struct tee_client_device *tee_dev) +{ + struct device *dev = &tee_dev->dev; + struct tee_context *tee_ctx; + int ret; + + /* Open context with TEE driver */ + tee_ctx = tee_client_open_context(NULL, rproc_tee_ctx_match, NULL, NULL); + if (IS_ERR(tee_ctx)) + return PTR_ERR(tee_ctx); + + ret = mutex_lock_interruptible(&ctx_lock); + if (ret) + goto close_ctx; + + rproc_tee_ctx.dev = dev; + rproc_tee_ctx.tee_ctx = tee_ctx; + + mutex_unlock(&ctx_lock); + + return 0; + +close_ctx: + tee_client_close_context(tee_ctx); + return ret; +} + +static void rproc_tee_remove(struct tee_client_device *tee_dev) +{ + struct rproc_tee *trproc; + + mutex_lock(&ctx_lock); + /* + * Remote processors still registered keep their entry, freed by + * rproc_tee_unregister(), but their session must be closed before + * the TEE context. + */ + list_for_each_entry(trproc, &rproc_tee_ctx.rproc_list, node) { + if (!trproc->session_open) + continue; + tee_client_close_session(rproc_tee_ctx.tee_ctx, trproc->session_id); + trproc->session_open = false; + } + rproc_tee_ctx.dev = NULL; + tee_client_close_context(rproc_tee_ctx.tee_ctx); + rproc_tee_ctx.tee_ctx = NULL; + mutex_unlock(&ctx_lock); +} + +static struct tee_client_driver rproc_tee_fw_driver = { + .id_table = rproc_tee_id_table, + .probe = rproc_tee_probe, + .remove = rproc_tee_remove, + .driver = { + .name = KBUILD_MODNAME, + }, +}; + +module_tee_client_driver(rproc_tee_fw_driver); + +MODULE_DESCRIPTION("remote processor TEE module"); +MODULE_LICENSE("GPL"); diff --git a/include/linux/remoteproc_tee.h b/include/linux/remoteproc_tee.h new file mode 100644 index 000000000000..4d8e7df8f15e --- /dev/null +++ b/include/linux/remoteproc_tee.h @@ -0,0 +1,88 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright(c) 2025 STMicroelectronics + */ + +#ifndef REMOTEPROC_TEE_H +#define REMOTEPROC_TEE_H + +#include +#include +#include + +#if IS_ENABLED(CONFIG_REMOTEPROC_TEE) + +int rproc_tee_register(struct device *dev, struct rproc *rproc, + const struct of_phandle_args *tee_phandle); +int rproc_tee_unregister(struct device *dev, struct rproc *rproc); +int rproc_tee_parse_fw(struct rproc *rproc, const struct firmware *fw); +int rproc_tee_load_fw(struct rproc *rproc, const struct firmware *fw); +void rproc_tee_release_fw(struct rproc *rproc); +struct resource_table *rproc_tee_find_loaded_rsc_table(struct rproc *rproc, + const struct firmware *fw); +int rproc_tee_start(struct rproc *rproc); +int rproc_tee_stop(struct rproc *rproc); +#else + +static inline int rproc_tee_register(struct device *dev, struct rproc *rproc, + const struct of_phandle_args *tee_phandle) +{ + return -ENODEV; +} + +static inline int rproc_tee_parse_fw(struct rproc *rproc, const struct firmware *fw) +{ + /* This shouldn't be possible */ + WARN_ON(1); + + return 0; +} + +static inline int rproc_tee_unregister(struct device *dev, struct rproc *rproc) +{ + /* This shouldn't be possible */ + WARN_ON(1); + + return 0; +} + +static inline int rproc_tee_load_fw(struct rproc *rproc, const struct firmware *fw) +{ + /* This shouldn't be possible */ + WARN_ON(1); + + return 0; +} + +static inline int rproc_tee_start(struct rproc *rproc) +{ + /* This shouldn't be possible */ + WARN_ON(1); + + return 0; +} + +static inline int rproc_tee_stop(struct rproc *rproc) +{ + /* This shouldn't be possible */ + WARN_ON(1); + + return 0; +} + +static inline void rproc_tee_release_fw(struct rproc *rproc) +{ + /* This shouldn't be possible */ + WARN_ON(1); +} + +static inline struct resource_table * +rproc_tee_find_loaded_rsc_table(struct rproc *rproc, const struct firmware *fw) +{ + /* This shouldn't be possible */ + WARN_ON(1); + + return NULL; +} +#endif /* CONFIG_REMOTEPROC_TEE */ +#endif /* REMOTEPROC_TEE_H */ -- 2.43.0