diff options
author | Vasant Hegde <hegdevasant@linux.vnet.ibm.com> | 2018-04-23 12:15:32 +0530 |
---|---|---|
committer | Stewart Smith <stewart@linux.ibm.com> | 2018-04-30 19:04:42 -0500 |
commit | d7e7bdcd4accff9fb75579b43be72bc3c201d161 (patch) | |
tree | 0641e6c0ec772449322c053024a70da759d51a24 /core/timer.c | |
parent | 6421fc56dc289c8d14a1ce9eddbb88d3687fbb77 (diff) | |
download | talos-skiboot-d7e7bdcd4accff9fb75579b43be72bc3c201d161.tar.gz talos-skiboot-d7e7bdcd4accff9fb75579b43be72bc3c201d161.zip |
SBE: Add timer support
SBE on P9 provides one shot programmable timer facility. We can use this
to implement OPAL timers and hence limit the reliance on the Linux
heartbeat (similar to HW timer facility provided by SLW on P8).
Design:
- We will continue to run Linux heartbeat.
- Each chip has SBE. This patch always schedules timer on SBE on master chip.
- Start timer option starts new timer or modifies an active timer for the
specified timeout.
- SBE expects timeout value in microseconds. We track timeout value in TB.
Hence we convert tb to microseconds before sending request to SBE.
- We are requesting ack from SBE for timer message. It gaurantees that
SBE has scheduled timer.
- Disabling SBE timer
We expect SBE to send timer expiry interrupt whenever timer expires. We
wait for 10 more ms before disabling timer.
In future we can consider below alternative approaches:
- Presently SBE timer disable is permanent (until we reboot system).
SBE sends "I'm back" interrupt after reset. We can consider restarting
timer after SBE reset.
- Reset SBE and start timer again.
- Each chip has SBE. On multi chip system we can try to schedule timer
on different chip.
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'core/timer.c')
-rw-r--r-- | core/timer.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/core/timer.c b/core/timer.c index 21f62a49..8eefb74b 100644 --- a/core/timer.c +++ b/core/timer.c @@ -5,6 +5,7 @@ #include <device.h> #include <opal.h> #include <sbe-p8.h> +#include <sbe-p9.h> #ifdef __TEST__ #define this_cpu() ((void *)-1) @@ -109,8 +110,12 @@ static void __schedule_timer_at(struct timer *t, uint64_t when) bail: /* Pick up the next timer and upddate the SBE HW timer */ lt = list_top(&timer_list, struct timer, link); - if (lt) - p8_sbe_update_timer_expiry(lt->target); + if (lt) { + if (proc_gen < proc_gen_p9) + p8_sbe_update_timer_expiry(lt->target); + else + p9_sbe_update_timer_expiry(lt->target); + } } void schedule_timer_at(struct timer *t, uint64_t when) @@ -167,7 +172,11 @@ static void __check_poll_timers(uint64_t now) * arbitrarily 1us. */ if (t->running) { - p8_sbe_update_timer_expiry(now + usecs_to_tb(1)); + if (proc_gen < proc_gen_p9) + p8_sbe_update_timer_expiry(now + usecs_to_tb(1)); + else + p9_sbe_update_timer_expiry(now + usecs_to_tb(1)); + break; } @@ -266,6 +275,8 @@ void late_init_timers(void) */ if (platform.heartbeat_time) { heartbeat = platform.heartbeat_time(); + } else if (p9_sbe_timer_ok()) { + heartbeat = HEARTBEAT_DEFAULT_MS * 10; } else if (p8_sbe_timer_ok() || fsp_present()) { heartbeat = HEARTBEAT_DEFAULT_MS * 10; } |