From: Raymond Mao <raymondmaoca@gmail.com>
To: opensbi@lists.infradead.org
Cc: scott@riscstar.com, dave.patel@riscstar.com,
raymond.mao@riscstar.com, robin.randhawa@sifive.com,
samuel.holland@sifive.com, anup.patel@qti.qualcomm.com,
anuppate@qti.qualcomm.com, anup@brainfault.org,
dhaval@rivosinc.com, peter.lin@sifive.com
Subject: [PATCH v2 2/4] hart: add WorldGuard CSR IDs and hart extension flags
Date: Fri, 24 Jul 2026 22:38:19 -0400 [thread overview]
Message-ID: <20260725023821.3795618-3-raymondmaoca@gmail.com> (raw)
In-Reply-To: <20260725023821.3795618-1-raymondmaoca@gmail.com>
From: Raymond Mao <raymond.mao@riscstar.com>
Define the WorldGuard-related CSR numbers and claim smwg / sswg hart
extensions so platform code can probe support before programming
MLWID, MWIDDELEG and SLWID.
Signed-off-by: Raymond Mao <raymond.mao@riscstar.com>
---
include/sbi/riscv_encoding.h | 3 +++
include/sbi/sbi_hart.h | 4 ++++
lib/sbi/sbi_hart.c | 2 ++
3 files changed, 9 insertions(+)
diff --git a/include/sbi/riscv_encoding.h b/include/sbi/riscv_encoding.h
index ffe7666c..4d8b2fba 100644
--- a/include/sbi/riscv_encoding.h
+++ b/include/sbi/riscv_encoding.h
@@ -373,6 +373,7 @@
/* Supervisor Protection and Translation */
#define CSR_SATP 0x180
+#define CSR_SLWID 0x190
/* Supervisor Indirect Register Alias */
#define CSR_SISELECT 0x150
@@ -510,6 +511,7 @@
/* Machine Configuration */
#define CSR_MENVCFG 0x30a
#define CSR_MENVCFGH 0x31a
+#define CSR_MLWID 0x390
/* Machine Trap Handling */
#define CSR_MSCRATCH 0x340
@@ -736,6 +738,7 @@
/* Machine Security Configuration CSR (mseccfg) */
#define CSR_MSECCFG 0x747
#define CSR_MSECCFGH 0x757
+#define CSR_MWIDDELEG 0x748
#define MSECCFG_MML_SHIFT (0)
#define MSECCFG_MML (_UL(1) << MSECCFG_MML_SHIFT)
diff --git a/include/sbi/sbi_hart.h b/include/sbi/sbi_hart.h
index 543393bb..0fe8d439 100644
--- a/include/sbi/sbi_hart.h
+++ b/include/sbi/sbi_hart.h
@@ -63,6 +63,10 @@ enum sbi_hart_extensions {
SBI_HART_EXT_SSCSRIND,
/** Hart has Ssccfg extension */
SBI_HART_EXT_SSCCFG,
+ /** Hart has Smwg extension */
+ SBI_HART_EXT_SMWG,
+ /** Hart has Sswg extension */
+ SBI_HART_EXT_SSWG,
/** Hart has Svade extension */
SBI_HART_EXT_SVADE,
/** Hart has Svadu extension */
diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c
index 21713816..2b7b9cdd 100644
--- a/lib/sbi/sbi_hart.c
+++ b/lib/sbi/sbi_hart.c
@@ -386,6 +386,8 @@ const struct sbi_hart_ext_data sbi_hart_ext[] = {
__SBI_HART_EXT_DATA(smcdeleg, SBI_HART_EXT_SMCDELEG),
__SBI_HART_EXT_DATA(sscsrind, SBI_HART_EXT_SSCSRIND),
__SBI_HART_EXT_DATA(ssccfg, SBI_HART_EXT_SSCCFG),
+ __SBI_HART_EXT_DATA(smwg, SBI_HART_EXT_SMWG),
+ __SBI_HART_EXT_DATA(sswg, SBI_HART_EXT_SSWG),
__SBI_HART_EXT_DATA(svade, SBI_HART_EXT_SVADE),
__SBI_HART_EXT_DATA(svadu, SBI_HART_EXT_SVADU),
__SBI_HART_EXT_DATA(smnpm, SBI_HART_EXT_SMNPM),
--
2.25.1
--
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
next prev parent reply other threads:[~2026-07-25 2:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-25 2:38 [PATCH v2 0/4] Add WorldGuard support with wgchecker2 Raymond Mao
2026-07-25 2:38 ` [PATCH v2 1/4] lib: utils: fdt: add generic domain and property parsing helpers Raymond Mao
2026-07-25 2:38 ` Raymond Mao [this message]
2026-07-25 2:38 ` [PATCH v2 3/4] docs: document WorldGuard DT bindings Raymond Mao
2026-07-25 2:38 ` [PATCH v2 4/4] platform: generic: add WorldGuard support with wgchecker2 Raymond Mao
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=20260725023821.3795618-3-raymondmaoca@gmail.com \
--to=raymondmaoca@gmail.com \
--cc=anup.patel@qti.qualcomm.com \
--cc=anup@brainfault.org \
--cc=anuppate@qti.qualcomm.com \
--cc=dave.patel@riscstar.com \
--cc=dhaval@rivosinc.com \
--cc=opensbi@lists.infradead.org \
--cc=peter.lin@sifive.com \
--cc=raymond.mao@riscstar.com \
--cc=robin.randhawa@sifive.com \
--cc=samuel.holland@sifive.com \
--cc=scott@riscstar.com \
/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