summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHimanshu Chauhan <[email protected]>2023-07-12 10:04:32 +0530
committerAnup Patel <[email protected]>2023-07-13 12:27:50 +0530
commit4a42a2347c757457f455d9293812a32a7552e4d5 (patch)
tree1cee75af77fecf1254a225c3286aadc38a97771c
parentd72f5f17478dfef3df817339a0f02cfdb77a1dc1 (diff)
lib: sbi: Grant SU R/W/X permissions to whole memory
Since pmp entries have implicit priority on index, previous entries will deny access to SU on M-mode region. Also, M-mode will not have access to SU region while previous entries will allow access to M-mode regions. Signed-off-by: Himanshu Chauhan <[email protected]> Reviewed-by: Anup Patel <[email protected]>
-rw-r--r--lib/sbi/sbi_domain.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c
index 38a5902f..acd0f74c 100644
--- a/lib/sbi/sbi_domain.c
+++ b/lib/sbi/sbi_domain.c
@@ -772,11 +772,17 @@ int sbi_domain_init(struct sbi_scratch *scratch, u32 cold_hartid)
root.fw_region_inited = true;
- /* Root domain allow everything memory region */
+ /*
+ * Allow SU RWX on rest of the memory region. Since pmp entries
+ * have implicit priority on index, previous entries will
+ * deny access to SU on M-mode region. Also, M-mode will not
+ * have access to SU region while previous entries will allow
+ * access to M-mode regions.
+ */
sbi_domain_memregion_init(0, ~0UL,
- (SBI_DOMAIN_MEMREGION_READABLE |
- SBI_DOMAIN_MEMREGION_WRITEABLE |
- SBI_DOMAIN_MEMREGION_EXECUTABLE),
+ (SBI_DOMAIN_MEMREGION_SU_READABLE |
+ SBI_DOMAIN_MEMREGION_SU_WRITABLE |
+ SBI_DOMAIN_MEMREGION_SU_EXECUTABLE),
&root_memregs[root_memregs_count++]);
/* Root domain memory region end */