From patchwork Mon Jan 15 13:52:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud POULIQUEN X-Patchwork-Id: 19037 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2614:b0:101:6a76:bbe3 with SMTP id mm20csp1714287dyc; Mon, 15 Jan 2024 05:54:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IHx4L1VWZ34alv3XuZ+VuU0vg6JErkudDB0af9t0GVOwNv2FOUhz1Z9iqOjCV1Fu65/jTcJ X-Received: by 2002:a92:d481:0:b0:35f:f028:2cad with SMTP id p1-20020a92d481000000b0035ff0282cadmr5090525ilg.89.1705326889965; Mon, 15 Jan 2024 05:54:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705326889; cv=none; d=google.com; s=arc-20160816; b=PJoG5I+8+GNqWq6giMG5zFYOf+IeyWrVK3s270ALGrATggwnt+5RkuYEWpvk0GEWvd m8Eq6muaqDaATorm7bqj3j6ULP3zInucVE268Nx/8+6K2FiYZuOrAxBVy2Wy9ZA2U4P0 9S3Mew82n8B42iwYST6wSdZZ6sgDEta2sAyAXeu+NANu+7yq4CpmPm1UaHBeDjbxk1n3 67+7d2GkxSvb+ijdnFpus1eBjQGI4DP8TzsU8ecqsNcWUqkbfdMY0k3GXK1sEaLg99im MK7yqCVw26z5nhkl0h4AWQCQ9ZoaRuzw79m2DmsWKmsATpWbVtwMBgOvqXvNFDZiOvns MdZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=67cmOx7TvVcSfr8UKMpeA5zcNKzOnMvUJktBewgQwzo=; fh=v3NBvV5+vj//chOYHzS5ZDleqozbh7nyGvHDjEWDUSE=; b=JfTmbTtCJ1S6jbQs+Kik5m2DQ8cAbPEaDXGNG2huXjlBg5wdQD4YsUB+zjNyJl5LUD WpwxFHL552U1tY13Jdir+o7P9qbDWzKQFQymkKxVvGC2XlarPXd5mCB5p7C7+YoVuNal 5gTHTgZucoSHSplbRO/SLYR7mw4ks4mWsKZ5N7NhrC+1+g1s2GBVPkv4D1jsRGNeOEgr sqJ8K3DelRclPsKOT2ve0tk7wF11MBEBqxB4RlkWVPt9Vye0TH+pQ653OD9DY9+TZZ99 uLvdYPjFF0RdE+NmvfqwtnmT3VuzAFSS5MkZO3JLfBuKo1i0sAdl+wF/6nDOAJ/xgc9f /TNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=iVQpvXjr; spf=pass (google.com: domain of linux-kernel+bounces-26055-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26055-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id m129-20020a633f87000000b005ce0cf4a959si9123282pga.560.2024.01.15.05.54.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 05:54:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26055-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=iVQpvXjr; spf=pass (google.com: domain of linux-kernel+bounces-26055-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26055-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 88EFB2818A5 for ; Mon, 15 Jan 2024 13:54:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DD4D4175AE; Mon, 15 Jan 2024 13:54:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="iVQpvXjr" Received: from mx08-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A3F70171D2; Mon, 15 Jan 2024 13:54:18 +0000 (UTC) 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 Received: from pps.filterd (m0369457.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40FDrXmG021289; Mon, 15 Jan 2024 14:53:58 +0100 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=67cmOx7 TvVcSfr8UKMpeA5zcNKzOnMvUJktBewgQwzo=; b=iVQpvXjrVER3Ok0BtkQqijQ WqWy1LOPiwQpaU+gKeneRPvND/1jbRX+tpBfcx7ES4AK9jODHXKopMuoOKQSX0el SZkMXEWvnxvvqmq5VSO0TSED/Miu6X+SsVBPu0VvKH6ZEoxC1UoVVLkIDc5WsgVW yb+r7XldOKd0p6H9Fh9Px4IrPyVdDqdnfA3ZLKJEmDb4YskPLMBsZyKi+Qu0K+Ee EnAsK+6x4zRaXCHrxZvKu6/Ei9CgYa1GD+5cNqJxnm1E2121hTeH5RNWOEOh5OgE bvWmGpqZkwXCzD3EW63lePTBuMnP+EIijblAI8uepR10/CTLS/oKy5XPTX2/bUg= = 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 3vm6bnx8m9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 15 Jan 2024 14:53:58 +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 CE22510002A; Mon, 15 Jan 2024 14:53:56 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node2.st.com [10.75.129.70]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id C285628EF7F; Mon, 15 Jan 2024 14:53:56 +0100 (CET) Received: from localhost (10.201.20.75) by SHFDAG1NODE2.st.com (10.75.129.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 15 Jan 2024 14:53:56 +0100 From: Arnaud Pouliquen To: Bjorn Andersson , Mathieu Poirier , Jens Wiklander , Rob Herring , Krzysztof Kozlowski , Conor Dooley CC: , , , , , , Arnaud Pouliquen Subject: [PATCH 0/4] Introduction of a remoteproc tee to load signed firmware Date: Mon, 15 Jan 2024 14:52:45 +0100 Message-ID: <20240115135249.296822-1-arnaud.pouliquen@foss.st.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: EQNCAS1NODE3.st.com (10.75.129.80) To SHFDAG1NODE2.st.com (10.75.129.70) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-05_08,2024-01-05_01,2023-05-22_02 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788164848529872275 X-GMAIL-MSGID: 1788164848529872275 This series proposes the implementation of a remoteproc tee driver to communicate with a TEE trusted application responsible for authenticating and loading the remoteproc firmware image in an Arm secure context. 1) Principle: The remoteproc tee driver provides services to communicate with the OP-TEE trusted application running on the Trusted Execution Context (TEE). The trusted application in TEE manages the remote processor lifecycle: - authenticating and loading firmware images, - isolating and securing the remote processor memories, - supporting multi-firmware (e.g., TF-M + Zephyr on a Cortex-M33), - managing the start and stop of the firmware by the TEE. 2) Format of the signed image: Refer to: https://github.com/OP-TEE/optee_os/blob/master/ta/remoteproc/src/remoteproc_core.c#L18-L57 3) OP-TEE trusted application API: Refer to: https://github.com/OP-TEE/optee_os/blob/master/ta/remoteproc/include/ta_remoteproc.h 4) OP-TEE signature script Refer to: https://github.com/OP-TEE/optee_os/blob/master/scripts/sign_rproc_fw.py Example of usage: sign_rproc_fw.py --in --in --out --key ${OP-TEE_PATH}/keys/default.pem 5) Impact on User space Application No sysfs impact.the user only needs to provide the signed firmware image instead of the ELF image. For more information about the implementation, a presentation is available here (note that the format of the signed image has evolved between the presentation and the integration in OP-TEE). https://resources.linaro.org/en/resource/6c5bGvZwUAjX56fvxthxds Arnaud Pouliquen (4): remoteproc: Add TEE support dt-bindings: remoteproc: add compatibility for TEE support remoteproc: stm32: create sub-functions to request shutdown and release remoteproc: stm32: Add support of an OP-TEE TA to load the firmware .../bindings/remoteproc/st,stm32-rproc.yaml | 53 ++- drivers/remoteproc/Kconfig | 10 + drivers/remoteproc/Makefile | 1 + drivers/remoteproc/stm32_rproc.c | 233 +++++++++-- drivers/remoteproc/tee_remoteproc.c | 393 ++++++++++++++++++ include/linux/tee_remoteproc.h | 99 +++++ 6 files changed, 742 insertions(+), 47 deletions(-) create mode 100644 drivers/remoteproc/tee_remoteproc.c create mode 100644 include/linux/tee_remoteproc.h