Dualcpu: Platform specific communication option
By setting the TFM_PLAT_SPECIFIC_MULTI_CORE_COMM cmake flag platform
specific implementation can be used to communicate between the Secure
and Non-secure cpu.
Change-Id: Ia966fa7150a709b75b6dfd1bce0d41135f287398
Signed-off-by: Mark Horvath <mark.horvath@arm.com>
diff --git a/secure_fw/spm/CMakeLists.txt b/secure_fw/spm/CMakeLists.txt
index 098c518..5348ce9 100755
--- a/secure_fw/spm/CMakeLists.txt
+++ b/secure_fw/spm/CMakeLists.txt
@@ -40,7 +40,7 @@
$<$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>:cmsis_psa/tfm_multi_core.c>
$<$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>:cmsis_psa/tfm_multi_core_mem_check.c>
$<$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>:cmsis_psa/tfm_rpc.c>
- $<$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>:cmsis_psa/tfm_spe_mailbox.c>
+ $<$<AND:$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>,$<NOT:$<BOOL:${TFM_PLAT_SPECIFIC_MULTI_CORE_COMM}>>>:cmsis_psa/tfm_spe_mailbox.c>
$<$<NOT:$<BOOL:${TFM_PSA_API}>>:ffm/tfm_core_mem_check.c>
$<$<BOOL:${TFM_PSA_API}>:cmsis_psa/arch/tfm_arch.c>
$<$<BOOL:${TFM_PSA_API}>:cmsis_psa/main.c>
diff --git a/secure_fw/spm/cmsis_psa/tfm_multi_core.c b/secure_fw/spm/cmsis_psa/tfm_multi_core.c
index 03a1afe..54b5da2 100644
--- a/secure_fw/spm/cmsis_psa/tfm_multi_core.c
+++ b/secure_fw/spm/cmsis_psa/tfm_multi_core.c
@@ -1,14 +1,14 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2021, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "tfm_arch.h"
#include "tfm_assert.h"
-#include "tfm_spe_mailbox.h"
#include "tfm_spm_hal.h"
#include "tfm_spm_log.h"
+#include "tfm_multi_core.h"
#define DEFAULT_NS_CLIENT_ID (-1)
@@ -27,7 +27,7 @@
tfm_spm_hal_boot_ns_cpu(tfm_spm_hal_get_ns_VTOR());
tfm_spm_hal_wait_for_ns_cpu_ready();
- tfm_mailbox_init();
+ tfm_inter_core_comm_init();
/*
* TODO
diff --git a/secure_fw/spm/cmsis_psa/tfm_multi_core.h b/secure_fw/spm/cmsis_psa/tfm_multi_core.h
index 0cf4ba2..87c8bc7 100644
--- a/secure_fw/spm/cmsis_psa/tfm_multi_core.h
+++ b/secure_fw/spm/cmsis_psa/tfm_multi_core.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2021, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -89,4 +89,12 @@
*/
int32_t tfm_has_access_to_region(const void *p, size_t s, uint32_t attr);
+/**
+ * \brief Initialization of the multi core communication.
+ *
+ * \retval 0 Operation succeeded.
+ * \retval Other return code Operation failed with an error code.
+ */
+int32_t tfm_inter_core_comm_init(void);
+
#endif /* __TFM_MULTI_CORE_H__ */
diff --git a/secure_fw/spm/cmsis_psa/tfm_spe_mailbox.c b/secure_fw/spm/cmsis_psa/tfm_spe_mailbox.c
index fe30726..5580169 100644
--- a/secure_fw/spm/cmsis_psa/tfm_spe_mailbox.c
+++ b/secure_fw/spm/cmsis_psa/tfm_spe_mailbox.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2021, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -12,6 +12,7 @@
#include "utilities.h"
#include "tfm_spe_mailbox.h"
#include "tfm_rpc.h"
+#include "tfm_multi_core.h"
#define NS_CALLER_FLAG (true)
@@ -404,3 +405,8 @@
return MAILBOX_SUCCESS;
}
+
+int32_t tfm_inter_core_comm_init(void)
+{
+ return tfm_mailbox_init();
+}