Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2928890lqo; Tue, 21 May 2024 01:12:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWuJZKpvKvzcfWXTZ3zuvLmxq/z6xW/veRBLWFEKMRsO8ymOxIhZ6po9zTgrQCU0ivp/tB9oIQil9U0SjdiaNg8vXZGwtRftBWrfxJewg== X-Google-Smtp-Source: AGHT+IGSH+MepWc6ILn7myp6JiLJ/5Kf8YfG1XzCfsIjuWhguZotyXuEwjXaGX/+LBRDrAYzzzpa X-Received: by 2002:a05:6a00:2e11:b0:6f3:e6dc:5484 with SMTP id d2e1a72fcca58-6f4e029bddemr36236420b3a.6.1716279163395; Tue, 21 May 2024 01:12:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716279163; cv=pass; d=google.com; s=arc-20160816; b=RpHWdBtAAHiscHLFsESnFDwuBcJyodMv79Mc4X4DLhEdvFqvgDJ4IysQo3Wm4hhiUr y35oc2m98hMbA+aaDc+BqFX3xisE+twMes5vAz3sxzdhfnKhuINxXU52DjTGd5N7zpE5 xqM0ksnXnla0LlPJ2ZeKPm8LTycdphcFfvpqb5c0udv81GtCEMhu9anch4HCHk423hNZ 1bgD1eLPBVnLUqgIo0/kN9ZMnpnXjXfpaiMl/f/DfhGC/zU2yAxUazFGoNA4W3RIqbii vFdcYHMMh9Vfs/L8MoHCDppgGBBIZtJ+BXe8LrPU1nnIHyW91DVZglnOJkY2JE3jJ4Zt Dotg== ARC-Message-Signature: i=2; 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=r1c6L8Joj9/3Y2Gzu38mfrsCUic2tjpvOTpujp6f5UU=; fh=BmUATlDGZqfVcf9e+weO/u7Pa1hPMaSww1TRE+r23OE=; b=Fx72shfTQtdZvBIFU9AhJzxr7UXIZPZB4+RiTGofgtbNrTU85bMUbPO+LrdPRBIUHW 6neBhUK0cXd8bhXvq9L0G33aW1HI+kib49KtTfjHhJqqu6GERWG6VsK47YKa8/+mHjMz eoOAHllorHU8J4RMwrEySEk2WHgclwdr7aITtsuOhMPh5eGNDtArCyRPlOyuT1PS3o17 AUTwC0g4Oo8JkC4bwGIXiC1QzviftVW+8wRVcNiR4xgdyUSlyWUizFqk1/FcQGd1ytfd v0UISW8JVXh6f90ebceIvVDhtdKW6n2wtGuv3ma7XEYb1T3w0L8HCi5GJH//eEld7+H8 LdfA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b="y/TNH7bR"; arc=pass (i=1 spf=pass spfdomain=foss.st.com dkim=pass dkdomain=foss.st.com dmarc=pass fromdomain=foss.st.com); spf=pass (google.com: domain of linux-kernel+bounces-184622-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184622-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f668d19dd9si14323075b3a.306.2024.05.21.01.12.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 01:12:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-184622-linux.lists.archive=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="y/TNH7bR"; arc=pass (i=1 spf=pass spfdomain=foss.st.com dkim=pass dkdomain=foss.st.com dmarc=pass fromdomain=foss.st.com); spf=pass (google.com: domain of linux-kernel+bounces-184622-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184622-linux.lists.archive=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 3FF052831C7 for ; Tue, 21 May 2024 08:11:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A753456760; Tue, 21 May 2024 08:11:03 +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="y/TNH7bR" Received: from mx07-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 9374854662; Tue, 21 May 2024 08:11:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.207.212.93 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716279062; cv=none; b=nladd5BltMVG9uMhRbuyc5IonsbKK803EF6WgaLUw4hu3JinQcDeijm/JU2oOfowrEYhF9uU4jyyV4OOnnuYI2pAtRAgNxhgHwF3+wtj9TVaqyII1Q04dHSHObs4Ko7ENFhhNnLMDxM+zWCoPbOy1ikgtr3h/tX7DUh6flRqFXU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716279062; c=relaxed/simple; bh=w5ZVhkNqsWSHnsReZdJv8Md0glaGrOXZLkGJT0DkAn4=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=hCP4t74siHzNtm7loZHdSP5l+RoRCO+Mv6FMcxyYps3uuyJRXmzJR68R4LPlAWHcHka58FnhDPoK8TuNX5Tvpz+3LjgNNlxw9Bnu64q79pYSk/Q3VAUKot04xR2xxc/vqW/vASj7gRITnP5W0LaPjyBNatGFt8Sa47C7tgu0AX8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com; spf=pass smtp.mailfrom=foss.st.com; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b=y/TNH7bR; arc=none smtp.client-ip=91.207.212.93 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 (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44L2MO6X006477; Tue, 21 May 2024 10:10:44 +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=r1c6L8J oj9/3Y2Gzu38mfrsCUic2tjpvOTpujp6f5UU=; b=y/TNH7bRcULTZ5P/Q49ekDI atywE7gYA8zEBIJpXMnwl663tTqvGJotmwTF+6dgHk3o8QCO1yQNIJQ8cyhuMSDl /yuIL9mIghEFDdWdSQdtYseRUGs7vW46qsV/d0gS6OGL2pLtdVcPDmV3Odf/Gm4r eygIVVovjYm4sQgAMj9roscAv4kXF/eZErkzsgoLSskzVzvGAF/n4QET+5ozF8w4 PaFnEgOtD7VCcFKhphWDPQ+tvC59dnbQQoAuULpZkwliIqY9yLcsr025jdqmNw/G IJFBklPom/6WcOd0OFO2lzBCXFY1sC1hePi39T5guxX1wsfWQeWFV5fafPH3yZg= = Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3y6n6hjf4a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 10:10:43 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id F3A4040047; Tue, 21 May 2024 10:10:31 +0200 (CEST) Received: from Webmail-eu.st.com (eqndag1node6.st.com [10.75.129.135]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 027AE21194A; Tue, 21 May 2024 10:10:11 +0200 (CEST) Received: from SAFDAG1NODE1.st.com (10.75.90.17) by EQNDAG1NODE6.st.com (10.75.129.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 21 May 2024 10:10:10 +0200 Received: from localhost (10.48.86.121) by SAFDAG1NODE1.st.com (10.75.90.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 21 May 2024 10:10:10 +0200 From: Arnaud Pouliquen To: Bjorn Andersson , Mathieu Poirier CC: , , , Subject: [PATCH v5 0/7] Introduction of a remoteproc tee to load signed firmware Date: Tue, 21 May 2024 10:09:54 +0200 Message-ID: <20240521081001.2989417-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 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SAFCAS1NODE2.st.com (10.75.90.13) To SAFDAG1NODE1.st.com (10.75.90.17) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-21_04,2024-05-21_01,2024-05-17_01 Main updates from the previous version [1]: ------------------------------------------ 1) use proc->table_ptr as unique reference to point to the resource table --> update remoteproc_core.c to implement management of the resource table base on rproc->rproc->tee_interface new field: - on start get the resource table address from TEE remoteproc instead of finding it in firmware (ops choice to confirm) - on stop unmap the resource table before updating the proc->table_ptr pointer. 2) retrieve the TEE rproc Identifier from the device tree instead of hardcoding it --> Add a new "st,proc-id" property in device tree. More details on updates are listed in commits messages [1] https://lore.kernel.org/linux-arm-kernel/20240115135249.296822-1-arnaud.pouliquen@foss.st.com/T/#m9ebb2e8f6d5e90f055827e4f227ce0877bc6d761 base-commit: c8d8f841e95bcc07ac8c5621fc171a24f1fd5cdb Description of the feature: -------------------------- 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 (7): remoteproc: Add TEE support dt-bindings: remoteproc: Add compatibility for TEE support dt-bindings: remoteproc: Add processor identifier property remoteproc: core introduce rproc_set_rsc_table_on_start function remoteproc: core: support of the tee interface 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 | 58 ++- drivers/remoteproc/Kconfig | 10 + drivers/remoteproc/Makefile | 1 + drivers/remoteproc/remoteproc_core.c | 135 +++--- drivers/remoteproc/stm32_rproc.c | 149 ++++-- drivers/remoteproc/tee_remoteproc.c | 429 ++++++++++++++++++ include/linux/remoteproc.h | 4 + include/linux/tee_remoteproc.h | 99 ++++ 8 files changed, 784 insertions(+), 101 deletions(-) create mode 100644 drivers/remoteproc/tee_remoteproc.c create mode 100644 include/linux/tee_remoteproc.h -- 2.25.1