summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu-Chien Peter Lin <[email protected]>2025-10-08 16:44:41 +0800
committerAnup Patel <[email protected]>2025-11-02 16:26:19 +0530
commitb34caeef815f2e3b54a13e69c8d163bc218712b9 (patch)
tree3f1458a71c9cc37d08b07bd751ae38be799e29e2
parent34657b377f35ab4d0602390e885d1db91e82acf6 (diff)
lib: sbi_domain: add SBI_DOMAIN_MEMREGION_FW memregion flag
Add a new memregion flag, SBI_DOMAIN_MEMREGION_FW and mark the OpenSBI code and data regions. Signed-off-by: Yu-Chien Peter Lin <[email protected]> Reviewed-by: Anup Patel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Anup Patel <[email protected]>
-rw-r--r--include/sbi/sbi_domain.h1
-rw-r--r--lib/sbi/sbi_domain.c8
2 files changed, 7 insertions, 2 deletions
diff --git a/include/sbi/sbi_domain.h b/include/sbi/sbi_domain.h
index a6ee553b..9193feb0 100644
--- a/include/sbi/sbi_domain.h
+++ b/include/sbi/sbi_domain.h
@@ -157,6 +157,7 @@ struct sbi_domain_memregion {
SBI_DOMAIN_MEMREGION_M_EXECUTABLE)
#define SBI_DOMAIN_MEMREGION_MMIO (1UL << 31)
+#define SBI_DOMAIN_MEMREGION_FW (1UL << 30)
unsigned long flags;
};
diff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c
index f7bd7d5b..8b03db12 100644
--- a/lib/sbi/sbi_domain.c
+++ b/lib/sbi/sbi_domain.c
@@ -538,6 +538,8 @@ void sbi_domain_dump(const struct sbi_domain *dom, const char *suffix)
sbi_printf("M: ");
if (reg->flags & SBI_DOMAIN_MEMREGION_MMIO)
sbi_printf("%cI", (k++) ? ',' : '(');
+ if (reg->flags & SBI_DOMAIN_MEMREGION_FW)
+ sbi_printf("%cF", (k++) ? ',' : '(');
if (reg->flags & SBI_DOMAIN_MEMREGION_M_READABLE)
sbi_printf("%cR", (k++) ? ',' : '(');
if (reg->flags & SBI_DOMAIN_MEMREGION_M_WRITABLE)
@@ -891,13 +893,15 @@ int sbi_domain_init(struct sbi_scratch *scratch, u32 cold_hartid)
/* Root domain firmware memory region */
sbi_domain_memregion_init(scratch->fw_start, scratch->fw_rw_offset,
(SBI_DOMAIN_MEMREGION_M_READABLE |
- SBI_DOMAIN_MEMREGION_M_EXECUTABLE),
+ SBI_DOMAIN_MEMREGION_M_EXECUTABLE |
+ SBI_DOMAIN_MEMREGION_FW),
&root_memregs[root_memregs_count++]);
sbi_domain_memregion_init((scratch->fw_start + scratch->fw_rw_offset),
(scratch->fw_size - scratch->fw_rw_offset),
(SBI_DOMAIN_MEMREGION_M_READABLE |
- SBI_DOMAIN_MEMREGION_M_WRITABLE),
+ SBI_DOMAIN_MEMREGION_M_WRITABLE |
+ SBI_DOMAIN_MEMREGION_FW),
&root_memregs[root_memregs_count++]);
root.fw_region_inited = true;