TEE-330-3: i.MX8QM: OP-TEE add share memory
Configure OP-TEE Share memory to be accessible by OS.
Signed-off-by: Silvano di Ninno <silvano.dininno@nxp.com>
(cherry picked from commit b2d0c8530c75bb77450372114229cadd8555780b)
diff --git a/plat/imx/imx8qm/imx8qm_bl31_setup.c b/plat/imx/imx8qm/imx8qm_bl31_setup.c
index ededfe9..a9688d1 100644
--- a/plat/imx/imx8qm/imx8qm_bl31_setup.c
+++ b/plat/imx/imx8qm/imx8qm_bl31_setup.c
@@ -221,8 +221,14 @@
if (err) {
ERROR("Memreg get info failed, %u\n", mr_tee);
} else {
- if ((BL32_LIMIT - 1) < end) {
- err = sc_rm_memreg_alloc(ipc_handle, &mr, BL32_LIMIT , end);
+#ifdef SPD_trusty
+ reg_start = BL32_LIMIT;
+#else
+ /* Allow share memory to be accessible by OS */
+ reg_start = BL32_LIMIT - BL32_SHM_SIZE;
+#endif
+ if ((reg_start -1) < end) {
+ err = sc_rm_memreg_alloc(ipc_handle, &mr, reg_start , end);
if (err) {
ERROR("sc_rm_memreg_alloc failed, 0x%llx -- 0x%llx\n", (sc_faddr_t)BL32_LIMIT, end);
} else {
@@ -273,8 +279,13 @@
}
#ifdef TEE_IMX8
if (mr_tee_atf_same) {
- if ((BL32_LIMIT - 1) < end) {
- reg_start = BL32_LIMIT;
+#ifdef SPD_trusty
+ reg_start = BL32_LIMIT;
+#else
+ /* Allow share memory to be accessible by OS */
+ reg_start = BL32_LIMIT - BL32_SHM_SIZE;
+#endif
+ if ((reg_start -1) < end) {
err = sc_rm_memreg_alloc(ipc_handle, &mr, reg_start, end);
if (err) {
ERROR("sc_rm_memreg_alloc failed, 0x%llx -- 0x%llx\n", reg_start, reg_end);
diff --git a/plat/imx/imx8qm/include/platform_def.h b/plat/imx/imx8qm/include/platform_def.h
index 17f9aae..bff9b00 100644
--- a/plat/imx/imx8qm/include/platform_def.h
+++ b/plat/imx/imx8qm/include/platform_def.h
@@ -43,6 +43,7 @@
#ifdef TEE_IMX8
#define BL32_BASE 0xfe000000
#define BL32_SIZE 0x02000000
+#define BL32_SHM_SIZE 0x00400000
#define BL32_LIMIT 0x100000000
#endif