devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
To: Bjorn Andersson <andersson@kernel.org>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	Jens Wiklander <jens.wiklander@linaro.org>,
	"Rob Herring" <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>
Cc: <linux-stm32@st-md-mailman.stormreply.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-remoteproc@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	<op-tee@lists.trustedfirmware.org>, <devicetree@vger.kernel.org>,
	Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Subject: [PATCH v3 2/7] remoteproc: Extract the firmware load from the start
Date: Wed, 14 Feb 2024 18:21:22 +0100	[thread overview]
Message-ID: <20240214172127.1022199-3-arnaud.pouliquen@foss.st.com> (raw)
In-Reply-To: <20240214172127.1022199-1-arnaud.pouliquen@foss.st.com>

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 <arnaud.pouliquen@foss.st.com>
---
 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);
 
-- 
2.25.1


  parent reply	other threads:[~2024-02-14 17:22 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-14 17:21 [PATCH v3 0/7] Introduction of a remoteproc tee to load signed firmware Arnaud Pouliquen
2024-02-14 17:21 ` [PATCH v3 1/7] remoteproc: Add TEE support Arnaud Pouliquen
2024-02-20 18:58   ` Mathieu Poirier
2024-02-21  8:39     ` Arnaud POULIQUEN
2024-02-22  5:42   ` Naman Jain
2024-02-23 18:27   ` Mathieu Poirier
2024-02-28  8:20     ` Arnaud POULIQUEN
2024-02-29 16:19       ` Mathieu Poirier
2024-02-29 18:26         ` Arnaud POULIQUEN
2024-02-14 17:21 ` Arnaud Pouliquen [this message]
2024-02-14 17:21 ` [PATCH v3 3/7] remoteproc: core: Add check on cached_table pointer Arnaud Pouliquen
2024-02-23 18:32   ` Mathieu Poirier
2024-02-14 17:21 ` [PATCH v3 4/7] remoteproc: core: Implement the support of an alternative boot Arnaud Pouliquen
2024-02-14 17:21 ` [PATCH v3 5/7] dt-bindings: remoteproc: Add compatibility for TEE support Arnaud Pouliquen
2024-02-22 18:24   ` Rob Herring
2024-02-14 17:21 ` [PATCH v3 6/7] remoteproc: stm32: Create sub-functions to request shutdown and release Arnaud Pouliquen
2024-02-14 17:21 ` [PATCH v3 7/7] remoteproc: stm32: Add support of an OP-TEE TA to load the firmware Arnaud Pouliquen
2024-02-22 19:02   ` Mathieu Poirier
2024-02-23 13:54     ` Arnaud POULIQUEN
2024-02-23 18:37       ` Mathieu Poirier
2024-02-29 18:16         ` Arnaud POULIQUEN
2024-02-22  5:43 ` [PATCH v3 0/7] Introduction of a remoteproc tee to load signed firmware Naman Jain
2024-02-22  8:47   ` Arnaud POULIQUEN
2024-02-22  9:55     ` Naman Jain
2024-02-23 14:10       ` Arnaud POULIQUEN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240214172127.1022199-3-arnaud.pouliquen@foss.st.com \
    --to=arnaud.pouliquen@foss.st.com \
    --cc=andersson@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jens.wiklander@linaro.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mathieu.poirier@linaro.org \
    --cc=op-tee@lists.trustedfirmware.org \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).