aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSughosh Ganu <sughosh.ganu@linaro.org>2019-08-07 11:45:55 +0530
committerSughosh Ganu <sughosh.ganu@arm.com>2019-08-14 17:39:28 +0530
commit770d793fa5b3cb6e6414cdbab935bbb3761d2754 (patch)
tree37461be4a0f806a23beba2dba8e9280f07422316
parent5119fa7b8d674d8ae6466836c0687433f8e1694d (diff)
opteed: Add support for MM interface calls in optee dispatchermm_calls_via_opteed
Add changes in the optee dispatcher component to support Management Mode(MM) interface smc calls. These smc calls would be used to communicate with the Secure Partition component like StandaloneMm which is executing in the Secure world. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
-rw-r--r--bl31/bl31.mk2
-rw-r--r--include/lib/optee_utils.h9
-rw-r--r--include/services/mm_svc.h11
-rw-r--r--make_helpers/defaults.mk2
-rw-r--r--plat/qemu/platform.mk2
-rw-r--r--services/spd/opteed/opteed_main.c2
-rw-r--r--services/std_svc/std_svc_setup.c9
7 files changed, 34 insertions, 3 deletions
diff --git a/bl31/bl31.mk b/bl31/bl31.mk
index c9ba926c5..8f0cfbe1a 100644
--- a/bl31/bl31.mk
+++ b/bl31/bl31.mk
@@ -91,7 +91,9 @@ endif
$(eval $(call assert_boolean,CRASH_REPORTING))
$(eval $(call assert_boolean,EL3_EXCEPTION_HANDLING))
$(eval $(call assert_boolean,SDEI_SUPPORT))
+$(eval $(call assert_boolean,SPD_OPTEED))
$(eval $(call add_define,CRASH_REPORTING))
$(eval $(call add_define,EL3_EXCEPTION_HANDLING))
$(eval $(call add_define,SDEI_SUPPORT))
+$(eval $(call add_define,SPD_OPTEED))
diff --git a/include/lib/optee_utils.h b/include/lib/optee_utils.h
index 6067caff4..f616342d4 100644
--- a/include/lib/optee_utils.h
+++ b/include/lib/optee_utils.h
@@ -13,4 +13,13 @@ int parse_optee_header(entry_point_info_t *header_ep,
image_info_t *pager_image_info,
image_info_t *paged_image_info);
+uintptr_t opteed_smc_handler(uint32_t smc_fid,
+ u_register_t x1,
+ u_register_t x2,
+ u_register_t x3,
+ u_register_t x4,
+ void *cookie,
+ void *handle,
+ u_register_t flags);
+
#endif /* OPTEE_UTILS_H */
diff --git a/include/services/mm_svc.h b/include/services/mm_svc.h
index c11132696..3723a488d 100644
--- a/include/services/mm_svc.h
+++ b/include/services/mm_svc.h
@@ -7,7 +7,7 @@
#ifndef MM_SVC_H
#define MM_SVC_H
-#if SPM_MM
+#if SPM_MM || SPD_OPTEED
#include <lib/utils_def.h>
@@ -30,6 +30,13 @@
#define MM_COMMUNICATE_AARCH64 U(0xC4000041)
#define MM_COMMUNICATE_AARCH32 U(0x84000041)
-#endif /* SPM_MM */
+#define MM_FID_MASK U(0xffff)
+#define MM_FID_MIN_VALUE U(0x40)
+#define MM_FID_MAX_VALUE U(0x41)
+#define is_mm_comm_fid(_fid) \
+ ((((_fid) & MM_FID_MASK) >= MM_FID_MIN_VALUE) && \
+ (((_fid) & MM_FID_MASK) <= MM_FID_MAX_VALUE))
+
+#endif /* SPM_MM || SPD_OPTEED */
#endif /* MM_SVC_H */
diff --git a/make_helpers/defaults.mk b/make_helpers/defaults.mk
index f63e46f39..dfec2da21 100644
--- a/make_helpers/defaults.mk
+++ b/make_helpers/defaults.mk
@@ -175,6 +175,8 @@ RECLAIM_INIT_CODE := 0
# SPD choice
SPD := none
+SPD_OPTEED := 0
+
# For including the Secure Partition Manager
ENABLE_SPM := 0
diff --git a/plat/qemu/platform.mk b/plat/qemu/platform.mk
index 6b9749c79..dfe94f3d5 100644
--- a/plat/qemu/platform.mk
+++ b/plat/qemu/platform.mk
@@ -184,3 +184,5 @@ $(eval $(call add_define,BL32_RAM_LOCATION_ID))
# Do not enable SVE
ENABLE_SVE_FOR_NS := 0
+
+SPD_OPTEED := 1
diff --git a/services/spd/opteed/opteed_main.c b/services/spd/opteed/opteed_main.c
index 160a693b2..3926cbef5 100644
--- a/services/spd/opteed/opteed_main.c
+++ b/services/spd/opteed/opteed_main.c
@@ -188,7 +188,7 @@ static int32_t opteed_init(void)
* state. Lastly it will also return any information that OPTEE needs to do
* the work assigned to it.
******************************************************************************/
-static uintptr_t opteed_smc_handler(uint32_t smc_fid,
+uintptr_t opteed_smc_handler(uint32_t smc_fid,
u_register_t x1,
u_register_t x2,
u_register_t x3,
diff --git a/services/std_svc/std_svc_setup.c b/services/std_svc/std_svc_setup.c
index 1d80fa343..e50ee7d93 100644
--- a/services/std_svc/std_svc_setup.c
+++ b/services/std_svc/std_svc_setup.c
@@ -10,9 +10,11 @@
#include <common/debug.h>
#include <common/runtime_svc.h>
#include <lib/el3_runtime/cpu_data.h>
+#include <lib/optee_utils.h>
#include <lib/pmf/pmf.h>
#include <lib/psci/psci.h>
#include <lib/runtime_instr.h>
+#include <services/mm_svc.h>
#include <services/sdei.h>
#include <services/spm_svc.h>
#include <services/std_svc.h>
@@ -121,6 +123,13 @@ static uintptr_t std_svc_smc_handler(uint32_t smc_fid,
}
#endif
+#if SPD_OPTEED
+ if (is_mm_comm_fid(smc_fid)) {
+ return opteed_smc_handler(smc_fid, x1, x2, x3, x4, cookie,
+ handle, flags);
+ }
+#endif
+
switch (smc_fid) {
case ARM_STD_SVC_CALL_COUNT:
/*