feat(timer): support PPI timer interrupts
Add support for timers that use a PPI as timer interrupt. A new
function, tftf_initialise_timer_secondary_core(), is added to initialize
the PPI on the secondary CPUs from tftf_warm_boot_main().
Change-Id: Ia343ce10b0b51e72b9e520b1fab0ea7ba0a43f2c
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
diff --git a/include/lib/timer.h b/include/lib/timer.h
index 0bfff01..ff57cbd 100644
--- a/include/lib/timer.h
+++ b/include/lib/timer.h
@@ -32,6 +32,8 @@
*/
int tftf_initialise_timer(void);
+void tftf_initialise_timer_secondary_core(void);
+
/*
* Requests the timer framework to send an interrupt after milli_secs.
* The interrupt is sent to the calling core of this api. The actual
diff --git a/lib/power_management/hotplug/hotplug.c b/lib/power_management/hotplug/hotplug.c
index 76fa287..5c68642 100644
--- a/lib/power_management/hotplug/hotplug.c
+++ b/lib/power_management/hotplug/hotplug.c
@@ -303,6 +303,7 @@
/* Enable the SGI used by the timer management framework */
tftf_irq_enable(IRQ_WAKE_SGI, GIC_HIGHEST_NS_PRIORITY);
+ tftf_initialise_timer_secondary_core();
enable_irq();
diff --git a/tftf/framework/timer/timer_framework.c b/tftf/framework/timer/timer_framework.c
index 49fd07f..46fe987 100644
--- a/tftf/framework/timer/timer_framework.c
+++ b/tftf/framework/timer/timer_framework.c
@@ -96,6 +96,14 @@
return 0;
}
+void tftf_initialise_timer_secondary_core(void)
+{
+ if (!IS_SPI(TIMER_IRQ)) {
+ arm_gic_set_intr_priority(TIMER_IRQ, GIC_HIGHEST_NS_PRIORITY);
+ arm_gic_intr_enable(TIMER_IRQ);
+ }
+}
+
/*
* It returns the core number of next timer request to be serviced or
* -1 if there is no request from any core. The next service request
@@ -179,7 +187,9 @@
if ((!get_current_prog_time()) || (interrupt_req_time[core_pos] <
(get_current_prog_time() - TIMER_STEP_VALUE))) {
- arm_gic_set_intr_target(TIMER_IRQ, core_pos);
+ if (IS_SPI(TIMER_IRQ)) {
+ arm_gic_set_intr_target(TIMER_IRQ, core_pos);
+ }
rc = PROGRAM_TIMER(time_out_ms);
/* We don't expect timer programming to fail */