mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2026-09-20 15:21:42 +01:00
lib: sbi_timer: add TSA annotations
Add Thread Safety Analysis (TSA) annotations for the timer implementation. This includes indicating which fields are protected by a spinlock, and annotating which functions must be called under a spinlock. Exclude sbi_timer_init(), as the spinlock cannot be acquired before it is initialized. Signed-off-by: Carlos López <carlos.lopezr4096@gmail.com> Reviewed-by: Anup Patel <anup@brainfault.org> Link: https://lore.kernel.org/r/20260909162322.29778-9-carlos.lopezr4096@gmail.com Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
+4
-1
@@ -23,7 +23,7 @@
|
||||
struct timer_state {
|
||||
u64 time_delta;
|
||||
spinlock_t event_list_lock;
|
||||
struct sbi_dlist event_list;
|
||||
struct sbi_dlist event_list GUARDED_BY(&event_list_lock);
|
||||
struct sbi_timer_event smode_ev;
|
||||
};
|
||||
|
||||
@@ -160,6 +160,7 @@ void sbi_timer_set_delta_upper(ulong delta_upper)
|
||||
#endif
|
||||
|
||||
static void __sbi_timer_update_device(struct timer_state *tstate)
|
||||
MUST_HOLD(&tstate->event_list_lock)
|
||||
{
|
||||
struct sbi_timer_event *ev;
|
||||
|
||||
@@ -188,6 +189,7 @@ static void __sbi_timer_event_stop(struct sbi_timer_event *ev)
|
||||
|
||||
static void __sbi_timer_event_start(struct timer_state *tstate,
|
||||
struct sbi_timer_event *ev, u64 next_event)
|
||||
MUST_HOLD(&tstate->event_list_lock)
|
||||
{
|
||||
struct sbi_timer_event *tev, *next_ev = NULL;
|
||||
|
||||
@@ -350,6 +352,7 @@ void sbi_timer_set_device(const struct sbi_timer_device *dev)
|
||||
}
|
||||
|
||||
int sbi_timer_init(struct sbi_scratch *scratch, bool cold_boot)
|
||||
NO_THREAD_SAFETY_ANALYSIS
|
||||
{
|
||||
const struct sbi_platform *plat = sbi_platform_ptr(scratch);
|
||||
struct timer_state *tstate;
|
||||
|
||||
Reference in New Issue
Block a user