SPM: Add STATUS_NEED_SCHEDULE to manage scheduler
THRD_EXPECTING_SCHEDULE() calls thrd_next() to decide whether
scheduling is required and when it is required, PendSV will
call thrd_next() again in ipc_schedule(). This duplicated
call of thrd_next() can be avoided by returning a status of
STATUS_NEED_SCHDULABLE from backend in these locations:
- SVC_Handler
- SPM cross API
- Interrupt handler
Signed-off-by: Jianliang Shen <jianliang.shen@arm.com>
Change-Id: I3f1fccbb045938624089e856b5a98c3365c76fcc
diff --git a/secure_fw/spm/ffm/interrupt.c b/secure_fw/spm/ffm/interrupt.c
index 7ec611e..0b5e043 100644
--- a/secure_fw/spm/ffm/interrupt.c
+++ b/secure_fw/spm/ffm/interrupt.c
@@ -21,6 +21,7 @@
#include "load/spm_load_api.h"
#include "ffm/backend.h"
+#include "internal_status_code.h"
extern uintptr_t spm_boundary;
@@ -142,6 +143,7 @@
{
psa_flih_result_t flih_result;
struct partition_t *p_part;
+ psa_status_t ret = 0;
if (!p_pt || !p_ildi) {
tfm_core_panic();
@@ -175,10 +177,10 @@
}
if (flih_result == PSA_FLIH_SIGNAL) {
- backend_assert_signal(p_pt, p_ildi->signal);
+ ret = backend_assert_signal(p_pt, p_ildi->signal);
/* In SFN backend, there is only one thread, no thread switch. */
#if CONFIG_TFM_SPM_BACKEND_SFN != 1
- if (THRD_EXPECTING_SCHEDULE()) {
+ if (ret == STATUS_NEED_SCHEDULE) {
tfm_arch_trigger_pendsv();
}
#endif