diff options
author | Alvin Chang <alvinga@andestech.com> | 2024-04-16 13:02:13 +0800 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2024-05-07 20:11:30 +0530 |
commit | 17e829129d60d7d178d47ecbd8990e705690d352 (patch) | |
tree | cdfcf23509ccda4a7ea12bb2e3936c3e89d622db /include/sbi | |
parent | 1d89a9da64e4b4f51c59c44eba2f65b037bc4d95 (diff) | |
download | opensbi-17e829129d60d7d178d47ecbd8990e705690d352.zip opensbi-17e829129d60d7d178d47ecbd8990e705690d352.tar.gz opensbi-17e829129d60d7d178d47ecbd8990e705690d352.tar.bz2 |
sbi: sbi_domain_context: Add spinlock for updating domain assigned_harts
Add spinlock protection to avoid race condition on assigned_harts
during domain context switching. Also, rename/add variables for
accessing the corresponding domain of target/current context.
Signed-off-by: Alvin Chang <alvinga@andestech.com>
Reviewed-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'include/sbi')
-rw-r--r-- | include/sbi/sbi_domain.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/sbi/sbi_domain.h b/include/sbi/sbi_domain.h index 4706cfc..a6e99c6 100644 --- a/include/sbi/sbi_domain.h +++ b/include/sbi/sbi_domain.h @@ -10,6 +10,7 @@ #ifndef __SBI_DOMAIN_H__ #define __SBI_DOMAIN_H__ +#include <sbi/riscv_locks.h> #include <sbi/sbi_types.h> #include <sbi/sbi_hartmask.h> #include <sbi/sbi_domain_context.h> @@ -173,6 +174,8 @@ struct sbi_domain { * in the coldboot path */ struct sbi_hartmask assigned_harts; + /** Spinlock for accessing assigned_harts */ + spinlock_t assigned_harts_lock; /** Name of this domain */ char name[64]; /** Possible HARTs in this domain */ |