SPM: Rename 'thread call' with 'cross call'

Name "thread call" could not explicitly reflect the behaviour
of call type. This call crosses between caller and callee stack,
which enables caller and callee context to be sealed in their stack.

Rename this call with "cross call" to make the code more readable.
It will also benefit the upcoming optimization work.

Signed-off-by: Xinyu Zhang <xinyu.zhang@arm.com>
Change-Id: I7d2de563b6f498bde70e302065e743344d2a20fc
diff --git a/secure_fw/spm/CMakeLists.txt b/secure_fw/spm/CMakeLists.txt
index edef9a9..de2b9b8 100755
--- a/secure_fw/spm/CMakeLists.txt
+++ b/secure_fw/spm/CMakeLists.txt
@@ -51,7 +51,7 @@
         $<$<BOOL:${TFM_PSA_API}>:cmsis_psa/arch/tfm_arch.c>
         $<$<BOOL:${TFM_PSA_API}>:cmsis_psa/main.c>
         $<$<BOOL:${TFM_PSA_API}>:cmsis_psa/spm_ipc.c>
-        $<$<BOOL:${TFM_PSA_API}>:cmsis_psa/spm_thread_call.c>
+        $<$<BOOL:${TFM_PSA_API}>:cmsis_psa/spm_cross_call.c>
         $<$<BOOL:${TFM_PSA_API}>:cmsis_psa/static_load.c>
         $<$<BOOL:${TFM_PSA_API}>:ffm/psa_api.c>
         $<$<BOOL:${TFM_PSA_API}>:ffm/backend.c>
diff --git a/secure_fw/spm/cmsis_psa/arch/tfm_arch_v6m_v7m.c b/secure_fw/spm/cmsis_psa/arch/tfm_arch_v6m_v7m.c
index c9b27a0..4f9e647 100644
--- a/secure_fw/spm/cmsis_psa/arch/tfm_arch_v6m_v7m.c
+++ b/secure_fw/spm/cmsis_psa/arch/tfm_arch_v6m_v7m.c
@@ -30,15 +30,15 @@
 #pragma required = scheduler_lock
 #pragma required = tfm_core_svc_handler
 
-#ifdef CONFIG_TFM_PSA_API_THREAD_CALL
+#ifdef CONFIG_TFM_PSA_API_CROSS_CALL
 
-#pragma required = spcall_execute_c
+#pragma required = cross_call_execute_c
 
-#endif /* CONFIG_TFM_PSA_API_THREAD_CALL */
+#endif /* CONFIG_TFM_PSA_API_CROSS_CALL */
 
 #endif
 
-#ifdef CONFIG_TFM_PSA_API_THREAD_CALL
+#ifdef CONFIG_TFM_PSA_API_CROSS_CALL
 
 __naked uint32_t arch_non_preempt_call(uintptr_t fn_addr, uintptr_t frame_addr,
                                        uint32_t stk_base, uint32_t stk_limit)
@@ -60,7 +60,7 @@
         "   str    r4, [r3, #0]                         \n"
         "   cpsie  i                                    \n"
         "   push   {r2, r3}                             \n"
-        "   bl     spcall_execute_c                     \n"
+        "   bl     cross_call_execute_c                 \n"
         "   pop    {r2, r3}                             \n"
         "   cpsid  i                                    \n"
         "   cmp    r2, #0                               \n"
@@ -75,7 +75,7 @@
     );
 }
 
-#endif /* CONFIG_TFM_PSA_API_THREAD_CALL */
+#endif /* CONFIG_TFM_PSA_API_CROSS_CALL */
 
 __attribute__((naked)) void PendSV_Handler(void)
 {
diff --git a/secure_fw/spm/cmsis_psa/arch/tfm_arch_v8m_base.c b/secure_fw/spm/cmsis_psa/arch/tfm_arch_v8m_base.c
index 93960be..52ba185 100644
--- a/secure_fw/spm/cmsis_psa/arch/tfm_arch_v8m_base.c
+++ b/secure_fw/spm/cmsis_psa/arch/tfm_arch_v8m_base.c
@@ -31,15 +31,15 @@
 #pragma required = scheduler_lock
 #pragma required = tfm_core_svc_handler
 
-#ifdef CONFIG_TFM_PSA_API_THREAD_CALL
+#ifdef CONFIG_TFM_PSA_API_CROSS_CALL
 
-#pragma required = spcall_execute_c
+#pragma required = cross_call_execute_c
 
-#endif /* CONFIG_TFM_PSA_API_THREAD_CALL */
+#endif /* CONFIG_TFM_PSA_API_CROSS_CALL */
 
 #endif
 
-#ifdef CONFIG_TFM_PSA_API_THREAD_CALL
+#ifdef CONFIG_TFM_PSA_API_CROSS_CALL
 
 __naked uint32_t arch_non_preempt_call(uintptr_t fn_addr, uintptr_t frame_addr,
                                        uint32_t stk_base, uint32_t stk_limit)
@@ -64,7 +64,7 @@
         "   movs   r3, #"M2S(SCHEDULER_LOCKED)"         \n"
         "   str    r3, [r2, #0]                         \n"
         "   cpsie  i                                    \n"
-        "   bl     spcall_execute_c                     \n"
+        "   bl     cross_call_execute_c                 \n"
         "   cpsid  i                                    \n"
         "   cmp    r4, #0                               \n"
         "   beq    v8b_release_sched                    \n"
@@ -81,7 +81,7 @@
     );
 }
 
-#endif /* CONFIG_TFM_PSA_API_THREAD_CALL */
+#endif /* CONFIG_TFM_PSA_API_CROSS_CALL */
 
 __attribute__((naked)) void PendSV_Handler(void)
 {
diff --git a/secure_fw/spm/cmsis_psa/arch/tfm_arch_v8m_main.c b/secure_fw/spm/cmsis_psa/arch/tfm_arch_v8m_main.c
index 472b508..ab45cf4 100644
--- a/secure_fw/spm/cmsis_psa/arch/tfm_arch_v8m_main.c
+++ b/secure_fw/spm/cmsis_psa/arch/tfm_arch_v8m_main.c
@@ -36,15 +36,15 @@
 #pragma required = scheduler_lock
 #pragma required = tfm_core_svc_handler
 
-#ifdef CONFIG_TFM_PSA_API_THREAD_CALL
+#ifdef CONFIG_TFM_PSA_API_CROSS_CALL
 
-#pragma required = spcall_execute_c
+#pragma required = cross_call_execute_c
 
-#endif /* CONFIG_TFM_PSA_API_THREAD_CALL */
+#endif /* CONFIG_TFM_PSA_API_CROSS_CALL */
 
 #endif
 
-#ifdef CONFIG_TFM_PSA_API_THREAD_CALL
+#ifdef CONFIG_TFM_PSA_API_CROSS_CALL
 
 __naked uint32_t arch_non_preempt_call(uintptr_t fn_addr, uintptr_t frame_addr,
                                        uint32_t stk_base, uint32_t stk_limit)
@@ -68,7 +68,7 @@
         "   movs   r3, #"M2S(SCHEDULER_LOCKED)"     \n"
         "   str    r3, [r2, #0]                     \n"
         "   cpsie  i                                \n"
-        "   bl     spcall_execute_c                 \n"
+        "   bl     cross_call_execute_c             \n"
         "   cpsid  i                                \n"
         "   movs   r12, #0                          \n"
         "   cmp    r4, #0                           \n"
@@ -84,7 +84,7 @@
     );
 }
 
-#endif /* CONFIG_TFM_PSA_API_THREAD_CALL */
+#endif /* CONFIG_TFM_PSA_API_CROSS_CALL */
 
 __attribute__((naked)) void PendSV_Handler(void)
 {
diff --git a/secure_fw/spm/cmsis_psa/psa_interface_thread.c b/secure_fw/spm/cmsis_psa/psa_interface_cross.c
similarity index 65%
rename from secure_fw/spm/cmsis_psa/psa_interface_thread.c
rename to secure_fw/spm/cmsis_psa/psa_interface_cross.c
index 4558c5e..4290d88 100644
--- a/secure_fw/spm/cmsis_psa/psa_interface_thread.c
+++ b/secure_fw/spm/cmsis_psa/psa_interface_cross.c
@@ -15,33 +15,33 @@
 #include "psa/lifecycle.h"
 #include "psa/service.h"
 
-#ifdef CONFIG_TFM_PSA_API_THREAD_CALL
+#ifdef CONFIG_TFM_PSA_API_CROSS_CALL
 
 #if defined(__ICCARM__)
 
-#pragma required = spm_interface_thread_dispatcher
+#pragma required = spm_interface_cross_dispatcher
 
 #endif
 
 /* Grab all functions here in one section to avoid fail in long jump */
 __used
 __naked
-__section(".psa_interface_thread_call")
-static uint32_t psa_interface_unified_abi(uint32_t r0)
+__section(".psa_interface_cross_call")
+static uint32_t psa_interface_cross_unified_entry(uint32_t a0)
 {
     __asm volatile(
 #if !defined(__ICCARM__)
         ".syntax unified                                    \n"
 #endif
         "movs   r2, #1                                      \n"
-        "bl     spm_interface_thread_dispatcher             \n"
+        "bl     spm_interface_cross_dispatcher              \n"
         "pop    {r0-r4, pc}                                 \n"
     );
 }
 
 __naked
-__section(".psa_interface_thread_call")
-uint32_t psa_framework_version_thread(void)
+__section(".psa_interface_cross_call")
+uint32_t psa_framework_version_cross(void)
 {
     __asm volatile(
 #if !defined(__ICCARM__)
@@ -50,13 +50,13 @@
         "push   {r0-r4, lr}                                 \n"
         "ldr    r0, =tfm_spm_client_psa_framework_version   \n"
         "mov    r1, sp                                      \n"
-        "b      psa_interface_unified_abi                   \n"
+        "b      psa_interface_cross_unified_entry           \n"
     );
 }
 
 __naked
-__section(".psa_interface_thread_call")
-uint32_t psa_version_thread(uint32_t sid)
+__section(".psa_interface_cross_call")
+uint32_t psa_version_cross(uint32_t sid)
 {
     __asm volatile(
 #if !defined(__ICCARM__)
@@ -65,13 +65,13 @@
         "push   {r0-r4, lr}                                 \n"
         "ldr    r0, =tfm_spm_client_psa_version             \n"
         "mov    r1, sp                                      \n"
-        "b      psa_interface_unified_abi                   \n"
+        "b      psa_interface_cross_unified_entry           \n"
     );
 }
 
 __naked
-__section(".psa_interface_thread_call")
-psa_handle_t psa_connect_thread(uint32_t sid, uint32_t version)
+__section(".psa_interface_cross_call")
+psa_handle_t psa_connect_cross(uint32_t sid, uint32_t version)
 {
     __asm volatile(
 #if !defined(__ICCARM__)
@@ -80,16 +80,16 @@
         "push   {r0-r4, lr}                                 \n"
         "ldr    r0, =tfm_spm_client_psa_connect             \n"
         "mov    r1, sp                                      \n"
-        "b      psa_interface_unified_abi                   \n"
+        "b      psa_interface_cross_unified_entry           \n"
     );
 }
 
 __naked
-__section(".psa_interface_thread_call")
-psa_status_t tfm_psa_call_pack_thread(psa_handle_t handle,
-                                              uint32_t ctrl_param,
-                                              const psa_invec *in_vec,
-                                              psa_outvec *out_vec)
+__section(".psa_interface_cross_call")
+psa_status_t tfm_psa_call_pack_cross(psa_handle_t handle,
+                                     uint32_t ctrl_param,
+                                     const psa_invec *in_vec,
+                                     psa_outvec *out_vec)
 {
     __asm volatile(
 #if !defined(__ICCARM__)
@@ -98,13 +98,13 @@
         "push   {r0-r4, lr}                                 \n"
         "ldr    r0, =tfm_spm_client_psa_call                \n"
         "mov    r1, sp                                      \n"
-        "b      psa_interface_unified_abi                   \n"
+        "b      psa_interface_cross_unified_entry           \n"
     );
 }
 
 __naked
-__section(".psa_interface_thread_call")
-void psa_close_thread(psa_handle_t handle)
+__section(".psa_interface_cross_call")
+void psa_close_cross(psa_handle_t handle)
 {
     __asm volatile(
 #if !defined(__ICCARM__)
@@ -113,14 +113,13 @@
         "push   {r0-r4, lr}                                 \n"
         "ldr    r0, =tfm_spm_client_psa_close               \n"
         "mov    r1, sp                                      \n"
-        "b      psa_interface_unified_abi                   \n"
+        "b      psa_interface_cross_unified_entry           \n"
     );
 }
 
 __naked
-__section(".psa_interface_thread_call")
-psa_signal_t psa_wait_thread(psa_signal_t signal_mask,
-                                     uint32_t timeout)
+__section(".psa_interface_cross_call")
+psa_signal_t psa_wait_cross(psa_signal_t signal_mask, uint32_t timeout)
 {
     __asm volatile(
 #if !defined(__ICCARM__)
@@ -129,13 +128,13 @@
         "push   {r0-r4, lr}                                 \n"
         "ldr    r0, =tfm_spm_partition_psa_wait             \n"
         "mov    r1, sp                                      \n"
-        "b      psa_interface_unified_abi                   \n"
+        "b      psa_interface_cross_unified_entry           \n"
     );
 }
 
 __naked
-__section(".psa_interface_thread_call")
-psa_status_t psa_get_thread(psa_signal_t signal, psa_msg_t *msg)
+__section(".psa_interface_cross_call")
+psa_status_t psa_get_cross(psa_signal_t signal, psa_msg_t *msg)
 {
     __asm volatile(
 #if !defined(__ICCARM__)
@@ -144,13 +143,13 @@
         "push   {r0-r4, lr}                                 \n"
         "ldr    r0, =tfm_spm_partition_psa_get              \n"
         "mov    r1, sp                                      \n"
-        "b      psa_interface_unified_abi                   \n"
+        "b      psa_interface_cross_unified_entry           \n"
     );
 }
 
 __naked
-__section(".psa_interface_thread_call")
-void psa_set_rhandle_thread(psa_handle_t msg_handle, void *rhandle)
+__section(".psa_interface_cross_call")
+void psa_set_rhandle_cross(psa_handle_t msg_handle, void *rhandle)
 {
     __asm volatile(
 #if !defined(__ICCARM__)
@@ -159,14 +158,14 @@
         "push   {r0-r4, lr}                                 \n"
         "ldr    r0, =tfm_spm_partition_psa_set_rhandle      \n"
         "mov    r1, sp                                      \n"
-        "b      psa_interface_unified_abi                   \n"
+        "b      psa_interface_cross_unified_entry           \n"
     );
 }
 
 __naked
-__section(".psa_interface_thread_call")
-size_t psa_read_thread(psa_handle_t msg_handle, uint32_t invec_idx,
-                               void *buffer, size_t num_bytes)
+__section(".psa_interface_cross_call")
+size_t psa_read_cross(psa_handle_t msg_handle, uint32_t invec_idx,
+                      void *buffer, size_t num_bytes)
 {
     __asm volatile(
 #if !defined(__ICCARM__)
@@ -175,14 +174,14 @@
         "push   {r0-r4, lr}                                 \n"
         "ldr    r0, =tfm_spm_partition_psa_read             \n"
         "mov    r1, sp                                      \n"
-        "b      psa_interface_unified_abi                   \n"
+        "b      psa_interface_cross_unified_entry           \n"
     );
 }
 
 __naked
-__section(".psa_interface_thread_call")
-size_t psa_skip_thread(psa_handle_t msg_handle,
-                               uint32_t invec_idx, size_t num_bytes)
+__section(".psa_interface_cross_call")
+size_t psa_skip_cross(psa_handle_t msg_handle,
+                      uint32_t invec_idx, size_t num_bytes)
 {
     __asm volatile(
 #if !defined(__ICCARM__)
@@ -191,14 +190,14 @@
         "push   {r0-r4, lr}                                 \n"
         "ldr    r0, =tfm_spm_partition_psa_skip             \n"
         "mov    r1, sp                                      \n"
-        "b      psa_interface_unified_abi                   \n"
+        "b      psa_interface_cross_unified_entry           \n"
     );
 }
 
 __naked
-__section(".psa_interface_thread_call")
-void psa_write_thread(psa_handle_t msg_handle, uint32_t outvec_idx,
-                              const void *buffer, size_t num_bytes)
+__section(".psa_interface_cross_call")
+void psa_write_cross(psa_handle_t msg_handle, uint32_t outvec_idx,
+                     const void *buffer, size_t num_bytes)
 {
     __asm volatile(
 #if !defined(__ICCARM__)
@@ -207,13 +206,13 @@
         "push   {r0-r4, lr}                                 \n"
         "ldr    r0, =tfm_spm_partition_psa_write            \n"
         "mov    r1, sp                                      \n"
-        "b      psa_interface_unified_abi                   \n"
+        "b      psa_interface_cross_unified_entry           \n"
     );
 }
 
 __naked
-__section(".psa_interface_thread_call")
-void psa_reply_thread(psa_handle_t msg_handle, psa_status_t status)
+__section(".psa_interface_cross_call")
+void psa_reply_cross(psa_handle_t msg_handle, psa_status_t status)
 {
     __asm volatile(
 #if !defined(__ICCARM__)
@@ -222,13 +221,13 @@
         "push   {r0-r4, lr}                                 \n"
         "ldr    r0, =tfm_spm_partition_psa_reply            \n"
         "mov    r1, sp                                      \n"
-        "b      psa_interface_unified_abi                   \n"
+        "b      psa_interface_cross_unified_entry           \n"
     );
 }
 
 __naked
-__section(".psa_interface_thread_call")
-void psa_notify_thread(int32_t partition_id)
+__section(".psa_interface_cross_call")
+void psa_notify_cross(int32_t partition_id)
 {
     __asm volatile(
 #if !defined(__ICCARM__)
@@ -237,13 +236,13 @@
         "push   {r0-r4, lr}                                 \n"
         "ldr    r0, =tfm_spm_partition_psa_notify           \n"
         "mov    r1, sp                                      \n"
-        "b      psa_interface_unified_abi                   \n"
+        "b      psa_interface_cross_unified_entry           \n"
     );
 }
 
 __naked
-__section(".psa_interface_thread_call")
-void psa_clear_thread(void)
+__section(".psa_interface_cross_call")
+void psa_clear_cross(void)
 {
     __asm volatile(
 #if !defined(__ICCARM__)
@@ -252,13 +251,13 @@
         "push   {r0-r4, lr}                                 \n"
         "ldr    r0, =tfm_spm_partition_psa_clear            \n"
         "mov    r1, sp                                      \n"
-        "b      psa_interface_unified_abi                   \n"
+        "b      psa_interface_cross_unified_entry           \n"
     );
 }
 
 __naked
-__section(".psa_interface_thread_call")
-void psa_eoi_thread(psa_signal_t irq_signal)
+__section(".psa_interface_cross_call")
+void psa_eoi_cross(psa_signal_t irq_signal)
 {
     __asm volatile(
 #if !defined(__ICCARM__)
@@ -267,13 +266,13 @@
         "push   {r0-r4, lr}                                 \n"
         "ldr    r0, =tfm_spm_partition_psa_eoi              \n"
         "mov    r1, sp                                      \n"
-        "b      psa_interface_unified_abi                   \n"
+        "b      psa_interface_cross_unified_entry           \n"
     );
 }
 
 __naked
-__section(".psa_interface_thread_call")
-void psa_panic_thread(void)
+__section(".psa_interface_cross_call")
+void psa_panic_cross(void)
 {
     __asm volatile(
 #if !defined(__ICCARM__)
@@ -282,13 +281,13 @@
         "push   {r0-r4, lr}                                 \n"
         "ldr    r0, =tfm_spm_partition_psa_panic            \n"
         "mov    r1, sp                                      \n"
-        "b      psa_interface_unified_abi                   \n"
+        "b      psa_interface_cross_unified_entry           \n"
     );
 }
 
 __naked
-__section(".psa_interface_thread_call")
-psa_irq_status_t psa_irq_disable_thread(psa_signal_t irq_signal)
+__section(".psa_interface_cross_call")
+psa_irq_status_t psa_irq_disable_cross(psa_signal_t irq_signal)
 {
     __asm volatile(
 #if !defined(__ICCARM__)
@@ -297,13 +296,13 @@
         "push   {r0-r4, lr}                                 \n"
         "ldr    r0, =tfm_spm_partition_psa_irq_disable      \n"
         "mov    r1, sp                                      \n"
-        "b      psa_interface_unified_abi                   \n"
+        "b      psa_interface_cross_unified_entry           \n"
     );
 }
 
 __naked
-__section(".psa_interface_thread_call")
-void psa_irq_enable_thread(psa_signal_t irq_signal)
+__section(".psa_interface_cross_call")
+void psa_irq_enable_cross(psa_signal_t irq_signal)
 {
     __asm volatile(
 #if !defined(__ICCARM__)
@@ -312,13 +311,13 @@
         "push   {r0-r4, lr}                                 \n"
         "ldr    r0, =tfm_spm_partition_psa_irq_enable       \n"
         "mov    r1, sp                                      \n"
-        "b      psa_interface_unified_abi                   \n"
+        "b      psa_interface_cross_unified_entry           \n"
     );
 }
 
 __naked
-__section(".psa_interface_thread_call")
-void psa_reset_signal_thread(psa_signal_t irq_signal)
+__section(".psa_interface_cross_call")
+void psa_reset_signal_cross(psa_signal_t irq_signal)
 {
     __asm volatile(
 #if !defined(__ICCARM__)
@@ -327,13 +326,13 @@
         "push   {r0-r4, lr}                                 \n"
         "ldr    r0, =tfm_spm_partition_psa_reset_signal     \n"
         "mov    r1, sp                                      \n"
-        "b      psa_interface_unified_abi                   \n"
+        "b      psa_interface_cross_unified_entry           \n"
     );
 }
 
 __naked
-__section(".psa_interface_thread_call")
-uint32_t psa_rot_lifecycle_state_thread(void)
+__section(".psa_interface_cross_call")
+uint32_t psa_rot_lifecycle_state_cross(void)
 {
     __asm volatile(
 #if !defined(__ICCARM__)
@@ -342,15 +341,15 @@
         "push   {r0-r4, lr}                                 \n"
         "ldr    r0, =tfm_spm_get_lifecycle_state            \n"
         "mov    r1, sp                                      \n"
-        "b      psa_interface_unified_abi                   \n"
+        "b      psa_interface_cross_unified_entry           \n"
     );
 }
 
 #if PSA_FRAMEWORK_HAS_MM_IOVEC
 
 __naked
-__section(".psa_interface_thread_call")
-const void *psa_map_invec_thread(psa_handle_t msg_handle, uint32_t invec_idx)
+__section(".psa_interface_cross_call")
+const void *psa_map_invec_cross(psa_handle_t msg_handle, uint32_t invec_idx)
 {
     __asm volatile(
 #if !defined(__ICCARM__)
@@ -359,13 +358,13 @@
         "push   {r0-r4, lr}                                 \n"
         "ldr    r0, =tfm_spm_partition_psa_map_invec        \n"
         "mov    r1, sp                                      \n"
-        "b      psa_interface_unified_abi                   \n"
+        "b      psa_interface_cross_unified_entry           \n"
     );
 }
 
 __naked
-__section(".psa_interface_thread_call")
-void psa_unmap_invec_thread(psa_handle_t msg_handle, uint32_t invec_idx)
+__section(".psa_interface_cross_call")
+void psa_unmap_invec_cross(psa_handle_t msg_handle, uint32_t invec_idx)
 {
     __asm volatile(
 #if !defined(__ICCARM__)
@@ -374,13 +373,13 @@
         "push   {r0-r4, lr}                                 \n"
         "ldr    r0, =tfm_spm_partition_psa_unmap_invec      \n"
         "mov    r1, sp                                      \n"
-        "b      psa_interface_unified_abi                   \n"
+        "b      psa_interface_cross_unified_entry           \n"
     );
 }
 
 __naked
-__section(".psa_interface_thread_call")
-void *psa_map_outvec_thread(psa_handle_t msg_handle, uint32_t outvec_idx)
+__section(".psa_interface_cross_call")
+void *psa_map_outvec_cross(psa_handle_t msg_handle, uint32_t outvec_idx)
 {
     __asm volatile(
 #if !defined(__ICCARM__)
@@ -389,14 +388,14 @@
         "push   {r0-r4, lr}                                 \n"
         "ldr    r0, =tfm_spm_partition_psa_map_outvec       \n"
         "mov    r1, sp                                      \n"
-        "b      psa_interface_unified_abi                   \n"
+        "b      psa_interface_cross_unified_entry           \n"
     );
 }
 
 __naked
-__section(".psa_interface_thread_call")
-void psa_unmap_outvec_thread(psa_handle_t msg_handle, uint32_t outvec_idx,
-                             size_t len)
+__section(".psa_interface_cross_call")
+void psa_unmap_outvec_cross(psa_handle_t msg_handle, uint32_t outvec_idx,
+                            size_t len)
 {
     __asm volatile(
 #if !defined(__ICCARM__)
@@ -405,10 +404,10 @@
         "push   {r0-r4, lr}                                 \n"
         "ldr    r0, =tfm_spm_partition_psa_unmap_outvec     \n"
         "mov    r1, sp                                      \n"
-        "b      psa_interface_unified_abi                   \n"
+        "b      psa_interface_cross_unified_entry           \n"
     );
 }
 
 #endif /* PSA_FRAMEWORK_HAS_MM_IOVEC */
 
-#endif /* CONFIG_TFM_PSA_API_THREAD_CALL */
+#endif /* CONFIG_TFM_PSA_API_CROSS_CALL */
diff --git a/secure_fw/spm/cmsis_psa/spm_cross_call.c b/secure_fw/spm/cmsis_psa/spm_cross_call.c
new file mode 100644
index 0000000..2f8fa2d
--- /dev/null
+++ b/secure_fw/spm/cmsis_psa/spm_cross_call.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2021, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#include <stdint.h>
+#include "config_impl.h"
+#include "compiler_ext_defs.h"
+#include "spm_ipc.h"
+#include "tfm_arch.h"
+#include "ffm/backend.h"
+
+#ifdef CONFIG_TFM_PSA_API_CROSS_CALL
+
+/* Customized ABI format */
+struct cross_call_abi_frame_t {
+    uint32_t      a0;
+    uint32_t      a1;
+    uint32_t      a2;
+    uint32_t      a3;
+    uint32_t      unused0;
+    uint32_t      unused1;
+};
+
+typedef uint32_t (*target_fn_t)(uint32_t a0, uint32_t a1,
+                                uint32_t a2, uint32_t a3);
+
+__used
+void cross_call_execute_c(uintptr_t fn_addr, uintptr_t frame_addr)
+{
+    struct cross_call_abi_frame_t *p_frame =
+                                  (struct cross_call_abi_frame_t *)frame_addr;
+
+    p_frame->a0 = ((target_fn_t)fn_addr)(p_frame->a0, p_frame->a1,
+                                         p_frame->a2, p_frame->a3);
+}
+
+__used
+void spm_interface_cross_dispatcher(uintptr_t fn_addr,
+                                    uintptr_t frame_addr,
+                                    uint32_t  switch_stack)
+{
+    arch_non_preempt_call(fn_addr, frame_addr,
+                          switch_stack ? SPM_THREAD_CONTEXT->sp : 0,
+                          switch_stack ? SPM_THREAD_CONTEXT->sp_limit : 0);
+
+    if (THRD_EXPECTING_SCHEDULE()) {
+        ((struct cross_call_abi_frame_t *)frame_addr)->a0 =
+                                        tfm_arch_trigger_pendsv();
+    }
+
+    spm_handle_programmer_errors(
+                            ((struct cross_call_abi_frame_t *)frame_addr)->a0);
+}
+
+#endif /* CONFIG_TFM_PSA_API_CROSS_CALL */
diff --git a/secure_fw/spm/cmsis_psa/spm_ipc.h b/secure_fw/spm/cmsis_psa/spm_ipc.h
index c92946b..efade88 100644
--- a/secure_fw/spm/cmsis_psa/spm_ipc.h
+++ b/secure_fw/spm/cmsis_psa/spm_ipc.h
@@ -446,7 +446,7 @@
  */
 void spm_assert_signal(void *p_pt, psa_signal_t signal);
 
-#ifdef CONFIG_TFM_PSA_API_THREAD_CALL
+#ifdef CONFIG_TFM_PSA_API_CROSS_CALL
 
 /*
  * SPM dispatcher to handle the API call under non-privileged model.
@@ -458,12 +458,12 @@
  * frame_addr   - customized ABI frame type for the function call.
  * switch_stack - indicator if need to switch stack.
  */
-void spm_interface_thread_dispatcher(uintptr_t fn_addr,
-                                     uintptr_t frame_addr,
-                                     uint32_t  switch_stack);
+void spm_interface_cross_dispatcher(uintptr_t fn_addr,
+                                    uintptr_t frame_addr,
+                                    uint32_t  switch_stack);
 
 /* Execute a customized ABI function in C */
-void spcall_execute_c(uintptr_t fn_addr, uintptr_t frame_addr);
+void cross_call_execute_c(uintptr_t fn_addr, uintptr_t frame_addr);
 
 #endif
 
diff --git a/secure_fw/spm/cmsis_psa/spm_thread_call.c b/secure_fw/spm/cmsis_psa/spm_thread_call.c
deleted file mode 100644
index d64f99b..0000000
--- a/secure_fw/spm/cmsis_psa/spm_thread_call.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2021, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#include <stdint.h>
-#include "config_impl.h"
-#include "compiler_ext_defs.h"
-#include "spm_ipc.h"
-#include "tfm_arch.h"
-#include "utilities.h"
-#include "ffm/backend.h"
-#include "ffm/psa_api.h"
-#include "psa/client.h"
-#include "psa/lifecycle.h"
-#include "psa/service.h"
-
-#ifdef CONFIG_TFM_PSA_API_THREAD_CALL
-
-/* Customized ABI format */
-struct spcall_abi_frame_t {
-    uint32_t      a0;
-    uint32_t      a1;
-    uint32_t      a2;
-    uint32_t      a3;
-    uint32_t      unused0;
-    uint32_t      unused1;
-};
-
-typedef uint32_t (*target_fn_t)(uint32_t a0, uint32_t a1,
-                                uint32_t a2, uint32_t a3);
-
-__used
-void spcall_execute_c(uintptr_t fn_addr, uintptr_t frame_addr)
-{
-    struct spcall_abi_frame_t *p_frame =
-                                  (struct spcall_abi_frame_t *)frame_addr;
-
-    p_frame->a0 = ((target_fn_t)fn_addr)(p_frame->a0, p_frame->a1,
-                                         p_frame->a2, p_frame->a3);
-}
-
-__used
-void spm_interface_thread_dispatcher(uintptr_t fn_addr,
-                                     uintptr_t frame_addr,
-                                     uint32_t  switch_stack)
-{
-    arch_non_preempt_call(fn_addr, frame_addr,
-                          switch_stack ? SPM_THREAD_CONTEXT->sp : 0,
-                          switch_stack ? SPM_THREAD_CONTEXT->sp_limit : 0);
-
-    if (THRD_EXPECTING_SCHEDULE()) {
-        ((struct spcall_abi_frame_t *)frame_addr)->a0 =
-                                        tfm_arch_trigger_pendsv();
-    }
-
-    spm_handle_programmer_errors(((struct spcall_abi_frame_t *)frame_addr)->a0);
-}
-
-#endif /* CONFIG_TFM_PSA_API_THREAD_CALL */
diff --git a/secure_fw/spm/ffm/backend_ipc.c b/secure_fw/spm/ffm/backend_ipc.c
index 430848c..7dc2a22 100644
--- a/secure_fw/spm/ffm/backend_ipc.c
+++ b/secure_fw/spm/ffm/backend_ipc.c
@@ -23,7 +23,7 @@
 /* Declare the global component list */
 struct partition_head_t partition_listhead;
 
-#ifdef CONFIG_TFM_PSA_API_THREAD_CALL
+#ifdef CONFIG_TFM_PSA_API_CROSS_CALL
 
 #ifdef TFM_MULTI_CORE_TOPOLOGY
 /* TODO: To be checked when RPC design updates. */
@@ -119,7 +119,7 @@
     if (p_pldi->pid == TFM_SP_NON_SECURE_ID) {
         p_param = (void *)tfm_hal_get_ns_entry_point();
 
-#ifdef CONFIG_TFM_PSA_API_THREAD_CALL
+#ifdef CONFIG_TFM_PSA_API_CROSS_CALL
 #ifndef TFM_MULTI_CORE_TOPOLOGY
         SPM_THREAD_CONTEXT = &p_pt->ctx_ctrl;
 #endif