diff options
author | Anup Patel <anup.patel@wdc.com> | 2020-09-18 14:37:49 +0300 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2020-10-20 08:52:15 +0300 |
commit | b1678af210dc4b4e6d586d6d96617e9641618994 (patch) | |
tree | 05bd3bb3d4e823978c426acf06e428425d035535 /include/sbi/sbi_platform.h | |
parent | 8b650050ecb61da143ee18fc150dd95ac5b0eca1 (diff) | |
download | opensbi-b1678af210dc4b4e6d586d6d96617e9641618994.tar.xz |
lib: sbi: Add initial domain support
An OpenSBI domain is a logical entity representing a set of HARTs
and a set of memory regions for these HARTs.
The OpenSBI domains support will allow OpenSBI platforms and previous
booting stage (i.e. U-Boot SPL, Coreboot, etc) to partition a system
into multiple domains where each domain will run it's own software.
For inter-domain isolation, OpenSBI will eventually use various HW
features such as PMP, ePMP, IOPMP, SiFive shield, etc but initial
implementation only use HW PMP support.
This patch provides initial implementation of OpenSBI domains where
we have a root/default domain and OpenSBI platforms can provide
non-root/custom domains using domain_get() callback.
Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
Diffstat (limited to 'include/sbi/sbi_platform.h')
-rw-r--r-- | include/sbi/sbi_platform.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/sbi/sbi_platform.h b/include/sbi/sbi_platform.h index f2c3237..e1355d8 100644 --- a/include/sbi/sbi_platform.h +++ b/include/sbi/sbi_platform.h @@ -44,6 +44,7 @@ #include <sbi/sbi_scratch.h> #include <sbi/sbi_version.h> +struct sbi_domain; struct sbi_trap_info; /** Possible feature flags of a platform */ @@ -89,6 +90,9 @@ struct sbi_platform_operations { */ int (*misa_get_xlen)(void); + /** Get domain pointer for given HART id */ + struct sbi_domain *(*domain_get)(u32 hartid); + /** Write a character to the platform console output */ void (*console_putc)(char ch); /** Read a character from the platform console input */ @@ -448,6 +452,22 @@ static inline int sbi_platform_misa_xlen(const struct sbi_platform *plat) } /** + * Get domain pointer for given HART + * + * @param plat pointer to struct sbi_platform + * @param hartid shorthand letter for CPU extensions + * + * @return non-NULL domain pointer on success and NULL on failure + */ +static inline struct sbi_domain *sbi_platform_domain_get( + const struct sbi_platform *plat, u32 hartid) +{ + if (plat && sbi_platform_ops(plat)->domain_get) + return sbi_platform_ops(plat)->domain_get(hartid); + return NULL; +} + +/** * Write a character to the platform console output * * @param plat pointer to struct sbi_platform |