Twincpu: Add generic multi-core specific functions implementations

Add multi-core specific implementations of the following functions
- tfm_nspm_thread_entry()
- Dummy tfm_nspm_configure_clients() and
  tfm_nspm_get_current_client_id()
- Dummy tfm_psa_ipc_request_handler()

Change-Id: I8bf6d7cae36b7f1ec93e9d12abac91b5b54762f5
Signed-off-by: David Hu <david.hu@arm.com>
diff --git a/secure_fw/core/ipc/CMakeLists.inc b/secure_fw/core/ipc/CMakeLists.inc
index bf9ecb5..0902d4c 100644
--- a/secure_fw/core/ipc/CMakeLists.inc
+++ b/secure_fw/core/ipc/CMakeLists.inc
@@ -46,7 +46,6 @@
 			"${SS_IPC_DIR}/../tfm_spm_services.c"
 			"${SS_IPC_DIR}/../tfm_utils.c"
 			"${SS_IPC_DIR}/../tfm_core_svcalls_ipc.c"
-			"${SS_IPC_DIR}/../tfm_nspm_ipc.c"
 			"${SS_IPC_DIR}/../tfm_boot_data.c"
 			"${SS_IPC_DIR}/../tfm_core_mem_check.c"
 			"${SS_IPC_DIR}/../tfm_core_log.c"
@@ -57,7 +56,10 @@
 	if (DEFINED TFM_MULTI_CORE_TOPOLOGY AND TFM_MULTI_CORE_TOPOLOGY)
 		list(APPEND SS_IPC_C_SRC "${SS_IPC_DIR}/tfm_rpc.c"
 				"${SS_IPC_DIR}/tfm_spe_mailbox.c"
+				"${SS_IPC_DIR}/tfm_multi_core.c"
 				)
+	else ()
+		list(APPEND SS_IPC_C_SRC "${SS_IPC_DIR}/../tfm_nspm_ipc.c")
 	endif ()
 endif()
 
diff --git a/secure_fw/core/ipc/tfm_multi_core.c b/secure_fw/core/ipc/tfm_multi_core.c
new file mode 100644
index 0000000..62f56eb
--- /dev/null
+++ b/secure_fw/core/ipc/tfm_multi_core.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include "platform/include/tfm_spm_hal.h"
+#include "psa/client.h"
+#include "secure_utilities.h"
+#include "tfm_internal.h"
+#include "tfm_nspm.h"
+#include "tfm_spe_mailbox.h"
+#include "tfm_utils.h"
+
+#define DEFAULT_NS_CLIENT_ID            (-1)
+
+void tfm_nspm_configure_clients(void)
+{
+}
+
+int32_t tfm_nspm_get_current_client_id(void)
+{
+    return DEFAULT_NS_CLIENT_ID;
+}
+
+psa_status_t tfm_nspm_thread_entry(void)
+{
+#ifdef TFM_CORE_DEBUG
+    /* Boot up non-secure core */
+    LOG_MSG("Enabling non-secure core...");
+#endif
+
+    tfm_spm_hal_boot_ns_cpu(tfm_spm_hal_get_ns_VTOR());
+    tfm_spm_hal_wait_for_ns_cpu_ready();
+
+    tfm_mailbox_init();
+
+    /*
+     * TODO
+     * The infinite-loop can be replaced with low-power sleep and resume
+     * operation. It may require privileged access to platform specific
+     * hardware.
+     */
+    while (1) {
+    }
+
+    /* Should not run here */
+    return PSA_SUCCESS;
+}
+
+void tfm_psa_ipc_request_handler(const uint32_t svc_args[])
+{
+    (void)svc_args;
+
+    /* Should not receive any request from ns-callable in multi-core topology */
+    tfm_panic();
+}
diff --git a/secure_fw/services/tfm_spm_db.inc b/secure_fw/services/tfm_spm_db.inc
index d0dd9ae..594e1f7 100644
--- a/secure_fw/services/tfm_spm_db.inc
+++ b/secure_fw/services/tfm_spm_db.inc
@@ -422,7 +422,11 @@
     {
         .partition_id         = TFM_SP_NON_SECURE_ID,
 #ifdef TFM_PSA_API
+#if TFM_MULTI_CORE_TOPOLOGY
+        .partition_flags      = SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_IPC,
+#else
         .partition_flags      = SPM_PART_FLAG_APP_ROT | SPM_PART_FLAG_IPC,
+#endif
         .partition_priority   = TFM_PRIORITY_LOW,
         .partition_init       = tfm_nspm_thread_entry,
 #else
diff --git a/secure_fw/services/tfm_spm_db.inc.template b/secure_fw/services/tfm_spm_db.inc.template
index f58dd30..c3bb13c 100644
--- a/secure_fw/services/tfm_spm_db.inc.template
+++ b/secure_fw/services/tfm_spm_db.inc.template
@@ -133,7 +133,11 @@
     {
         .partition_id         = TFM_SP_NON_SECURE_ID,
 #ifdef TFM_PSA_API
+#if TFM_MULTI_CORE_TOPOLOGY
+        .partition_flags      = SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_IPC,
+#else
         .partition_flags      = SPM_PART_FLAG_APP_ROT | SPM_PART_FLAG_IPC,
+#endif
         .partition_priority   = TFM_PRIORITY_LOW,
         .partition_init       = tfm_nspm_thread_entry,
 #else