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/include/ffm/backend.h b/secure_fw/spm/include/ffm/backend.h
index 03f2f14..d15fdc2 100644
--- a/secure_fw/spm/include/ffm/backend.h
+++ b/secure_fw/spm/include/ffm/backend.h
@@ -55,12 +55,12 @@
/**
* \brief Set the wait signal pattern in current partition.
*/
-psa_signal_t backend_wait_signals(struct partition_t *p_pt, psa_signal_t signals);
+psa_status_t backend_wait_signals(struct partition_t *p_pt, psa_signal_t signals);
/**
* \brief Set the asserted signal pattern in current partition.
*/
-uint32_t backend_assert_signal(struct partition_t *p_pt, psa_signal_t signal);
+psa_status_t backend_assert_signal(struct partition_t *p_pt, psa_signal_t signal);
/* The component list, and a MACRO indicate this is not a common global. */
extern struct partition_head_t partition_listhead;
diff --git a/secure_fw/spm/include/ffm/psa_api.h b/secure_fw/spm/include/ffm/psa_api.h
index 868c178..152ba17 100644
--- a/secure_fw/spm/include/ffm/psa_api.h
+++ b/secure_fw/spm/include/ffm/psa_api.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2022, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2023, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -267,11 +267,12 @@
*
* \param[in] partition_id Secure Partition ID of the target partition.
*
- * \retval void Success.
+ * \retval PSA_SUCCESS Success.
+ * \retval PSA_NEED_SCHEDULE Require schedule thread.
* \retval "PROGRAMMER ERROR" partition_id does not correspond to a Secure
* Partition.
*/
-void tfm_spm_partition_psa_notify(int32_t partition_id);
+psa_status_t tfm_spm_partition_psa_notify(int32_t partition_id);
/**
* \brief Function body of \ref psa_clear.