summaryrefslogtreecommitdiff
path: root/spm
diff options
context:
space:
mode:
authorMadhukar Pappireddy <madhukar.pappireddy@arm.com>2022-02-15 15:52:53 -0600
committerMadhukar Pappireddy <madhukar.pappireddy@arm.com>2022-03-22 13:09:39 -0500
commitf4c8e8d159cb7613e4bc55c007bc9dd339a4c710 (patch)
tree45325b64331af49d566857dd3b441ba2c1fc4d4f /spm
parentca8264cd529512acd6b306434fed658372815277 (diff)
feat(interrupts): query last serviced interrupt
This patch introduces a helper API to request Cactus SP to return the ID of the last serviced secure virtual interrupt. It is built on cactus command framework by leveraging direct message request and response pair. Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com> Change-Id: I316268f4d9b80f29c308d1a1488945a272ffbc93
Diffstat (limited to 'spm')
-rw-r--r--spm/cactus/cactus_interrupt.c6
-rw-r--r--spm/cactus/cactus_tests/cactus_test_interrupts.c11
2 files changed, 17 insertions, 0 deletions
diff --git a/spm/cactus/cactus_interrupt.c b/spm/cactus/cactus_interrupt.c
index f0d916f..2305b01 100644
--- a/spm/cactus/cactus_interrupt.c
+++ b/spm/cactus/cactus_interrupt.c
@@ -22,11 +22,15 @@ extern void notification_pending_interrupt_handler(void);
extern ffa_id_t g_ffa_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];
void cactus_interrupt_handler(void)
{
uint32_t intid = spm_interrupt_get();
+ unsigned int core_pos = get_current_core_id();
switch (intid) {
case MANAGED_EXIT_INTERRUPT_ID:
@@ -62,6 +66,8 @@ void cactus_interrupt_handler(void)
panic();
}
+ last_serviced_interrupt[core_pos] = intid;
+
/* Invoke the tail end handler registered by the SP. */
spin_lock(&sp_handler_lock[intid]);
if (sp_interrupt_tail_end_handler[intid]) {
diff --git a/spm/cactus/cactus_tests/cactus_test_interrupts.c b/spm/cactus/cactus_tests/cactus_test_interrupts.c
index 3fa5f23..dc64512 100644
--- a/spm/cactus/cactus_tests/cactus_test_interrupts.c
+++ b/spm/cactus/cactus_tests/cactus_test_interrupts.c
@@ -14,6 +14,8 @@
#include <platform.h>
+/* Secure virtual interrupt that was last handled by Cactus SP. */
+extern uint32_t last_serviced_interrupt[PLATFORM_CORE_COUNT];
static int flag_set;
static void sec_wdog_interrupt_handled(void)
@@ -167,3 +169,12 @@ fail:
ffa_dir_msg_source(*args),
CACTUS_ERROR_TEST);
}
+
+CACTUS_CMD_HANDLER(interrupt_serviced_cmd, CACTUS_LAST_INTERRUPT_SERVICED_CMD)
+{
+ unsigned int core_pos = get_current_core_id();
+
+ return cactus_response(ffa_dir_msg_dest(*args),
+ ffa_dir_msg_source(*args),
+ last_serviced_interrupt[core_pos]);
+}