feat(interrupts): discover interrupt ID of managed exit signal
Added support for discovering managed exit interrupt ID in Cactus SP
using FFA_FEATURES ABI during partition initialization.
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
Change-Id: I0b6ea04fc18d6903d821e2f890e4e0a4ad5d568a
diff --git a/spm/cactus/cactus_interrupt.c b/spm/cactus/cactus_interrupt.c
index 02d1fbf..e08c4dd 100644
--- a/spm/cactus/cactus_interrupt.c
+++ b/spm/cactus/cactus_interrupt.c
@@ -21,12 +21,29 @@
extern void notification_pending_interrupt_handler(void);
extern ffa_id_t g_ffa_id;
+static uint32_t managed_exit_interrupt_id;
/* Secure virtual interrupt that was last handled by Cactus SP. */
uint32_t last_serviced_interrupt[PLATFORM_CORE_COUNT];
extern spinlock_t sp_handler_lock[NUM_VINT_ID];
+/*
+ * Managed exit ID discoverable by querying the SPMC through
+ * FFA_FEATURES API.
+ */
+void discover_managed_exit_interrupt_id(void)
+{
+ struct ffa_value ffa_ret;
+
+ /* Interrupt ID value is returned through register W2. */
+ ffa_ret = ffa_features(FFA_FEATURE_MEI);
+ managed_exit_interrupt_id = ffa_feature_intid(ffa_ret);
+
+ VERBOSE("Discovered managed exit interrupt ID: %d\n",
+ managed_exit_interrupt_id);
+}
+
void cactus_interrupt_handler(void)
{
uint32_t intid = spm_interrupt_get();
diff --git a/spm/cactus/cactus_main.c b/spm/cactus/cactus_main.c
index 5a274f6..8cd4cf1 100644
--- a/spm/cactus/cactus_main.c
+++ b/spm/cactus/cactus_main.c
@@ -316,6 +316,7 @@
cactus_print_memory_layout(ffa_id);
register_secondary_entrypoint();
+ discover_managed_exit_interrupt_id();
/* Invoking Tests */
ffa_tests(&mb);
diff --git a/spm/common/sp_helpers.h b/spm/common/sp_helpers.h
index ef60221..98af484 100644
--- a/spm/common/sp_helpers.h
+++ b/spm/common/sp_helpers.h
@@ -78,4 +78,6 @@
/* Un-register the handler. */
void sp_unregister_interrupt_tail_end_handler(uint32_t interrupt_id);
+void discover_managed_exit_interrupt_id(void);
+
#endif /* SP_HELPERS_H */