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.pouliq...@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


Reply via email to