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>
diff --git a/secure_fw/partitions/idle_partition/idle_partition.c b/secure_fw/partitions/idle_partition/idle_partition.c
index e2725b4..90cd4da 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
 }