fix(timer): enable virtual timer in respective test
The virtual timer interrupt was enabled from main function.
Enablement HVC is implementation defined to Hafnium SPMC.
Cactus SP is loaded on top of EL3 SPMC tests in spm-l3-boot-tests
group, which failed due to enablement function.
This patch moves the code enabling code from cactus main
into the respective command handler to operate the architectural
timer.
Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: Iee7b884003ca1e9b7fcee4e89b563970ffe753a0
diff --git a/spm/cactus/cactus_tests/cactus_test_timer.c b/spm/cactus/cactus_tests/cactus_test_timer.c
index 6c8af0c..246afe2 100644
--- a/spm/cactus/cactus_tests/cactus_test_timer.c
+++ b/spm/cactus/cactus_tests/cactus_test_timer.c
@@ -7,6 +7,7 @@
#include "cactus_message_loop.h"
#include "cactus_test_cmds.h"
#include "debug.h"
+#include <spm_helpers.h>
uint32_t ms_to_ticks(uint64_t ms)
{
@@ -19,7 +20,12 @@
uint64_t wait_time = cactus_get_timer_wait_time(*args);
uint32_t ticks = ms_to_ticks(deadline_ms);
+ /* Disable the arch timer. */
write_cntp_ctl_el0(0);
+
+ /* Enable the arch timer virtual interrupt. */
+ spm_interrupt_enable(TIMER_VIRTUAL_INTID, true, 0);
+
write_cntp_tval_el0(ticks);
write_cntp_ctl_el0(1);