SPM: Add build config for FF-M interrupt APIs

Add configs of optionally building FF-M interrupt APIs. Build:
- psa_irq_enable() and psa_irq_disable() for either FLIH or
  SLIH enabled.
- psa_reset_signal() for FLIH enabled.
- psa_eoi() for SLIH enabled.

Signed-off-by: Mingyang Sun <mingyang.sun@arm.com>
Change-Id: I0822f96c1e827181edf34a409b357b7e81485dc4
diff --git a/interface/include/config_impl.h.template b/interface/include/config_impl.h.template
index 85b2cba..214f928 100644
--- a/interface/include/config_impl.h.template
+++ b/interface/include/config_impl.h.template
@@ -19,6 +19,8 @@
 #define {{"%-56s"|format("CONFIG_TFM_PSA_API_SUPERVISOR_CALL")}} {{config_impl['CONFIG_TFM_PSA_API_SUPERVISOR_CALL']}}
 
 #define {{"%-56s"|format("CONFIG_TFM_CONNECTION_BASED_SERVICE_API")}} {{config_impl['CONFIG_TFM_CONNECTION_BASED_SERVICE_API']}}
+#define {{"%-56s"|format("CONFIG_TFM_FLIH_API")}} {{config_impl['CONFIG_TFM_FLIH_API']}}
+#define {{"%-56s"|format("CONFIG_TFM_SLIH_API")}} {{config_impl['CONFIG_TFM_SLIH_API']}}
 
 #if CONFIG_TFM_SPM_BACKEND_IPC == 1
 /* Trustzone NS agent working stack size. */
diff --git a/interface/include/psa_interface_redirect.h b/interface/include/psa_interface_redirect.h
index ee46d15..96dc79c 100644
--- a/interface/include/psa_interface_redirect.h
+++ b/interface/include/psa_interface_redirect.h
@@ -22,11 +22,7 @@
 #define psa_reply                psa_reply_svc
 #define psa_notify               psa_notify_svc
 #define psa_clear                psa_clear_svc
-#define psa_eoi                  psa_eoi_svc
 #define psa_panic                psa_panic_svc
-#define psa_irq_enable           psa_irq_enable_svc
-#define psa_irq_disable          psa_irq_disable_svc
-#define psa_reset_signal         psa_reset_signal_svc
 #define psa_rot_lifecycle_state  psa_rot_lifecycle_state_svc
 /* Following PSA APIs are only needed by connection-based services */
 #if CONFIG_TFM_CONNECTION_BASED_SERVICE_API == 1
@@ -35,6 +31,19 @@
 #define psa_set_rhandle          psa_set_rhandle_svc
 #endif /* CONFIG_TFM_CONNECTION_BASED_SERVICE_API */
 
+#if CONFIG_TFM_FLIH_API == 1 || CONFIG_TFM_SLIH_API == 1
+#define psa_irq_enable           psa_irq_enable_svc
+#define psa_irq_disable          psa_irq_disable_svc
+/* This API is only used for FLIH. */
+#if CONFIG_TFM_FLIH_API == 1
+#define psa_reset_signal         psa_reset_signal_svc
+#endif
+/* This API is only used for SLIH. */
+#if CONFIG_TFM_SLIH_API == 1
+#define psa_eoi                  psa_eoi_svc
+#endif
+#endif /* CONFIG_TFM_FLIH_API == 1 || CONFIG_TFM_SLIH_API == 1 */
+
 #elif CONFIG_TFM_PSA_API_CROSS_CALL == 1
 
 #define psa_framework_version    psa_framework_version_cross
@@ -48,11 +57,7 @@
 #define psa_reply                psa_reply_cross
 #define psa_notify               psa_notify_cross
 #define psa_clear                psa_clear_cross
-#define psa_eoi                  psa_eoi_cross
 #define psa_panic                psa_panic_cross
-#define psa_irq_enable           psa_irq_enable_cross
-#define psa_irq_disable          psa_irq_disable_cross
-#define psa_reset_signal         psa_reset_signal_cross
 #define psa_rot_lifecycle_state  psa_rot_lifecycle_state_cross
 /* Following PSA APIs are only needed by connection-based services */
 #if CONFIG_TFM_CONNECTION_BASED_SERVICE_API == 1
@@ -61,6 +66,19 @@
 #define psa_set_rhandle          psa_set_rhandle_cross
 #endif /* CONFIG_TFM_CONNECTION_BASED_SERVICE_API */
 
+#if CONFIG_TFM_FLIH_API == 1 || CONFIG_TFM_SLIH_API == 1
+#define psa_irq_enable           psa_irq_enable_cross
+#define psa_irq_disable          psa_irq_disable_cross
+/* This API is only used for FLIH. */
+#if CONFIG_TFM_FLIH_API == 1
+#define psa_reset_signal         psa_reset_signal_cross
+#endif
+/* This API is only used for SLIH. */
+#if CONFIG_TFM_SLIH_API == 1
+#define psa_eoi                  psa_eoi_cross
+#endif
+#endif /* CONFIG_TFM_FLIH_API == 1 || CONFIG_TFM_SLIH_API == 1 */
+
 #if PSA_FRAMEWORK_HAS_MM_IOVEC
 #define psa_map_invec            psa_map_invec_cross
 #define psa_unmap_invec          psa_unmap_invec_cross
diff --git a/secure_fw/spm/cmsis_psa/psa_interface_cross.c b/secure_fw/spm/cmsis_psa/psa_interface_cross.c
index 1f9de89..88c27c0 100644
--- a/secure_fw/spm/cmsis_psa/psa_interface_cross.c
+++ b/secure_fw/spm/cmsis_psa/psa_interface_cross.c
@@ -210,21 +210,6 @@
 
 __naked
 __section(".psa_interface_cross_call")
-void psa_eoi_cross(psa_signal_t irq_signal)
-{
-    __asm volatile(
-#if !defined(__ICCARM__)
-        ".syntax unified                                    \n"
-#endif
-        "push   {r0-r4, lr}                                 \n"
-        "ldr    r0, =tfm_spm_partition_psa_eoi              \n"
-        "mov    r1, sp                                      \n"
-        "b      psa_interface_cross_unified_entry           \n"
-    );
-}
-
-__naked
-__section(".psa_interface_cross_call")
 void psa_panic_cross(void)
 {
     __asm volatile(
@@ -240,51 +225,6 @@
 
 __naked
 __section(".psa_interface_cross_call")
-psa_irq_status_t psa_irq_disable_cross(psa_signal_t irq_signal)
-{
-    __asm volatile(
-#if !defined(__ICCARM__)
-        ".syntax unified                                    \n"
-#endif
-        "push   {r0-r4, lr}                                 \n"
-        "ldr    r0, =tfm_spm_partition_psa_irq_disable      \n"
-        "mov    r1, sp                                      \n"
-        "b      psa_interface_cross_unified_entry           \n"
-    );
-}
-
-__naked
-__section(".psa_interface_cross_call")
-void psa_irq_enable_cross(psa_signal_t irq_signal)
-{
-    __asm volatile(
-#if !defined(__ICCARM__)
-        ".syntax unified                                    \n"
-#endif
-        "push   {r0-r4, lr}                                 \n"
-        "ldr    r0, =tfm_spm_partition_psa_irq_enable       \n"
-        "mov    r1, sp                                      \n"
-        "b      psa_interface_cross_unified_entry           \n"
-    );
-}
-
-__naked
-__section(".psa_interface_cross_call")
-void psa_reset_signal_cross(psa_signal_t irq_signal)
-{
-    __asm volatile(
-#if !defined(__ICCARM__)
-        ".syntax unified                                    \n"
-#endif
-        "push   {r0-r4, lr}                                 \n"
-        "ldr    r0, =tfm_spm_partition_psa_reset_signal     \n"
-        "mov    r1, sp                                      \n"
-        "b      psa_interface_cross_unified_entry           \n"
-    );
-}
-
-__naked
-__section(".psa_interface_cross_call")
 uint32_t psa_rot_lifecycle_state_cross(void)
 {
     __asm volatile(
@@ -348,6 +288,74 @@
 
 #endif /* CONFIG_TFM_CONNECTION_BASED_SERVICE_API */
 
+#if CONFIG_TFM_FLIH_API == 1 || CONFIG_TFM_SLIH_API == 1
+__naked
+__section(".psa_interface_cross_call")
+void psa_irq_enable_cross(psa_signal_t irq_signal)
+{
+    __asm volatile(
+#if !defined(__ICCARM__)
+        ".syntax unified                                    \n"
+#endif
+        "push   {r0-r4, lr}                                 \n"
+        "ldr    r0, =tfm_spm_partition_psa_irq_enable       \n"
+        "mov    r1, sp                                      \n"
+        "b      psa_interface_cross_unified_entry           \n"
+    );
+}
+
+__naked
+__section(".psa_interface_cross_call")
+psa_irq_status_t psa_irq_disable_cross(psa_signal_t irq_signal)
+{
+    __asm volatile(
+#if !defined(__ICCARM__)
+        ".syntax unified                                    \n"
+#endif
+        "push   {r0-r4, lr}                                 \n"
+        "ldr    r0, =tfm_spm_partition_psa_irq_disable      \n"
+        "mov    r1, sp                                      \n"
+        "b      psa_interface_cross_unified_entry           \n"
+    );
+}
+
+/* This API is only used for FLIH. */
+#if CONFIG_TFM_FLIH_API == 1
+__naked
+__section(".psa_interface_cross_call")
+void psa_reset_signal_cross(psa_signal_t irq_signal)
+{
+    __asm volatile(
+#if !defined(__ICCARM__)
+        ".syntax unified                                    \n"
+#endif
+        "push   {r0-r4, lr}                                 \n"
+        "ldr    r0, =tfm_spm_partition_psa_reset_signal     \n"
+        "mov    r1, sp                                      \n"
+        "b      psa_interface_cross_unified_entry           \n"
+    );
+}
+#endif /* CONFIG_TFM_FLIH_API == 1 */
+
+/* This API is only used for SLIH. */
+#if CONFIG_TFM_SLIH_API == 1
+__naked
+__section(".psa_interface_cross_call")
+void psa_eoi_cross(psa_signal_t irq_signal)
+{
+    __asm volatile(
+#if !defined(__ICCARM__)
+        ".syntax unified                                    \n"
+#endif
+        "push   {r0-r4, lr}                                 \n"
+        "ldr    r0, =tfm_spm_partition_psa_eoi              \n"
+        "mov    r1, sp                                      \n"
+        "b      psa_interface_cross_unified_entry           \n"
+    );
+}
+#endif /* CONFIG_TFM_SLIH_API */
+#endif /* CONFIG_TFM_FLIH_API == 1 || CONFIG_TFM_SLIH_API == 1 */
+
 #if PSA_FRAMEWORK_HAS_MM_IOVEC
 
 __naked
diff --git a/secure_fw/spm/cmsis_psa/psa_interface_svc.c b/secure_fw/spm/cmsis_psa/psa_interface_svc.c
index ef34b84..3d1c62c 100644
--- a/secure_fw/spm/cmsis_psa/psa_interface_svc.c
+++ b/secure_fw/spm/cmsis_psa/psa_interface_svc.c
@@ -86,36 +86,12 @@
                    "bx      lr                                 \n");
 }
 
-__naked void psa_eoi_svc(psa_signal_t irq_signal)
-{
-    __asm volatile("svc     "M2S(TFM_SVC_PSA_EOI)"             \n"
-                   "bx      lr                                 \n");
-}
-
 __naked void psa_panic_svc(void)
 {
     __asm volatile("svc     "M2S(TFM_SVC_PSA_PANIC)"           \n"
                    "bx      lr                                 \n");
 }
 
-__naked void psa_irq_enable_svc(psa_signal_t irq_signal)
-{
-    __asm volatile("svc     "M2S(TFM_SVC_PSA_IRQ_ENABLE)"      \n"
-                   "bx      lr                                 \n");
-}
-
-__naked psa_irq_status_t psa_irq_disable_svc(psa_signal_t irq_signal)
-{
-    __asm volatile("svc     "M2S(TFM_SVC_PSA_IRQ_DISABLE)"     \n"
-                   "bx      lr                                 \n");
-}
-
-__naked void psa_reset_signal_svc(psa_signal_t irq_signal)
-{
-    __asm volatile("svc     "M2S(TFM_SVC_PSA_RESET_SIGNAL)"    \n"
-                   "bx      lr                                 \n");
-}
-
 __naked uint32_t psa_rot_lifecycle_state_svc(void)
 {
     __asm volatile("svc     "M2S(TFM_SVC_PSA_LIFECYCLE)"       \n"
@@ -144,3 +120,37 @@
 }
 
 #endif /* CONFIG_TFM_CONNECTION_BASED_SERVICE_API */
+
+#if CONFIG_TFM_FLIH_API == 1 || CONFIG_TFM_SLIH_API == 1
+
+__naked void psa_irq_enable_svc(psa_signal_t irq_signal)
+{
+    __asm volatile("svc     "M2S(TFM_SVC_PSA_IRQ_ENABLE)"      \n"
+                   "bx      lr                                 \n");
+}
+
+__naked psa_irq_status_t psa_irq_disable_svc(psa_signal_t irq_signal)
+{
+    __asm volatile("svc     "M2S(TFM_SVC_PSA_IRQ_DISABLE)"     \n"
+                   "bx      lr                                 \n");
+}
+
+/* This API is only used for FLIH. */
+#if CONFIG_TFM_FLIH_API == 1
+__naked void psa_reset_signal_svc(psa_signal_t irq_signal)
+{
+    __asm volatile("svc     "M2S(TFM_SVC_PSA_RESET_SIGNAL)"    \n"
+                   "bx      lr                                 \n");
+}
+#endif
+
+/* This API is only used for SLIH. */
+#if CONFIG_TFM_SLIH_API == 1
+__naked void psa_eoi_svc(psa_signal_t irq_signal)
+{
+    __asm volatile("svc     "M2S(TFM_SVC_PSA_EOI)"             \n"
+                   "bx      lr                                 \n");
+}
+#endif
+
+#endif /* CONFIG_TFM_FLIH_API == 1 || CONFIG_TFM_SLIH_API == 1 */
diff --git a/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c b/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c
index 64dd210..1ff754e 100644
--- a/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c
+++ b/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c
@@ -65,9 +65,6 @@
     case TFM_SVC_PSA_CLEAR:
         tfm_spm_partition_psa_clear();
         break;
-    case TFM_SVC_PSA_EOI:
-        tfm_spm_partition_psa_eoi((psa_signal_t)ctx[0]);
-        break;
     case TFM_SVC_PSA_PANIC:
         tfm_spm_partition_psa_panic();
         break;
@@ -94,18 +91,31 @@
         tfm_spm_partition_psa_reply((psa_handle_t)ctx[0], (psa_status_t)ctx[1]);
         break;
 #endif /* CONFIG_TFM_SPM_BACKEND_IPC == 1 */
-#if TFM_SP_LOG_RAW_ENABLED
-    case TFM_SVC_OUTPUT_UNPRIV_STRING:
-        return tfm_hal_output_spm_log((const char *)ctx[0], ctx[1]);
-#endif
+
+#if CONFIG_TFM_FLIH_API == 1 || CONFIG_TFM_SLIH_API == 1
     case TFM_SVC_PSA_IRQ_ENABLE:
         tfm_spm_partition_psa_irq_enable((psa_signal_t)ctx[0]);
         break;
     case TFM_SVC_PSA_IRQ_DISABLE:
         return tfm_spm_partition_psa_irq_disable((psa_signal_t)ctx[0]);
+/* This API is only used for FLIH. */
+#if CONFIG_TFM_FLIH_API == 1
     case TFM_SVC_PSA_RESET_SIGNAL:
         tfm_spm_partition_psa_reset_signal((psa_signal_t)ctx[0]);
         break;
+#endif
+/* This API is only used for SLIH. */
+#if CONFIG_TFM_SLIH_API == 1
+    case TFM_SVC_PSA_EOI:
+        tfm_spm_partition_psa_eoi((psa_signal_t)ctx[0]);
+        break;
+#endif
+#endif /* CONFIG_TFM_FLIH_API == 1 || CONFIG_TFM_SLIH_API == 1 */
+
+#if TFM_SP_LOG_RAW_ENABLED
+    case TFM_SVC_OUTPUT_UNPRIV_STRING:
+        return tfm_hal_output_spm_log((const char *)ctx[0], ctx[1]);
+#endif
     default:
 #ifdef PLATFORM_SVC_HANDLERS
         return (platform_svc_handlers(svc_num, ctx, lr));
diff --git a/secure_fw/spm/ffm/psa_api.c b/secure_fw/spm/ffm/psa_api.c
index e115a83..c8ede67 100644
--- a/secure_fw/spm/ffm/psa_api.c
+++ b/secure_fw/spm/ffm/psa_api.c
@@ -877,38 +877,6 @@
     CRITICAL_SECTION_LEAVE(cs_assert);
 }
 
-void tfm_spm_partition_psa_eoi(psa_signal_t irq_signal)
-{
-    struct critical_section_t cs_assert = CRITICAL_SECTION_STATIC_INIT;
-    struct irq_load_info_t *irq_info = NULL;
-    struct partition_t *partition = NULL;
-
-    partition = GET_CURRENT_COMPONENT();
-
-    irq_info = get_irq_info_for_signal(partition->p_ldinf, irq_signal);
-    /* It is a fatal error if passed signal is not an interrupt signal. */
-    if (!irq_info) {
-        tfm_core_panic();
-    }
-
-    if (irq_info->flih_func) {
-        /* This API is for SLIH IRQs only */
-        tfm_core_panic();
-    }
-
-    /* It is a fatal error if passed signal is not currently asserted */
-    if ((partition->signals_asserted & irq_signal) == 0) {
-        tfm_core_panic();
-    }
-
-    CRITICAL_SECTION_ENTER(cs_assert);
-    partition->signals_asserted &= ~irq_signal;
-    CRITICAL_SECTION_LEAVE(cs_assert);
-
-    tfm_hal_irq_clear_pending(irq_info->source);
-    tfm_hal_irq_enable(irq_info->source);
-}
-
 void tfm_spm_partition_psa_panic(void)
 {
     /*
@@ -918,6 +886,31 @@
     tfm_hal_system_reset();
 }
 
+/* psa_set_rhandle is only needed by connection-based services */
+#if CONFIG_TFM_CONNECTION_BASED_SERVICE_API == 1
+
+void tfm_spm_partition_psa_set_rhandle(psa_handle_t msg_handle, void *rhandle)
+{
+    struct conn_handle_t *hdl;
+
+    /* It is a fatal error if message handle is invalid */
+    hdl = spm_get_handle_by_user_handle(msg_handle);
+    if (!hdl) {
+        tfm_core_panic();
+    }
+
+    /* It is a PROGRAMMER ERROR if a stateless service sets rhandle. */
+    if (SERVICE_IS_STATELESS(hdl->service->p_ldinf->flags)) {
+        tfm_core_panic();
+    }
+
+    hdl->msg.rhandle = rhandle;
+    hdl->rhandle = rhandle;
+}
+
+#endif /* CONFIG_TFM_CONNECTION_BASED_SERVICE_API */
+
+#if CONFIG_TFM_FLIH_API == 1 || CONFIG_TFM_SLIH_API == 1
 void tfm_spm_partition_psa_irq_enable(psa_signal_t irq_signal)
 {
     struct partition_t *partition;
@@ -950,6 +943,8 @@
     return 1;
 }
 
+/* This API is only used for FLIH. */
+#if CONFIG_TFM_FLIH_API == 1
 void tfm_spm_partition_psa_reset_signal(psa_signal_t irq_signal)
 {
     struct critical_section_t cs_assert = CRITICAL_SECTION_STATIC_INIT;
@@ -977,30 +972,43 @@
     partition->signals_asserted &= ~irq_signal;
     CRITICAL_SECTION_LEAVE(cs_assert);
 }
+#endif
 
-/* psa_set_rhandle is only needed by connection-based services */
-#if CONFIG_TFM_CONNECTION_BASED_SERVICE_API == 1
-
-void tfm_spm_partition_psa_set_rhandle(psa_handle_t msg_handle, void *rhandle)
+/* This API is only used for SLIH. */
+#if CONFIG_TFM_SLIH_API == 1
+void tfm_spm_partition_psa_eoi(psa_signal_t irq_signal)
 {
-    struct conn_handle_t *hdl;
+    struct critical_section_t cs_assert = CRITICAL_SECTION_STATIC_INIT;
+    struct irq_load_info_t *irq_info = NULL;
+    struct partition_t *partition = NULL;
 
-    /* It is a fatal error if message handle is invalid */
-    hdl = spm_get_handle_by_user_handle(msg_handle);
-    if (!hdl) {
+    partition = GET_CURRENT_COMPONENT();
+
+    irq_info = get_irq_info_for_signal(partition->p_ldinf, irq_signal);
+    /* It is a fatal error if passed signal is not an interrupt signal. */
+    if (!irq_info) {
         tfm_core_panic();
     }
 
-    /* It is a PROGRAMMER ERROR if a stateless service sets rhandle. */
-    if (SERVICE_IS_STATELESS(hdl->service->p_ldinf->flags)) {
+    if (irq_info->flih_func) {
+        /* This API is for SLIH IRQs only */
         tfm_core_panic();
     }
 
-    hdl->msg.rhandle = rhandle;
-    hdl->rhandle = rhandle;
+    /* It is a fatal error if passed signal is not currently asserted */
+    if ((partition->signals_asserted & irq_signal) == 0) {
+        tfm_core_panic();
+    }
+
+    CRITICAL_SECTION_ENTER(cs_assert);
+    partition->signals_asserted &= ~irq_signal;
+    CRITICAL_SECTION_LEAVE(cs_assert);
+
+    tfm_hal_irq_clear_pending(irq_info->source);
+    tfm_hal_irq_enable(irq_info->source);
 }
-
-#endif /* CONFIG_TFM_CONNECTION_BASED_SERVICE_API */
+#endif
+#endif /* CONFIG_TFM_FLIH_API == 1 || CONFIG_TFM_SLIH_API == 1 */
 
 #if PSA_FRAMEWORK_HAS_MM_IOVEC
 
diff --git a/secure_fw/spm/include/ffm/psa_api.h b/secure_fw/spm/include/ffm/psa_api.h
index ddd7769..0322fa9 100644
--- a/secure_fw/spm/include/ffm/psa_api.h
+++ b/secure_fw/spm/include/ffm/psa_api.h
@@ -278,27 +278,31 @@
 void tfm_spm_partition_psa_clear(void);
 
 /**
- * \brief Function body of \ref psa_eoi.
- *
- * \param[in] irq_signal        The interrupt signal that has been processed.
- *
- * \retval void                 Success.
- * \retval "PROGRAMMER ERROR"   The call is invalid, one or more of the
- *                              following are true:
- * \arg                           irq_signal is not an interrupt signal.
- * \arg                           irq_signal indicates more than one signal.
- * \arg                           irq_signal is not currently asserted.
- * \arg                           The interrupt is not using SLIH.
- */
-void tfm_spm_partition_psa_eoi(psa_signal_t irq_signal);
-
-/**
  * \brief Function body of \ref psa_panic.
  *
  * \retval "Does not return"
  */
 void tfm_spm_partition_psa_panic(void);
 
+/* psa_set_rhandle is only needed by connection-based services */
+#if CONFIG_TFM_CONNECTION_BASED_SERVICE_API == 1
+
+/**
+ * \brief Function body of \ref psa_set_rhandle.
+ *
+ * \param[in] msg_handle        Handle for the client's message.
+ * \param[in] rhandle           Reverse handle allocated by the RoT Service.
+ *
+ * \retval void                 Success, rhandle will be provided with all
+ *                              subsequent messages delivered on this
+ *                              connection.
+ * \retval "PROGRAMMER ERROR"   msg_handle is invalid.
+ */
+void tfm_spm_partition_psa_set_rhandle(psa_handle_t msg_handle, void *rhandle);
+
+#endif /* CONFIG_TFM_CONNECTION_BASED_SERVICE_API */
+
+#if CONFIG_TFM_FLIH_API == 1 || CONFIG_TFM_SLIH_API == 1
 /**
  * \brief Function body of \ref psa_irq_enable.
  *
@@ -332,6 +336,8 @@
  */
 psa_irq_status_t tfm_spm_partition_psa_irq_disable(psa_signal_t irq_signal);
 
+/* This API is only used for FLIH. */
+#if CONFIG_TFM_FLIH_API == 1
 /**
  * \brief Function body of \ref psa_reset_signal.
  *
@@ -349,24 +355,26 @@
  * \arg                       \a irq_signal is not currently asserted.
  */
 void tfm_spm_partition_psa_reset_signal(psa_signal_t irq_signal);
+#endif
 
-/* psa_set_rhandle is only needed by connection-based services */
-#if CONFIG_TFM_CONNECTION_BASED_SERVICE_API == 1
-
+/* This API is only used for SLIH. */
+#if CONFIG_TFM_SLIH_API == 1
 /**
- * \brief Function body of \ref psa_set_rhandle.
+ * \brief Function body of \ref psa_eoi.
  *
- * \param[in] msg_handle        Handle for the client's message.
- * \param[in] rhandle           Reverse handle allocated by the RoT Service.
+ * \param[in] irq_signal        The interrupt signal that has been processed.
  *
- * \retval void                 Success, rhandle will be provided with all
- *                              subsequent messages delivered on this
- *                              connection.
- * \retval "PROGRAMMER ERROR"   msg_handle is invalid.
+ * \retval void                 Success.
+ * \retval "PROGRAMMER ERROR"   The call is invalid, one or more of the
+ *                              following are true:
+ * \arg                           irq_signal is not an interrupt signal.
+ * \arg                           irq_signal indicates more than one signal.
+ * \arg                           irq_signal is not currently asserted.
+ * \arg                           The interrupt is not using SLIH.
  */
-void tfm_spm_partition_psa_set_rhandle(psa_handle_t msg_handle, void *rhandle);
-
-#endif /* CONFIG_TFM_CONNECTION_BASED_SERVICE_API */
+void tfm_spm_partition_psa_eoi(psa_signal_t irq_signal);
+#endif
+#endif /* CONFIG_TFM_FLIH_API == 1 || CONFIG_TFM_SLIH_API == 1 */
 
 #if PSA_FRAMEWORK_HAS_MM_IOVEC
 
diff --git a/tools/tfm_parse_manifest_list.py b/tools/tfm_parse_manifest_list.py
index 32b06dd..63cda08 100644
--- a/tools/tfm_parse_manifest_list.py
+++ b/tools/tfm_parse_manifest_list.py
@@ -145,7 +145,9 @@
     partition_statistics = {
         'connection_based_srv_num': 0,
         'ipc_partition_num': 0,
-        'sfn_partition_num': 0
+        'sfn_partition_num': 0,
+        'flih_num': 0,
+        'slih_num': 0
     }
     config_impl = {
         'CONFIG_TFM_SPM_BACKEND_SFN'              : '0',
@@ -153,7 +155,9 @@
         'CONFIG_TFM_PSA_API_SFN_CALL'             : '0',
         'CONFIG_TFM_PSA_API_CROSS_CALL'           : '0',
         'CONFIG_TFM_PSA_API_SUPERVISOR_CALL'      : '0',
-        'CONFIG_TFM_CONNECTION_BASED_SERVICE_API' : '0'
+        'CONFIG_TFM_CONNECTION_BASED_SERVICE_API' : '0',
+        'CONFIG_TFM_FLIH_API'                     : '0',
+        'CONFIG_TFM_SLIH_API'                     : '0'
     }
 
     # Get all the manifests information as a dictionary
@@ -234,6 +238,12 @@
             elif service['connection_based']:
                 partition_statistics['connection_based_srv_num'] += 1
 
+        for irq in manifest.get('irqs', []):
+            if irq.get('handling', None) == 'FLIH':
+                partition_statistics['flih_num'] += 1
+            else:
+                partition_statistics['slih_num'] += 1
+
         manifest_out_basename = os.path.splitext(os.path.basename(manifest_path))[0]
 
         if 'output_path' in manifest_item:
@@ -290,6 +300,11 @@
     if partition_statistics['connection_based_srv_num'] > 0:
         config_impl['CONFIG_TFM_CONNECTION_BASED_SERVICE_API'] = 1
 
+    if partition_statistics['flih_num'] > 0:
+        config_impl['CONFIG_TFM_FLIH_API'] = 1
+    elif partition_statistics['slih_num'] > 0:
+        config_impl['CONFIG_TFM_SLIH_API'] = 1
+
     context['partitions'] = partition_list
     context['config_impl'] = config_impl
     context['stateless_services'] = process_stateless_services(partition_list)