All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@ventanamicro.com>
To: opensbi@lists.infradead.org
Subject: [PATCH 7/8] lib: sbi_hart: add Ssstateen extension
Date: Tue, 15 Apr 2025 15:19:08 +0200	[thread overview]
Message-ID: <20250415131908.2699782-9-rkrcmar@ventanamicro.com> (raw)
In-Reply-To: <20250415131908.2699782-2-rkrcmar@ventanamicro.com>

We already detect Smstateen, but Ssstateen exists as well and it doesn't
have the M-state CSRs.

Signed-off-by: Radim Krčmář <rkrcmar@ventanamicro.com>
---
 include/sbi/sbi_hart.h | 4 +++-
 lib/sbi/sbi_hart.c     | 4 ++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/sbi/sbi_hart.h b/include/sbi/sbi_hart.h
index c3a7feb753d9..10d0cf447ba6 100644
--- a/include/sbi/sbi_hart.h
+++ b/include/sbi/sbi_hart.h
@@ -31,7 +31,7 @@ enum sbi_hart_extensions {
 	SBI_HART_EXT_SMAIA = 0,
 	/** HART has Smepmp */
 	SBI_HART_EXT_SMEPMP,
-	/** HART has Smstateen CSR **/
+	/** HART has mstateen*, sstateen*, and hstateen* CSRs **/
 	SBI_HART_EXT_SMSTATEEN,
 	/** Hart has Sscofpmt extension */
 	SBI_HART_EXT_SSCOFPMF,
@@ -79,6 +79,8 @@ enum sbi_hart_extensions {
 	SBI_HART_EXT_SMCTR,
 	/** HART has CTR S-mode CSRs */
 	SBI_HART_EXT_SSCTR,
+	/** HART has sstateen* and hstateen* CSRs **/
+	SBI_HART_EXT_SSSTATEEN,
 
 	/** Maximum index of Hart extension */
 	SBI_HART_EXT_MAX,
diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c
index 569f8008b523..bc0a73d1298d 100644
--- a/lib/sbi/sbi_hart.c
+++ b/lib/sbi/sbi_hart.c
@@ -695,6 +695,7 @@ const struct sbi_hart_ext_data sbi_hart_ext[] = {
 	__SBI_HART_EXT_DATA(ssdbltrp, SBI_HART_EXT_SSDBLTRP),
 	__SBI_HART_EXT_DATA(smctr, SBI_HART_EXT_SMCTR),
 	__SBI_HART_EXT_DATA(ssctr, SBI_HART_EXT_SSCTR),
+	__SBI_HART_EXT_DATA(ssstateen, SBI_HART_EXT_SSSTATEEN),
 };
 
 _Static_assert(SBI_HART_EXT_MAX == array_size(sbi_hart_ext),
@@ -936,6 +937,9 @@ __pmp_skip:
 	/* Detect if hart supports mstateen CSRs */
 	__check_ext_csr(SBI_HART_PRIV_VER_1_12,
 			CSR_MSTATEEN0, SBI_HART_EXT_SMSTATEEN);
+	/* Detect if hart supports sstateen CSRs */
+	__check_ext_csr(SBI_HART_PRIV_VER_1_12,
+			CSR_SSTATEEN0, SBI_HART_EXT_SSSTATEEN);
 	/* Detect if hart supports smcntrpmf */
 	__check_ext_csr(SBI_HART_PRIV_VER_1_12,
 			CSR_MCYCLECFG, SBI_HART_EXT_SMCNTRPMF);
-- 
2.48.1


-- 
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi

  parent reply	other threads:[~2025-04-15 14:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-15 13:19 [PATCH 0/8] Reset more security-related CSRs Radim Krčmář
2025-04-15 13:19 ` [PATCH 1/8] lib: sbi: add 64 bit csr macros Radim Krčmář
2025-04-28 12:28   ` Anup Patel
2025-04-28 13:48     ` Radim Krčmář
2025-04-15 13:19 ` [PATCH 2/8] lib: sbi: use " Radim Krčmář
2025-04-28 12:29   ` Anup Patel
2025-04-15 13:19 ` [PATCH 3/8] lib: sbi_hart: reset hstatus Radim Krčmář
2025-04-28 12:27   ` Anup Patel
2025-04-15 13:19 ` [PATCH 4/8] lib: sbi_hart: reset sstateen and hstateen Radim Krčmář
2025-04-28 12:29   ` Anup Patel
2025-04-15 13:19 ` [PATCH 5/8] lib: sbi_hart: fix sstateen emulation Radim Krčmář
2025-04-28 12:34   ` Anup Patel
2025-04-15 13:19 ` [PATCH 6/8] lib: sbi_hart: reset mstateen0 Radim Krčmář
2025-04-28 12:35   ` Anup Patel
2025-04-15 13:19 ` Radim Krčmář [this message]
2025-04-28 12:38   ` [PATCH 7/8] lib: sbi_hart: add Ssstateen extension Anup Patel
2025-04-28 13:47     ` Radim Krčmář
2025-04-29  5:30       ` Anup Patel
2025-04-15 13:19 ` [PATCH 8/8] lib: sbi_hart: properly reset Ssstateen Radim Krčmář
2025-04-28 12:39   ` Anup Patel
2025-04-28 13:44     ` Radim Krčmář
2025-04-28 12:41 ` [PATCH 0/8] Reset more security-related CSRs 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=20250415131908.2699782-9-rkrcmar@ventanamicro.com \
    --to=rkrcmar@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.