diff options
author | Peng Fan <peng.fan@nxp.com> | 2018-05-31 13:51:23 +0800 |
---|---|---|
committer | Anson Huang <Anson.Huang@nxp.com> | 2019-12-13 10:41:29 +0800 |
commit | 6c03b183c37e476075367e63de5a6d3f245541af (patch) | |
tree | f26e35cddc1033b4921c45b33e7f6fedccc087f5 | |
parent | 451058b8cb7b3b60bde87d6a17194323fd42b52c (diff) |
imx8qxp: move M4 to OS part at last
With default configuration, M4 and A35 in one partition, M4 is loaded by ROM.
"err = sc_rm_move_all(ipc_handle, secure_part, os_part, true, true);"
M4 core will first be moved to non-secure OS part, then the resource used
by M4 will be moved to non-secure OS part later. But before the resource be
moved to non-secure OS part, M4 core is still running, so a non-secure M4
core access a secure resource will trigger error in M4 side.
First mark M4 core as non-movable, after all other resoures moved to OS
part, move M4 to OS part. No need to check whether M4 is created a new
partition by SCFW, if a partition already created, the call to mark
M4 as non-removable will fail, because it M4 is in its own partition.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 44e209cb87f078abc78839c5e138aae5122ddd78)
-rw-r--r-- | plat/imx/imx8qx/imx8qx_bl31_setup.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/plat/imx/imx8qx/imx8qx_bl31_setup.c b/plat/imx/imx8qx/imx8qx_bl31_setup.c index bfe40528..f9f3b1a2 100644 --- a/plat/imx/imx8qx/imx8qx_bl31_setup.c +++ b/plat/imx/imx8qx/imx8qx_bl31_setup.c @@ -179,10 +179,30 @@ void imx8_partition_resources(void) secure_rsrcs[i], err); } + owned = sc_rm_is_resource_owned(ipc_handle, SC_R_M4_0_PID0); + if (owned) { + err = sc_rm_set_resource_movable(ipc_handle, SC_R_M4_0_PID0, + SC_R_M4_0_PID0, false); + if (err) + ERROR("sc_rm_set_resource_movable: rsrc %u, ret %u\n", + SC_R_M4_0_PID0, err); + } + /* move all movable resources and pins to non-secure partition */ err = sc_rm_move_all(ipc_handle, secure_part, os_part, true, true); if (err) ERROR("sc_rm_move_all: %u\n", err); + if (owned) { + err = sc_rm_set_resource_movable(ipc_handle, SC_R_M4_0_PID0, + SC_R_M4_0_PID0, true); + if (err) + ERROR("sc_rm_set_resource_movable: rsrc %u, ret %u\n", + SC_R_M4_0_PID0, err); + err = sc_rm_assign_resource(ipc_handle, os_part, SC_R_M4_0_PID0); + if (err) + ERROR("sc_rm_assign_resource: rsrc %u, ret %u\n", + SC_R_M4_0_PID0, err); + } /* iterate through peripherals to give NS OS part access */ for (i = 0; i < ARRAY_SIZE(ns_access_allowed); i++) { |