From: Anup Patel <apatel@ventanamicro.com>
To: opensbi@lists.infradead.org
Subject: [PATCH v2 1/4] lib: sbi: Add Zicntr as a HART ISA extension
Date: Thu, 6 Jul 2023 09:45:39 +0530 [thread overview]
Message-ID: <20230706041542.1069059-2-apatel@ventanamicro.com> (raw)
In-Reply-To: <20230706041542.1069059-1-apatel@ventanamicro.com>
Recently ratified Zicntr ISA extension covers cycle, time and
instret CSRs so we replace the "time" ISA extension with "zicntr"
ISA extension in OpenSBI.
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Reviewed-by: Xiang W <wxjstz@126.com>
---
include/sbi/sbi_hart.h | 4 ++--
lib/sbi/sbi_hart.c | 6 +++---
lib/sbi/sbi_timer.c | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/sbi/sbi_hart.h b/include/sbi/sbi_hart.h
index 95b40e7..d48940d 100644
--- a/include/sbi/sbi_hart.h
+++ b/include/sbi/sbi_hart.h
@@ -28,8 +28,8 @@ enum sbi_hart_priv_versions {
enum sbi_hart_extensions {
/** Hart has Sscofpmt extension */
SBI_HART_EXT_SSCOFPMF = 0,
- /** HART has HW time CSR (extension name not available) */
- SBI_HART_EXT_TIME,
+ /** HART has Zicntr extension (i.e. HW cycle, time & instret CSRs) */
+ SBI_HART_EXT_ZICNTR,
/** HART has AIA M-mode CSRs */
SBI_HART_EXT_SMAIA,
/** HART has Smstateen CSR **/
diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c
index 6e52cbd..c470482 100644
--- a/lib/sbi/sbi_hart.c
+++ b/lib/sbi/sbi_hart.c
@@ -441,8 +441,8 @@ static inline char *sbi_hart_extension_id2string(int ext)
case SBI_HART_EXT_SSCOFPMF:
estr = "sscofpmf";
break;
- case SBI_HART_EXT_TIME:
- estr = "time";
+ case SBI_HART_EXT_ZICNTR:
+ estr = "zicntr";
break;
case SBI_HART_EXT_SMAIA:
estr = "smaia";
@@ -676,7 +676,7 @@ __mhpm_skip:
csr_read_allowed(CSR_TIME, (unsigned long)&trap);
if (!trap.cause)
__sbi_hart_update_extension(hfeatures,
- SBI_HART_EXT_TIME, true);
+ SBI_HART_EXT_ZICNTR, true);
/* Detect if hart has AIA local interrupt CSRs */
csr_read_allowed(CSR_MTOPI, (unsigned long)&trap);
diff --git a/lib/sbi/sbi_timer.c b/lib/sbi/sbi_timer.c
index 4b24cbe..7b618de 100644
--- a/lib/sbi/sbi_timer.c
+++ b/lib/sbi/sbi_timer.c
@@ -188,7 +188,7 @@ int sbi_timer_init(struct sbi_scratch *scratch, bool cold_boot)
if (!time_delta_off)
return SBI_ENOMEM;
- if (sbi_hart_has_extension(scratch, SBI_HART_EXT_TIME))
+ if (sbi_hart_has_extension(scratch, SBI_HART_EXT_ZICNTR))
get_time_val = get_ticks;
} else {
if (!time_delta_off)
--
2.34.1
next prev parent reply other threads:[~2023-07-06 4:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-06 4:15 [PATCH v2 0/4] Misc OpenSBI HART ISA extension improvements Anup Patel
2023-07-06 4:15 ` Anup Patel [this message]
2023-07-09 5:40 ` [PATCH v2 1/4] lib: sbi: Add Zicntr as a HART ISA extension Anup Patel
2023-07-06 4:15 ` [PATCH v2 2/4] lib: sbi: Add Zihpm " Anup Patel
2023-07-09 5:41 ` Anup Patel
2023-07-06 4:15 ` [PATCH v2 3/4] lib: sbi: Alphabetically sort HART ISA extensions Anup Patel
2023-07-09 5:41 ` Anup Patel
2023-07-06 4:15 ` [PATCH v2 4/4] lib: sbi: Rename hart_pmu_get_allowed_bits() function Anup Patel
2023-07-09 5:41 ` 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=20230706041542.1069059-2-apatel@ventanamicro.com \
--to=apatel@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.