SPM: Remove the "privileged" argument

Remove the "privileged" argument from PSA API function
body, create an API to obtain privilege information from
the caller info.

Change-Id: If0b7f66bd315c5249ca0b77ea761e015f9349c00
Signed-off-by: Mingyang Sun <mingyang.sun@arm.com>
diff --git a/secure_fw/spm/cmsis_psa/spm_ipc.c b/secure_fw/spm/cmsis_psa/spm_ipc.c
index 42ef5a2..75661b2 100644
--- a/secure_fw/spm/cmsis_psa/spm_ipc.c
+++ b/secure_fw/spm/cmsis_psa/spm_ipc.c
@@ -615,6 +615,7 @@
     return (__get_active_exc_num() == EXC_NUM_PENDSV);
 #else
     struct partition_t *partition = tfm_spm_get_running_partition();
+
     if (!partition) {
         tfm_core_panic();
     }
@@ -623,6 +624,27 @@
 #endif
 }
 
+uint32_t tfm_spm_get_caller_privilege_mode(void)
+{
+    struct partition_t *partition;
+
+#if defined(TFM_MULTI_CORE_TOPOLOGY) || defined(FORWARD_PROT_MSG)
+    /*
+     * In multi-core topology, if PSA request is from mailbox, the client
+     * is unprivileged.
+     */
+    if (__get_active_exc_num() == EXC_NUM_PENDSV) {
+        return TFM_PARTITION_UNPRIVILEGED_MODE;
+    }
+#endif
+    partition = tfm_spm_get_running_partition();
+    if (!partition) {
+        tfm_core_panic();
+    }
+
+    return tfm_spm_partition_get_privileged_mode(partition->p_ldinf->flags);
+}
+
 uint32_t tfm_spm_init(void)
 {
     uint32_t i;