summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrew Jones <ajones@ventanamicro.com>2023-02-27 13:31:03 +0300
committerAnup Patel <anup@brainfault.org>2023-02-27 17:15:28 +0300
commitc9917b610871e4f9a0142e5c37c2b698177c3291 (patch)
tree5685156890cc43ed70304ed61080e251a299fd87 /lib
parent73623a0acac7f62646757cdd5a03b325eba3e0c9 (diff)
downloadopensbi-c9917b610871e4f9a0142e5c37c2b698177c3291.tar.xz
lib: sbi: Add system_suspend_allowed domain property
Only privileged domains should be allowed to suspend the entire system. Give the root domain this property by default and allow other domains to be given the property by specifying it in the DT. Signed-off-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/sbi/sbi_domain.c4
-rw-r--r--lib/utils/fdt/fdt_domain.c7
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c
index d2f58a2..4d7b80a 100644
--- a/lib/sbi/sbi_domain.c
+++ b/lib/sbi/sbi_domain.c
@@ -38,6 +38,7 @@ struct sbi_domain root = {
.possible_harts = &root_hmask,
.regions = root_memregs,
.system_reset_allowed = true,
+ .system_suspend_allowed = true,
};
bool sbi_domain_is_assigned_hart(const struct sbi_domain *dom, u32 hartid)
@@ -467,6 +468,9 @@ void sbi_domain_dump(const struct sbi_domain *dom, const char *suffix)
sbi_printf("Domain%d SysReset %s: %s\n",
dom->index, suffix, (dom->system_reset_allowed) ? "yes" : "no");
+
+ sbi_printf("Domain%d SysSuspend %s: %s\n",
+ dom->index, suffix, (dom->system_suspend_allowed) ? "yes" : "no");
}
void sbi_domain_dump_all(const char *suffix)
diff --git a/lib/utils/fdt/fdt_domain.c b/lib/utils/fdt/fdt_domain.c
index bc30010..adcb94b 100644
--- a/lib/utils/fdt/fdt_domain.c
+++ b/lib/utils/fdt/fdt_domain.c
@@ -417,6 +417,13 @@ static int __fdt_parse_domain(void *fdt, int domain_offset, void *opaque)
else
dom->system_reset_allowed = false;
+ /* Read "system-suspend-allowed" DT property */
+ if (fdt_get_property(fdt, domain_offset,
+ "system-suspend-allowed", NULL))
+ dom->system_suspend_allowed = true;
+ else
+ dom->system_suspend_allowed = false;
+
/* Find /cpus DT node */
cpus_offset = fdt_path_offset(fdt, "/cpus");
if (cpus_offset < 0)