aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Peng <kevin.peng@arm.com>2021-07-20 17:38:18 +0800
committerKevin Peng <kevin.peng@arm.com>2021-07-21 11:19:07 +0800
commitaaf994d929fe368f93fc128545a1af0431614757 (patch)
treeb7e3300952182e188936b32decdf50661693e846
parent9f7cd9612731d9572fef0234b466601c7362171c (diff)
downloadtrusted-firmware-m-aaf994d929fe368f93fc128545a1af0431614757.tar.gz
Partitions: Add psa_wait when wake up in Idle Partition
There could be the following case that SPE would stuck in Idle Partition: - The NSPE preemptes the Idle Partition - A Secure Interrupt then preempts the NSPE - The interrupt handling triggers scheduling. - But the NSPE was preempted, scheduling is skipped to avoid context mismatch between NSPE and SPE - Execution goes back from NSPE to SPE At this point, some events from the resumed Partition to trigger the scheduler again is expected, for example a psa_wait or psa_reply call. But the Idle Partition does nothing. So this patch adds a dummy psa_wait to fix this issue, using PSA_POLL to avoid the Idle Partition being set to "BLOCK" state. Change-Id: I69e79b25ba88eea40d18b1c7c29690bc1cadf242 Signed-off-by: Kevin Peng <kevin.peng@arm.com>
-rw-r--r--secure_fw/partitions/idle_partition/idle_partition.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/secure_fw/partitions/idle_partition/idle_partition.c b/secure_fw/partitions/idle_partition/idle_partition.c
index e2725b43fa..90cd4da3a4 100644
--- a/secure_fw/partitions/idle_partition/idle_partition.c
+++ b/secure_fw/partitions/idle_partition/idle_partition.c
@@ -7,18 +7,33 @@
#include "cmsis.h"
#include "fih.h"
+#include "psa/service.h"
void tfm_idle_thread(void)
{
while (1) {
- __WFI();
+ /*
+ * There could be other Partitions becoming RUNABLE after wake up.
+ * This is a dummy psa_wait to let SPM check possible scheduling.
+ * It does not expect any signals.
+ */
+ if (psa_wait(PSA_WAIT_ANY, PSA_POLL) == 0) {
+ __WFI();
+ }
}
#ifdef TFM_FIH_PROFILE_ON
fih_delay();
while (1) {
- __WFI();
+ /*
+ * There could be other Partitions becoming RUNABLE after wake up.
+ * This is a dummy psa_wait to let SPM check possible scheduling.
+ * It does not expect any signals.
+ */
+ if (psa_wait(PSA_WAIT_ANY, PSA_POLL) == 0) {
+ __WFI();
+ }
}
#endif
}