mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2026-09-20 15:21:42 +01:00
lib: sbi_domain: add TSA annotations
Add Thread Safety Analysis (TSA) annotations for the domain handling code. This includes indicating which fields are protected by a spinlock, and annotating which functions acquire a spinlock, in order to prevent nesting. Exclude sbi_domain_register() from analysis, as it initializes a domain's spinlock. 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-11-carlos.lopezr4096@gmail.com Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
@@ -193,10 +193,10 @@ struct sbi_domain {
|
||||
struct sbi_domain_state_priv state_priv;
|
||||
/** Logical index of this domain */
|
||||
u32 index;
|
||||
/** HARTs assigned to this domain */
|
||||
struct sbi_hartmask assigned_harts;
|
||||
/** Spinlock for accessing assigned_harts */
|
||||
spinlock_t assigned_harts_lock;
|
||||
/** HARTs assigned to this domain */
|
||||
struct sbi_hartmask assigned_harts GUARDED_BY(&assigned_harts_lock);
|
||||
/** Name of this domain */
|
||||
char name[64];
|
||||
/** Initialization order of this domain */
|
||||
@@ -254,7 +254,8 @@ extern struct sbi_dlist domain_list;
|
||||
* @param hartindex the HART index
|
||||
* @return true if HART is assigned to domain otherwise false
|
||||
*/
|
||||
bool sbi_domain_is_assigned_hart(const struct sbi_domain *dom, u32 hartindex);
|
||||
bool sbi_domain_is_assigned_hart(const struct sbi_domain *dom, u32 hartindex)
|
||||
MUST_NOT_HOLD(&dom->assigned_harts_lock);
|
||||
|
||||
/**
|
||||
* Get the assigned HART mask for given domain
|
||||
@@ -263,7 +264,8 @@ bool sbi_domain_is_assigned_hart(const struct sbi_domain *dom, u32 hartindex);
|
||||
* @return 0 on success and SBI_Exxx (< 0) on failure
|
||||
*/
|
||||
int sbi_domain_get_assigned_hartmask(const struct sbi_domain *dom,
|
||||
struct sbi_hartmask *mask);
|
||||
struct sbi_hartmask *mask)
|
||||
MUST_NOT_HOLD(&dom->assigned_harts_lock);
|
||||
|
||||
/**
|
||||
* Initialize a domain memory region based on it's physical
|
||||
|
||||
Reference in New Issue
Block a user