[PATCH v2 0/4] Timer events for OpenSBI

Anup Patel anup at brainfault.org
Sat May 9 00:46:42 PDT 2026


On Sat, Apr 25, 2026 at 4:10 PM Anup Patel <anup.patel at oss.qualcomm.com> wrote:
>
> This series extends the sbi_timer framework to support
> timer events usable from any part of OpenSBI. The platform
> drivers in OpenSBI can use timer events for timeouts or
> periodic checks.
>
> These patches can also be found in sbi_timer_imp_v2 branch
> at: https://github.com/avpatel/opensbi.git
>
> Changes since v1:
> - New PATCH4 adding sbi_timer_compute_delta() and friends
> - Fix typo on cleanup() comments of struct sbi_timer_event
> - Remove the spin_unlock()/lock() dance from sbi_timer_event_start()
>   and sbi_timer_exit()
> - Update timer device in sbi_timer_event_stop() only when
>   required (i.e. ev->hart_index != current_hartindex())
> - Break the loop in sbi_timer_process() when
>   ev->time_stamp > sbi_timer_value())
> - Allow callback() function in struct sbi_timer_event to
>   optionally provide event re-start details
>
> Anup Patel (4):
>   include: sbi: Add sbi_scratch_hartindex() macro
>   lib: sbi_timer: Introduce per-HART timer state
>   lib: sbi_timer: Add support for timer events
>   lib: sbi_timer: Introduce sbi_timer_compute_delta() and friends
>
>  include/sbi/sbi_scratch.h  |   6 +-
>  include/sbi/sbi_timer.h    |  92 ++++++++++++-
>  lib/sbi/sbi_ecall_legacy.c |   4 +-
>  lib/sbi/sbi_ecall_time.c   |   4 +-
>  lib/sbi/sbi_timer.c        | 256 +++++++++++++++++++++++++++++++------
>  5 files changed, 314 insertions(+), 48 deletions(-)
>
> --
> 2.43.0
>

Applied this series to the riscv/opensbi repo.

Thanks,
Anup



More information about the opensbi mailing list