OpenSBI Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yong-Xuan Wang <yongxuan.wang@sifive.com>
To: opensbi@lists.infradead.org
Subject: [PATCH v2 5/5] lib: sbi: Add support for Svadu extension
Date: Tue, 24 Oct 2023 10:11:45 +0000	[thread overview]
Message-ID: <20231024101145.32000-6-yongxuan.wang@sifive.com> (raw)
In-Reply-To: <20231024101145.32000-1-yongxuan.wang@sifive.com>

This patch detects the Svadu extension from DT and enables the ADUE bit
in the menvcfg CSR for lower privilege modes.

Signed-off-by: Yong-Xuan Wang <yongxuan.wang@sifive.com>
---
 include/sbi/riscv_encoding.h | 1 +
 include/sbi/sbi_hart.h       | 2 ++
 lib/sbi/sbi_hart.c           | 2 ++
 3 files changed, 5 insertions(+)

diff --git a/include/sbi/riscv_encoding.h b/include/sbi/riscv_encoding.h
index 92ee0a8..8a81787 100644
--- a/include/sbi/riscv_encoding.h
+++ b/include/sbi/riscv_encoding.h
@@ -209,6 +209,7 @@
 
 #define ENVCFG_STCE			(_ULL(1) << 63)
 #define ENVCFG_PBMTE			(_ULL(1) << 62)
+#define ENVCFG_ADUE			(_ULL(1) << 61)
 #define ENVCFG_CBZE			(_UL(1) << 7)
 #define ENVCFG_CBCFE			(_UL(1) << 6)
 #define ENVCFG_CBIE_SHIFT		4
diff --git a/include/sbi/sbi_hart.h b/include/sbi/sbi_hart.h
index 0424da8..83471c1 100644
--- a/include/sbi/sbi_hart.h
+++ b/include/sbi/sbi_hart.h
@@ -48,6 +48,8 @@ enum sbi_hart_extensions {
 	SBI_HART_EXT_ZICBOM,
 	/** Hart has Svpbmt extension */
 	SBI_HART_EXT_SVPBMT,
+	/** Hart has Svadu extension */
+	SBI_HART_EXT_SVADU,
 
 	/** Maximum index of Hart extension */
 	SBI_HART_EXT_MAX,
diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c
index 4fb5153..9874e77 100644
--- a/lib/sbi/sbi_hart.c
+++ b/lib/sbi/sbi_hart.c
@@ -128,6 +128,7 @@ static void mstatus_init(struct sbi_scratch *scratch)
 				  ENVCFG_CBIE_INV << ENVCFG_CBIE_SHIFT);
 		__set_menvcfg_ext(SBI_HART_EXT_SVPBMT, ENVCFG_PBMTE);
 		__set_menvcfg_ext(SBI_HART_EXT_SSTC, ENVCFG_STCE);
+		__set_menvcfg_ext(SBI_HART_EXT_SVADU, ENVCFG_ADUE);
 
 #undef __set_menvcfg_ext
 
@@ -647,6 +648,7 @@ const struct sbi_hart_ext_data sbi_hart_ext[] = {
 	__SBI_HART_EXT_DATA(zicboz, SBI_HART_EXT_ZICBOZ),
 	__SBI_HART_EXT_DATA(zicbom, SBI_HART_EXT_ZICBOM),
 	__SBI_HART_EXT_DATA(svpbmt, SBI_HART_EXT_SVPBMT),
+	__SBI_HART_EXT_DATA(svadu, SBI_HART_EXT_SVADU),
 };
 
 /**
-- 
2.17.1



  parent reply	other threads:[~2023-10-24 10:11 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-24 10:11 [PATCH v2 0/5] Add Svadu extension support Yong-Xuan Wang
2023-10-24 10:11 ` [PATCH v2 1/5] lib: sbi: Improve the code of privilege mode and extensions detection Yong-Xuan Wang
2023-10-24 10:11 ` [PATCH v2 2/5] lib: sbi: Refactor the code for enable extensions in menvfg CSR Yong-Xuan Wang
2023-10-24 10:11 ` [PATCH v2 3/5] lib: sbi: Using one array to define the name of extensions Yong-Xuan Wang
2023-10-24 10:11 ` [PATCH v2 4/5] lib: sbi: Detect extensions from the ISA string in DT Yong-Xuan Wang
2023-10-24 10:11 ` Yong-Xuan Wang [this message]
2023-11-14 16:45 ` [PATCH v2 0/5] Add Svadu extension support Anup Patel
2023-11-24  4:55   ` Yong-Xuan Wang
2024-05-24 11:31   ` Alexandre Ghiti
2024-05-24 12:06     ` Conor Dooley
2024-05-24 12:47       ` Alexandre Ghiti
2024-05-24 13:11         ` Conor Dooley
2024-05-24 13:17           ` Conor Dooley
2024-05-24 16:05     ` Anup Patel
2024-05-24 19:38       ` Alexandre Ghiti
2024-05-27 12:22         ` Andrew Jones
2024-05-27 16:03         ` 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=20231024101145.32000-6-yongxuan.wang@sifive.com \
    --to=yongxuan.wang@sifive.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