From: Himanshu Chauhan <hchauhan@ventanamicro.com>
To: opensbi@lists.infradead.org
Subject: [PATCH 1/9] include: sbi: Fine grain the permissions for M and SU modes
Date: Tue, 20 Dec 2022 16:16:17 +0530 [thread overview]
Message-ID: <20221220104625.80667-2-hchauhan@ventanamicro.com> (raw)
In-Reply-To: <20221220104625.80667-1-hchauhan@ventanamicro.com>
Split the permissions for M-mode and SU-mode. This would
help if different sections of OpenSBI need to be given
different permissions and if M-mode has different permisssions
than the SU-mode over a region.
Signed-off-by: Himanshu Chauhan <hchauhan@ventanamicro.com>
---
include/sbi/sbi_domain.h | 40 +++++++++++++++++++++++++++++++++++-----
1 file changed, 35 insertions(+), 5 deletions(-)
diff --git a/include/sbi/sbi_domain.h b/include/sbi/sbi_domain.h
index 5553d21..955ffa3 100644
--- a/include/sbi/sbi_domain.h
+++ b/include/sbi/sbi_domain.h
@@ -36,11 +36,41 @@ struct sbi_domain_memregion {
*/
unsigned long base;
/** Flags representing memory region attributes */
-#define SBI_DOMAIN_MEMREGION_READABLE (1UL << 0)
-#define SBI_DOMAIN_MEMREGION_WRITEABLE (1UL << 1)
-#define SBI_DOMAIN_MEMREGION_EXECUTABLE (1UL << 2)
-#define SBI_DOMAIN_MEMREGION_MMODE (1UL << 3)
-#define SBI_DOMAIN_MEMREGION_ACCESS_MASK (0xfUL)
+#define SBI_DOMAIN_MEMREGION_M_READABLE (1UL << 0)
+#define SBI_DOMAIN_MEMREGION_M_WRITABLE (1UL << 1)
+#define SBI_DOMAIN_MEMREGION_M_EXECUTABLE (1UL << 2)
+#define SBI_DOMAIN_MEMREGION_SU_READABLE (1UL << 3)
+#define SBI_DOMAIN_MEMREGION_SU_WRITABLE (1UL << 4)
+#define SBI_DOMAIN_MEMREGION_SU_EXECUTABLE (1UL << 5)
+
+ /** Bit to control if permissions are enforced on all modes */
+#define SBI_DOMAIN_MEMREGION_ENF_PERMISSIONS (1UL << 6)
+
+#define SBI_DOMAIN_MEMREGION_M_RWX (SBI_DOMAIN_MEMREGION_M_READABLE | \
+ SBI_DOMAIN_MEMREGION_M_WRITABLE | \
+ SBI_DOMAIN_MEMREGION_M_EXECUTABLE)
+
+ /* Unrestricted M-mode accesses but enfoced on SU-mode */
+#define SBI_DOMAIN_MEMREGION_READABLE (SBI_DOMAIN_MEMREGION_SU_READABLE | \
+ SBI_DOMAIN_MEMREGION_M_RWX)
+#define SBI_DOMAIN_MEMREGION_WRITEABLE (SBI_DOMAIN_MEMREGION_SU_WRITABLE | \
+ SBI_DOMAIN_MEMREGION_M_RWX)
+#define SBI_DOMAIN_MEMREGION_EXECUTABLE (SBI_DOMAIN_MEMREGION_SU_EXECUTABLE | \
+ SBI_DOMAIN_MEMREGION_M_RWX)
+
+ /* Enforced accesses across all modes */
+#define SBI_DOMAIN_MEMREGION_ENF_READABLE (SBI_DOMAIN_MEMREGION_SU_READABLE | \
+ SBI_DOMAIN_MEMREGION_M_READABLE)
+#define SBI_DOMAIN_MEMREGION_ENF_WRITABLE (SBI_DOMAIN_MEMREGION_SU_WRITABLE | \
+ SBI_DOMAIN_MEMREGION_M_WRITABLE)
+#define SBI_DOMAIN_MEMREGION_ENF_EXECUTABLE (SBI_DOMAIN_MEMREGION_SU_EXECUTABLE | \
+ SBI_DOMAIN_MEMREGION_M_EXECUTABLE)
+
+#define SBI_DOMAIN_MEMREGION_ACCESS_MASK (0x3fUL)
+#define SBI_DOMAIN_MEMREGION_M_ACCESS_MASK (0x7UL)
+#define SBI_DOMAIN_MEMREGION_SU_ACCESS_MASK (0x38UL)
+
+#define SBI_DOMAIN_MEMREGION_SU_ACCESS_SHIFT (3)
#define SBI_DOMAIN_MEMREGION_MMIO (1UL << 31)
unsigned long flags;
--
2.39.0
next prev parent reply other threads:[~2022-12-20 10:46 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-20 10:46 [PATCH 0/9] Split region permissions into M-mode and SU-mode Himanshu Chauhan
2022-12-20 10:46 ` Himanshu Chauhan [this message]
2023-01-06 17:35 ` [PATCH 1/9] include: sbi: Fine grain the permissions for M and SU modes Anup Patel
2023-01-09 4:43 ` hchauhan
2023-01-09 5:19 ` Anup Patel
2022-12-20 10:46 ` [PATCH 2/9] lib: sbi: Use finer permission semantics for address validation Himanshu Chauhan
2023-01-06 17:38 ` Anup Patel
2022-12-20 10:46 ` [PATCH 3/9] lib: sbi: Add permissions for the firmware start till end Himanshu Chauhan
2023-01-06 17:44 ` Anup Patel
2022-12-20 10:46 ` [PATCH 4/9] lib: sbi: Use finer permission sematics to decide on PMP bits Himanshu Chauhan
2023-01-06 17:45 ` Anup Patel
2022-12-20 10:46 ` [PATCH 5/9] lib: sbi: Modify the boot time region flag prints Himanshu Chauhan
2023-01-06 17:47 ` Anup Patel
2022-12-20 10:46 ` [PATCH 6/9] lib: utils: Use SU-{R/W/X} flags for region permissions during parsing Himanshu Chauhan
2023-01-06 17:49 ` Anup Patel
2022-12-20 10:46 ` [PATCH 7/9] lib: utils: Disallow non-root domains from adding M-mode regions Himanshu Chauhan
2023-01-06 17:51 ` Anup Patel
2022-12-20 10:46 ` [PATCH 8/9] lib: utils: Add M-mode {R/W} flags to the MMIO regions Himanshu Chauhan
2023-01-06 17:52 ` Anup Patel
2022-12-20 10:46 ` [PATCH 9/9] docs: Update domain's region permissions and requirements Himanshu Chauhan
2023-01-06 17:54 ` Anup Patel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221220104625.80667-2-hchauhan@ventanamicro.com \
--to=hchauhan@ventanamicro.com \
--cc=opensbi@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox