From patchwork Wed Feb 14 17:21:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Pouliquen X-Patchwork-Id: 13556831 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 E59EEC48BC1 for ; Wed, 14 Feb 2024 17:22:56 +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:References:In-Reply-To: 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: List-Owner; bh=LFBBiVi4OW81iXY5M05sNOUcjh9ruopiE9lxK20UHds=; b=gc3m5tTEPzKXnm bfjmcSYYTJk5KQRlcPWpCGDrhXzAizbKv5y65oBcD0hb0NJWJConDyUopFs0xTgVesuooqZzKI4Ni C1uBOqR/3z+PitsPm9MjB+AxfctAmnwOZKf/y+ozBorwYQSOY7CcYJclaSrFVbvVflpeivuSgs0wo 6qLFRjBdDLdl7K6BR8xZ5p2HfJSDcL2ylhXhbsm88V3UxuPyaMtmb9J5mqn7AWFkZ3jucQ0Qan+U6 nwNasgWmhsuc/GGMSnCk3R1j6PavN3izYCd3QMn9qWRMmFS6J+06jMTJsx3GzklotvOT43qMnWOIT Kl8wfiXCfuw+BLu3G2vQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1raIy4-0000000Dh8v-3OL4; Wed, 14 Feb 2024 17:22:44 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1raIxt-0000000Dh1l-3WYs for linux-arm-kernel@lists.infradead.org; Wed, 14 Feb 2024 17:22:36 +0000 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 41ED58rC027428; Wed, 14 Feb 2024 18:22:22 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= selector1; bh=qBtgOyq14dsl5L0CUVufOoZV2xCltEiuqjmF3gmRqZM=; b=oX XFiV+5xGSmCtA5NmSoHOCaSPaLwTxGxZlFK/YhIO0zQyxjglHU50wBeMRMNORau/ raLvy48cot9DbKrs6dr3FYyE2K2+k/FVq+x73c3BacEPMvD9EVvrzf5hXKXVgDMA Men5H+fpuVa0H6W1uIQaV7EAicfYrKBkx9K0No/FEcNiK16sWfYtKUgXIke4rRUt 3+5eUpOzItxnBrhMkIoa+OQYQIuYQ0PgDdMny4zZtSsnWzDfZbzbtrhTIdQ4pMaN Xku5IPFOYl3+9tFX9Daf7HLPOhwHgMZXvuBgQ2YkG8vTNctbwdy8kielNeBuNJ9l j6JScewlezYm2Bk8uXdA== 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 3w6mynnh06-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 14 Feb 2024 18:22:22 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 5054940048; Wed, 14 Feb 2024 18:22:19 +0100 (CET) Received: from Webmail-eu.st.com (eqndag1node5.st.com [10.75.129.134]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id ED61A2CA548; Wed, 14 Feb 2024 18:21:32 +0100 (CET) Received: from SAFDAG1NODE1.st.com (10.75.90.17) by EQNDAG1NODE5.st.com (10.75.129.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Wed, 14 Feb 2024 18:21:32 +0100 Received: from localhost (10.201.20.75) 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.27; Wed, 14 Feb 2024 18:21:32 +0100 From: Arnaud Pouliquen To: Bjorn Andersson , Mathieu Poirier , Jens Wiklander , "Rob Herring" , Krzysztof Kozlowski , Conor Dooley CC: , , , , , , Arnaud Pouliquen Subject: [PATCH v3 2/7] remoteproc: Extract the firmware load from the start Date: Wed, 14 Feb 2024 18:21:22 +0100 Message-ID: <20240214172127.1022199-3-arnaud.pouliquen@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240214172127.1022199-1-arnaud.pouliquen@foss.st.com> References: <20240214172127.1022199-1-arnaud.pouliquen@foss.st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.20.75] 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.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-14_10,2024-02-14_01,2023-05-22_02 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240214_092234_249136_7E493186 X-CRM114-Status: GOOD ( 14.62 ) 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 With the introduction of tee_remoteproc, the firmware has to be loaded first before parsing the resource table. This constraint is linked to the firmware authentication, that contains the resource table. In OP-TEE, this authentication is correlated with the load of the firmware (the loaded segments authenticated after being copied to the destination memory). Removing rproc_load_segments will allow it to be called earlier in the boot sequence. Signed-off-by: Arnaud Pouliquen --- drivers/remoteproc/remoteproc_core.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 695cce218e8c..283ca071e35c 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1269,13 +1269,6 @@ static int rproc_start(struct rproc *rproc, const struct firmware *fw) struct device *dev = &rproc->dev; int ret; - /* load the ELF segments to memory */ - ret = rproc_load_segments(rproc, fw); - if (ret) { - dev_err(dev, "Failed to load program segments: %d\n", ret); - return ret; - } - /* * The starting device has been given the rproc->cached_table as the * resource table. The address of the vring along with the other @@ -1430,6 +1423,13 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw) goto clean_up_resources; } + /* load the ELF segments to memory */ + ret = rproc_load_segments(rproc, fw); + if (ret) { + dev_err(dev, "Failed to load program segments: %d\n", ret); + return ret; + } + ret = rproc_start(rproc, fw); if (ret) goto clean_up_resources; @@ -1808,6 +1808,13 @@ static int rproc_boot_recovery(struct rproc *rproc) return ret; } + /* load the ELF segments to memory */ + ret = rproc_load_segments(rproc, firmware_p); + if (ret) { + dev_err(dev, "Failed to load program segments: %d\n", ret); + return ret; + } + /* boot the remote processor up again */ ret = rproc_start(rproc, firmware_p);