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/interface/include/config_impl.h.template b/interface/include/config_impl.h.template
index 612190e..5a6c3e1 100644
--- a/interface/include/config_impl.h.template
+++ b/interface/include/config_impl.h.template
@@ -20,7 +20,7 @@
#if TFM_LVL > 1
#define {{"%-56s"|format("CONFIG_TFM_PSA_API_SUPERVISOR_CALL")}} 1
#else /* TFM_LVL > 1 */
-#define {{"%-56s"|format("CONFIG_TFM_PSA_API_THREAD_CALL")}} 1
+#define {{"%-56s"|format("CONFIG_TFM_PSA_API_CROSS_CALL")}} 1
/* SPM re-uses Trustzone NS agent stack. */
#define {{"%-56s"|format("CONFIG_TFM_SPM_THREAD_STACK_SIZE")}} \
diff --git a/interface/include/psa_interface_redirect.h b/interface/include/psa_interface_redirect.h
index 9b77dcd..60915ef 100644
--- a/interface/include/psa_interface_redirect.h
+++ b/interface/include/psa_interface_redirect.h
@@ -32,34 +32,34 @@
#define psa_reset_signal psa_reset_signal_svc
#define psa_rot_lifecycle_state psa_rot_lifecycle_state_svc
-#elif defined(CONFIG_TFM_PSA_API_THREAD_CALL)
+#elif defined(CONFIG_TFM_PSA_API_CROSS_CALL)
-#define psa_framework_version psa_framework_version_thread
-#define psa_version psa_version_thread
-#define psa_connect psa_connect_thread
-#define tfm_psa_call_pack tfm_psa_call_pack_thread
-#define psa_close psa_close_thread
-#define psa_wait psa_wait_thread
-#define psa_get psa_get_thread
-#define psa_set_rhandle psa_set_rhandle_thread
-#define psa_read psa_read_thread
-#define psa_skip psa_skip_thread
-#define psa_write psa_write_thread
-#define psa_reply psa_reply_thread
-#define psa_notify psa_notify_thread
-#define psa_clear psa_clear_thread
-#define psa_eoi psa_eoi_thread
-#define psa_panic psa_panic_thread
-#define psa_irq_enable psa_irq_enable_thread
-#define psa_irq_disable psa_irq_disable_thread
-#define psa_reset_signal psa_reset_signal_thread
-#define psa_rot_lifecycle_state psa_rot_lifecycle_state_thread
+#define psa_framework_version psa_framework_version_cross
+#define psa_version psa_version_cross
+#define psa_connect psa_connect_cross
+#define tfm_psa_call_pack tfm_psa_call_pack_cross
+#define psa_close psa_close_cross
+#define psa_wait psa_wait_cross
+#define psa_get psa_get_cross
+#define psa_set_rhandle psa_set_rhandle_cross
+#define psa_read psa_read_cross
+#define psa_skip psa_skip_cross
+#define psa_write psa_write_cross
+#define psa_reply psa_reply_cross
+#define psa_notify psa_notify_cross
+#define psa_clear psa_clear_cross
+#define psa_eoi psa_eoi_cross
+#define psa_panic psa_panic_cross
+#define psa_irq_enable psa_irq_enable_cross
+#define psa_irq_disable psa_irq_disable_cross
+#define psa_reset_signal psa_reset_signal_cross
+#define psa_rot_lifecycle_state psa_rot_lifecycle_state_cross
#if PSA_FRAMEWORK_HAS_MM_IOVEC
-#define psa_map_invec psa_map_invec_thread
-#define psa_unmap_invec psa_unmap_invec_thread
-#define psa_map_outvec psa_map_outvec_thread
-#define psa_unmap_outvec psa_unmap_outvec_thread
+#define psa_map_invec psa_map_invec_cross
+#define psa_unmap_invec psa_unmap_invec_cross
+#define psa_map_outvec psa_map_outvec_cross
+#define psa_unmap_outvec psa_unmap_outvec_cross
#endif /* PSA_FRAMEWORK_HAS_MM_IOVEC */
#elif defined(CONFIG_TFM_PSA_API_SFN_CALL)
diff --git a/secure_fw/CMakeLists.txt b/secure_fw/CMakeLists.txt
index 63f4fb2..51e3a00 100644
--- a/secure_fw/CMakeLists.txt
+++ b/secure_fw/CMakeLists.txt
@@ -102,7 +102,7 @@
set_source_files_properties(
${CMAKE_SOURCE_DIR}/secure_fw/spm/cmsis_psa/psa_interface_svc.c
- ${CMAKE_SOURCE_DIR}/secure_fw/spm/cmsis_psa/psa_interface_thread.c
+ ${CMAKE_SOURCE_DIR}/secure_fw/spm/cmsis_psa/psa_interface_cross.c
${CMAKE_SOURCE_DIR}/secure_fw/spm/cmsis_psa/psa_interface_sfn.c
PROPERTIES
COMPILE_FLAGS $<$<C_COMPILER_ID:GNU>:-Wno-unused-parameter>
@@ -114,7 +114,7 @@
target_sources(tfm_secure_api
INTERFACE
$<$<BOOL:${TFM_PSA_API}>:${CMAKE_SOURCE_DIR}/secure_fw/spm/cmsis_psa/psa_interface_svc.c>
- $<$<BOOL:${TFM_PSA_API}>:${CMAKE_SOURCE_DIR}/secure_fw/spm/cmsis_psa/psa_interface_thread.c>
+ $<$<BOOL:${TFM_PSA_API}>:${CMAKE_SOURCE_DIR}/secure_fw/spm/cmsis_psa/psa_interface_cross.c>
$<$<BOOL:${TFM_PSA_API}>:${CMAKE_SOURCE_DIR}/secure_fw/spm/cmsis_psa/psa_interface_sfn.c>
)
diff --git a/secure_fw/partitions/ns_agent_tz/tfm_psa_api_veneers.c b/secure_fw/partitions/ns_agent_tz/tfm_psa_api_veneers.c
index 31eff4b..6b4c824 100644
--- a/secure_fw/partitions/ns_agent_tz/tfm_psa_api_veneers.c
+++ b/secure_fw/partitions/ns_agent_tz/tfm_psa_api_veneers.c
@@ -15,7 +15,7 @@
#include "tfm_psa_call_pack.h"
#include "tfm_secure_api.h"
-#ifdef CONFIG_TFM_PSA_API_THREAD_CALL
+#ifdef CONFIG_TFM_PSA_API_CROSS_CALL
#include "spm_ipc.h"
#include "ffm/psa_api.h"
#endif
@@ -38,16 +38,16 @@
#if defined(__ICCARM__)
-#ifdef CONFIG_TFM_PSA_API_THREAD_CALL
+#ifdef CONFIG_TFM_PSA_API_CROSS_CALL
#pragma required = tfm_spm_client_psa_framework_version
#pragma required = tfm_spm_client_psa_version
#pragma required = tfm_spm_client_psa_connect
#pragma required = tfm_spm_client_psa_call
#pragma required = tfm_spm_client_psa_close
-#pragma required = spm_interface_thread_dispatcher
+#pragma required = spm_interface_cross_dispatcher
-#endif /* CONFIG_TFM_PSA_API_THREAD_CALL */
+#endif /* CONFIG_TFM_PSA_API_CROSS_CALL */
#endif
@@ -67,12 +67,12 @@
#endif
" mrs r3, control \n"
" push {r2, r3} \n"
-#ifdef CONFIG_TFM_PSA_API_THREAD_CALL
+#ifdef CONFIG_TFM_PSA_API_CROSS_CALL
" push {r0-r4, lr} \n"
" ldr r0, =tfm_spm_client_psa_framework_version \n"
" mov r1, sp \n"
" movs r2, #0 \n"
- " bl spm_interface_thread_dispatcher \n"
+ " bl spm_interface_cross_dispatcher \n"
" pop {r0-r3} \n"
" pop {r2, r3} \n"
" mov lr, r3 \n"
@@ -111,12 +111,12 @@
#endif
" mrs r3, control \n"
" push {r2, r3} \n"
-#ifdef CONFIG_TFM_PSA_API_THREAD_CALL
+#ifdef CONFIG_TFM_PSA_API_CROSS_CALL
" push {r0-r4, lr} \n"
" ldr r0, =tfm_spm_client_psa_version \n"
" mov r1, sp \n"
" movs r2, #0 \n"
- " bl spm_interface_thread_dispatcher \n"
+ " bl spm_interface_cross_dispatcher \n"
" pop {r0-r3} \n"
" pop {r2, r3} \n"
" mov lr, r3 \n"
@@ -155,12 +155,12 @@
#endif
" mrs r3, control \n"
" push {r2, r3} \n"
-#ifdef CONFIG_TFM_PSA_API_THREAD_CALL
+#ifdef CONFIG_TFM_PSA_API_CROSS_CALL
" push {r0-r4, lr} \n"
" ldr r0, =tfm_spm_client_psa_connect \n"
" mov r1, sp \n"
" movs r2, #0 \n"
- " bl spm_interface_thread_dispatcher \n"
+ " bl spm_interface_cross_dispatcher \n"
" pop {r0-r3} \n"
" pop {r2, r3} \n"
" mov lr, r3 \n"
@@ -172,7 +172,7 @@
#else
" svc "M2S(TFM_SVC_PSA_CONNECT)" \n"
#endif
- " pop {r2, r3} \n"
+ " pop {r2, r3} \n"
" msr control, r3 \n"
" bxns lr \n"
#if !defined(__ARM_ARCH_8_1M_MAIN__)
@@ -206,12 +206,12 @@
" mrs r3, control \n"
" push {r2, r3} \n"
" mov r3, r12 \n"
-#ifdef CONFIG_TFM_PSA_API_THREAD_CALL
+#ifdef CONFIG_TFM_PSA_API_CROSS_CALL
" push {r0-r4, lr} \n"
" ldr r0, =tfm_spm_client_psa_call \n"
" mov r1, sp \n"
" movs r2, #0 \n"
- " bl spm_interface_thread_dispatcher \n"
+ " bl spm_interface_cross_dispatcher \n"
" pop {r0-r3} \n"
" pop {r2, r3} \n"
" mov lr, r3 \n"
@@ -250,12 +250,12 @@
#endif
" mrs r3, control \n"
" push {r2, r3} \n"
-#ifdef CONFIG_TFM_PSA_API_THREAD_CALL
+#ifdef CONFIG_TFM_PSA_API_CROSS_CALL
" push {r0-r4, lr} \n"
" ldr r0, =tfm_spm_client_psa_close \n"
" mov r1, sp \n"
" movs r2, #0 \n"
- " bl spm_interface_thread_dispatcher \n"
+ " bl spm_interface_cross_dispatcher \n"
" pop {r0-r3} \n"
" pop {r2, r3} \n"
" mov lr, r3 \n"
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