Build: Add configuration for doorbell APIs

The doorbell APIs are not widely used.
This patch adds a build configuration for them to save memory by
disabling the APIs.

Corresponding changes are made as well:
1. SFN_BACKEND does not support doorbell - it does not provide the
   doorbell APIs, so the config should be disabled by default.
2. The psa_wait in SFN backend can be removed as well since neither
   of the API consumer, interrupt or doorbell is enabled.

Change-Id: I7c367dc0724f915ec2932b6c29db54bdfac06fa3
Signed-off-by: Kevin Peng <kevin.peng@arm.com>
diff --git a/secure_fw/spm/ffm/backend_ipc.c b/secure_fw/spm/ffm/backend_ipc.c
index 9870d21..9507b03 100644
--- a/secure_fw/spm/ffm/backend_ipc.c
+++ b/secure_fw/spm/ffm/backend_ipc.c
@@ -107,7 +107,11 @@
 {
     const struct partition_load_info_t *p_pldi = p_pt->p_ldinf;
 
-    p_pt->signals_allowed |= PSA_DOORBELL | service_setting;
+#if CONFIG_TFM_DOORBELL_API == 1
+    p_pt->signals_allowed |= PSA_DOORBELL;
+#endif /* CONFIG_TFM_DOORBELL_API == 1 */
+
+    p_pt->signals_allowed |= service_setting;
 
     THRD_SYNC_INIT(&p_pt->waitobj);
     UNI_LISI_INIT_NODE(p_pt, p_handles);
diff --git a/secure_fw/spm/ffm/psa_api.c b/secure_fw/spm/ffm/psa_api.c
index c8ede67..62715db 100644
--- a/secure_fw/spm/ffm/psa_api.c
+++ b/secure_fw/spm/ffm/psa_api.c
@@ -435,6 +435,7 @@
 
 /* PSA Partition API function body */
 
+#if CONFIG_TFM_SPM_BACKEND_IPC == 1
 psa_signal_t tfm_spm_partition_psa_wait(psa_signal_t signal_mask,
                                         uint32_t timeout)
 {
@@ -471,8 +472,6 @@
     return partition->signals_asserted & signal_mask;
 }
 
-/* This API is only used in IPC backend. */
-#if CONFIG_TFM_SPM_BACKEND_IPC == 1
 psa_status_t tfm_spm_partition_psa_get(psa_signal_t signal, psa_msg_t *msg)
 {
     struct conn_handle_t *tmp_msg = NULL;
@@ -850,6 +849,7 @@
     return ret;
 }
 
+#if CONFIG_TFM_DOORBELL_API == 1
 void tfm_spm_partition_psa_notify(int32_t partition_id)
 {
     struct partition_t *p_pt = tfm_spm_get_partition_by_id(partition_id);
@@ -876,6 +876,7 @@
     partition->signals_asserted &= ~PSA_DOORBELL;
     CRITICAL_SECTION_LEAVE(cs_assert);
 }
+#endif /* CONFIG_TFM_DOORBELL_API == 1 */
 
 void tfm_spm_partition_psa_panic(void)
 {