OpenSBI Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] Misc OpenSBI HART ISA extension improvements
@ 2023-07-06  4:15 Anup Patel
  2023-07-06  4:15 ` [PATCH v2 1/4] lib: sbi: Add Zicntr as a HART ISA extension Anup Patel
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Anup Patel @ 2023-07-06  4:15 UTC (permalink / raw)
  To: opensbi

This series does assorted improvements to OpenSBI HART ISA extensions.

These patches can also be found in zicntr_zihpm_v2 branch at:
https://github.com/avpatel/opensbi.git

Changes since v1:
 - Updated PATCH2 to set set SBI_HART_EXT_ZIHPM in hart_detect_features()
   after calling sbi_platform_extensions_init().

Anup Patel (4):
  lib: sbi: Add Zicntr as a HART ISA extension
  lib: sbi: Add Zihpm as a HART ISA extension
  lib: sbi: Alphabetically sort HART ISA extensions
  lib: sbi: Rename hart_pmu_get_allowed_bits() function

 include/sbi/sbi_hart.h | 12 +++++++-----
 lib/sbi/sbi_hart.c     | 30 +++++++++++++++++++-----------
 lib/sbi/sbi_timer.c    |  2 +-
 3 files changed, 27 insertions(+), 17 deletions(-)

-- 
2.34.1



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/4] lib: sbi: Add Zicntr as a HART ISA extension
  2023-07-06  4:15 [PATCH v2 0/4] Misc OpenSBI HART ISA extension improvements Anup Patel
@ 2023-07-06  4:15 ` Anup Patel
  2023-07-09  5:40   ` Anup Patel
  2023-07-06  4:15 ` [PATCH v2 2/4] lib: sbi: Add Zihpm " Anup Patel
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Anup Patel @ 2023-07-06  4:15 UTC (permalink / raw)
  To: opensbi

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



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/4] lib: sbi: Add Zihpm as a HART ISA extension
  2023-07-06  4:15 [PATCH v2 0/4] Misc OpenSBI HART ISA extension improvements Anup Patel
  2023-07-06  4:15 ` [PATCH v2 1/4] lib: sbi: Add Zicntr as a HART ISA extension Anup Patel
@ 2023-07-06  4:15 ` 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-06  4:15 ` [PATCH v2 4/4] lib: sbi: Rename hart_pmu_get_allowed_bits() function Anup Patel
  3 siblings, 1 reply; 9+ messages in thread
From: Anup Patel @ 2023-07-06  4:15 UTC (permalink / raw)
  To: opensbi

Recently ratified Zihpm ISA extension covers all [m]hpm* CSRs
so we add Zihpm as a HART ISA extension in OpenSBI.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Reviewed-by: Xiang W <wxjstz@126.com>
---
 include/sbi/sbi_hart.h | 2 ++
 lib/sbi/sbi_hart.c     | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/include/sbi/sbi_hart.h b/include/sbi/sbi_hart.h
index d48940d..938248f 100644
--- a/include/sbi/sbi_hart.h
+++ b/include/sbi/sbi_hart.h
@@ -36,6 +36,8 @@ enum sbi_hart_extensions {
 	SBI_HART_EXT_SMSTATEEN,
 	/** HART has Sstc extension */
 	SBI_HART_EXT_SSTC,
+	/** HART has Zihpm extension */
+	SBI_HART_EXT_ZIHPM,
 
 	/** Maximum index of Hart extension */
 	SBI_HART_EXT_MAX,
diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c
index c470482..ff6f582 100644
--- a/lib/sbi/sbi_hart.c
+++ b/lib/sbi/sbi_hart.c
@@ -453,6 +453,9 @@ static inline char *sbi_hart_extension_id2string(int ext)
 	case SBI_HART_EXT_SMSTATEEN:
 		estr = "smstateen";
 		break;
+	case SBI_HART_EXT_ZIHPM:
+		estr = "zihpm";
+		break;
 	default:
 		break;
 	}
@@ -706,6 +709,11 @@ __mhpm_skip:
 	if (rc)
 		return rc;
 
+	/* Extensions implied by other extensions and features */
+	if (hfeatures->mhpm_count)
+		__sbi_hart_update_extension(hfeatures,
+					SBI_HART_EXT_ZIHPM, true);
+
 	/* Mark hart feature detection done */
 	hfeatures->detected = true;
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 3/4] lib: sbi: Alphabetically sort HART ISA extensions
  2023-07-06  4:15 [PATCH v2 0/4] Misc OpenSBI HART ISA extension improvements Anup Patel
  2023-07-06  4:15 ` [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-06  4:15 ` 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
  3 siblings, 1 reply; 9+ messages in thread
From: Anup Patel @ 2023-07-06  4:15 UTC (permalink / raw)
  To: opensbi

Let us follow alphabetical order for HART ISA extension so that
it is simpler to maintain.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Reviewed-by: Xiang W <wxjstz@126.com>
---
 include/sbi/sbi_hart.h | 10 +++++-----
 lib/sbi/sbi_hart.c     | 16 ++++++++--------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/include/sbi/sbi_hart.h b/include/sbi/sbi_hart.h
index 938248f..b97f78c 100644
--- a/include/sbi/sbi_hart.h
+++ b/include/sbi/sbi_hart.h
@@ -26,16 +26,16 @@ enum sbi_hart_priv_versions {
 
 /** Possible ISA extensions of a hart */
 enum sbi_hart_extensions {
-	/** Hart has Sscofpmt extension */
-	SBI_HART_EXT_SSCOFPMF = 0,
-	/** 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,
+	SBI_HART_EXT_SMAIA = 0,
 	/** HART has Smstateen CSR **/
 	SBI_HART_EXT_SMSTATEEN,
+	/** Hart has Sscofpmt extension */
+	SBI_HART_EXT_SSCOFPMF,
 	/** HART has Sstc extension */
 	SBI_HART_EXT_SSTC,
+	/** HART has Zicntr extension (i.e. HW cycle, time & instret CSRs) */
+	SBI_HART_EXT_ZICNTR,
 	/** HART has Zihpm extension */
 	SBI_HART_EXT_ZIHPM,
 
diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c
index ff6f582..2eacefb 100644
--- a/lib/sbi/sbi_hart.c
+++ b/lib/sbi/sbi_hart.c
@@ -438,20 +438,20 @@ static inline char *sbi_hart_extension_id2string(int ext)
 	char *estr = NULL;
 
 	switch (ext) {
-	case SBI_HART_EXT_SSCOFPMF:
-		estr = "sscofpmf";
-		break;
-	case SBI_HART_EXT_ZICNTR:
-		estr = "zicntr";
-		break;
 	case SBI_HART_EXT_SMAIA:
 		estr = "smaia";
 		break;
+	case SBI_HART_EXT_SMSTATEEN:
+		estr = "smstateen";
+		break;
+	case SBI_HART_EXT_SSCOFPMF:
+		estr = "sscofpmf";
+		break;
 	case SBI_HART_EXT_SSTC:
 		estr = "sstc";
 		break;
-	case SBI_HART_EXT_SMSTATEEN:
-		estr = "smstateen";
+	case SBI_HART_EXT_ZICNTR:
+		estr = "zicntr";
 		break;
 	case SBI_HART_EXT_ZIHPM:
 		estr = "zihpm";
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 4/4] lib: sbi: Rename hart_pmu_get_allowed_bits() function
  2023-07-06  4:15 [PATCH v2 0/4] Misc OpenSBI HART ISA extension improvements Anup Patel
                   ` (2 preceding siblings ...)
  2023-07-06  4:15 ` [PATCH v2 3/4] lib: sbi: Alphabetically sort HART ISA extensions Anup Patel
@ 2023-07-06  4:15 ` Anup Patel
  2023-07-09  5:41   ` Anup Patel
  3 siblings, 1 reply; 9+ messages in thread
From: Anup Patel @ 2023-07-06  4:15 UTC (permalink / raw)
  To: opensbi

The hart_pmu_get_allowed_bits() function detects implemented bits
of mhpm counters so let us rename this function accordingly.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Reviewed-by: Xiang W <wxjstz@126.com>
---
 lib/sbi/sbi_hart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c
index 2eacefb..e9b2b27 100644
--- a/lib/sbi/sbi_hart.c
+++ b/lib/sbi/sbi_hart.c
@@ -527,7 +527,7 @@ static unsigned long hart_pmp_get_allowed_addr(void)
 	return val;
 }
 
-static int hart_pmu_get_allowed_bits(void)
+static int hart_mhpm_get_allowed_bits(void)
 {
 	unsigned long val = ~(0UL);
 	struct sbi_trap_info trap = {0};
@@ -628,7 +628,7 @@ __pmp_skip:
 
 	/* Detect number of MHPM counters */
 	__check_csr(CSR_MHPMCOUNTER3, 0, 1UL, mhpm_count, __mhpm_skip);
-	hfeatures->mhpm_bits = hart_pmu_get_allowed_bits();
+	hfeatures->mhpm_bits = hart_mhpm_get_allowed_bits();
 
 	__check_csr_4(CSR_MHPMCOUNTER4, 0, 1UL, mhpm_count, __mhpm_skip);
 	__check_csr_8(CSR_MHPMCOUNTER8, 0, 1UL, mhpm_count, __mhpm_skip);
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 1/4] lib: sbi: Add Zicntr as a HART ISA extension
  2023-07-06  4:15 ` [PATCH v2 1/4] lib: sbi: Add Zicntr as a HART ISA extension Anup Patel
@ 2023-07-09  5:40   ` Anup Patel
  0 siblings, 0 replies; 9+ messages in thread
From: Anup Patel @ 2023-07-09  5:40 UTC (permalink / raw)
  To: opensbi

On Thu, Jul 6, 2023 at 9:45?AM Anup Patel <apatel@ventanamicro.com> wrote:
>
> 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>

Applied this patch to the riscv/opensbi repo.

Regards,
Anup

> ---
>  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
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 2/4] lib: sbi: Add Zihpm as a HART ISA extension
  2023-07-06  4:15 ` [PATCH v2 2/4] lib: sbi: Add Zihpm " Anup Patel
@ 2023-07-09  5:41   ` Anup Patel
  0 siblings, 0 replies; 9+ messages in thread
From: Anup Patel @ 2023-07-09  5:41 UTC (permalink / raw)
  To: opensbi

On Thu, Jul 6, 2023 at 9:46?AM Anup Patel <apatel@ventanamicro.com> wrote:
>
> Recently ratified Zihpm ISA extension covers all [m]hpm* CSRs
> so we add Zihpm as a HART ISA extension in OpenSBI.
>
> Signed-off-by: Anup Patel <apatel@ventanamicro.com>
> Reviewed-by: Xiang W <wxjstz@126.com>

Applied this patch to the riscv/opensbi repo.

Regards,
Anup

> ---
>  include/sbi/sbi_hart.h | 2 ++
>  lib/sbi/sbi_hart.c     | 8 ++++++++
>  2 files changed, 10 insertions(+)
>
> diff --git a/include/sbi/sbi_hart.h b/include/sbi/sbi_hart.h
> index d48940d..938248f 100644
> --- a/include/sbi/sbi_hart.h
> +++ b/include/sbi/sbi_hart.h
> @@ -36,6 +36,8 @@ enum sbi_hart_extensions {
>         SBI_HART_EXT_SMSTATEEN,
>         /** HART has Sstc extension */
>         SBI_HART_EXT_SSTC,
> +       /** HART has Zihpm extension */
> +       SBI_HART_EXT_ZIHPM,
>
>         /** Maximum index of Hart extension */
>         SBI_HART_EXT_MAX,
> diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c
> index c470482..ff6f582 100644
> --- a/lib/sbi/sbi_hart.c
> +++ b/lib/sbi/sbi_hart.c
> @@ -453,6 +453,9 @@ static inline char *sbi_hart_extension_id2string(int ext)
>         case SBI_HART_EXT_SMSTATEEN:
>                 estr = "smstateen";
>                 break;
> +       case SBI_HART_EXT_ZIHPM:
> +               estr = "zihpm";
> +               break;
>         default:
>                 break;
>         }
> @@ -706,6 +709,11 @@ __mhpm_skip:
>         if (rc)
>                 return rc;
>
> +       /* Extensions implied by other extensions and features */
> +       if (hfeatures->mhpm_count)
> +               __sbi_hart_update_extension(hfeatures,
> +                                       SBI_HART_EXT_ZIHPM, true);
> +
>         /* Mark hart feature detection done */
>         hfeatures->detected = true;
>
> --
> 2.34.1
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 3/4] lib: sbi: Alphabetically sort HART ISA extensions
  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
  0 siblings, 0 replies; 9+ messages in thread
From: Anup Patel @ 2023-07-09  5:41 UTC (permalink / raw)
  To: opensbi

On Thu, Jul 6, 2023 at 9:46?AM Anup Patel <apatel@ventanamicro.com> wrote:
>
> Let us follow alphabetical order for HART ISA extension so that
> it is simpler to maintain.
>
> Signed-off-by: Anup Patel <apatel@ventanamicro.com>
> Reviewed-by: Xiang W <wxjstz@126.com>

Applied this patch to the riscv/opensbi repo.

Regards,
Anup

> ---
>  include/sbi/sbi_hart.h | 10 +++++-----
>  lib/sbi/sbi_hart.c     | 16 ++++++++--------
>  2 files changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/include/sbi/sbi_hart.h b/include/sbi/sbi_hart.h
> index 938248f..b97f78c 100644
> --- a/include/sbi/sbi_hart.h
> +++ b/include/sbi/sbi_hart.h
> @@ -26,16 +26,16 @@ enum sbi_hart_priv_versions {
>
>  /** Possible ISA extensions of a hart */
>  enum sbi_hart_extensions {
> -       /** Hart has Sscofpmt extension */
> -       SBI_HART_EXT_SSCOFPMF = 0,
> -       /** 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,
> +       SBI_HART_EXT_SMAIA = 0,
>         /** HART has Smstateen CSR **/
>         SBI_HART_EXT_SMSTATEEN,
> +       /** Hart has Sscofpmt extension */
> +       SBI_HART_EXT_SSCOFPMF,
>         /** HART has Sstc extension */
>         SBI_HART_EXT_SSTC,
> +       /** HART has Zicntr extension (i.e. HW cycle, time & instret CSRs) */
> +       SBI_HART_EXT_ZICNTR,
>         /** HART has Zihpm extension */
>         SBI_HART_EXT_ZIHPM,
>
> diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c
> index ff6f582..2eacefb 100644
> --- a/lib/sbi/sbi_hart.c
> +++ b/lib/sbi/sbi_hart.c
> @@ -438,20 +438,20 @@ static inline char *sbi_hart_extension_id2string(int ext)
>         char *estr = NULL;
>
>         switch (ext) {
> -       case SBI_HART_EXT_SSCOFPMF:
> -               estr = "sscofpmf";
> -               break;
> -       case SBI_HART_EXT_ZICNTR:
> -               estr = "zicntr";
> -               break;
>         case SBI_HART_EXT_SMAIA:
>                 estr = "smaia";
>                 break;
> +       case SBI_HART_EXT_SMSTATEEN:
> +               estr = "smstateen";
> +               break;
> +       case SBI_HART_EXT_SSCOFPMF:
> +               estr = "sscofpmf";
> +               break;
>         case SBI_HART_EXT_SSTC:
>                 estr = "sstc";
>                 break;
> -       case SBI_HART_EXT_SMSTATEEN:
> -               estr = "smstateen";
> +       case SBI_HART_EXT_ZICNTR:
> +               estr = "zicntr";
>                 break;
>         case SBI_HART_EXT_ZIHPM:
>                 estr = "zihpm";
> --
> 2.34.1
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 4/4] lib: sbi: Rename hart_pmu_get_allowed_bits() function
  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
  0 siblings, 0 replies; 9+ messages in thread
From: Anup Patel @ 2023-07-09  5:41 UTC (permalink / raw)
  To: opensbi

On Thu, Jul 6, 2023 at 9:46?AM Anup Patel <apatel@ventanamicro.com> wrote:
>
> The hart_pmu_get_allowed_bits() function detects implemented bits
> of mhpm counters so let us rename this function accordingly.
>
> Signed-off-by: Anup Patel <apatel@ventanamicro.com>
> Reviewed-by: Xiang W <wxjstz@126.com>

Applied this patch to the riscv/opensbi repo.

Regards,
Anup

> ---
>  lib/sbi/sbi_hart.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c
> index 2eacefb..e9b2b27 100644
> --- a/lib/sbi/sbi_hart.c
> +++ b/lib/sbi/sbi_hart.c
> @@ -527,7 +527,7 @@ static unsigned long hart_pmp_get_allowed_addr(void)
>         return val;
>  }
>
> -static int hart_pmu_get_allowed_bits(void)
> +static int hart_mhpm_get_allowed_bits(void)
>  {
>         unsigned long val = ~(0UL);
>         struct sbi_trap_info trap = {0};
> @@ -628,7 +628,7 @@ __pmp_skip:
>
>         /* Detect number of MHPM counters */
>         __check_csr(CSR_MHPMCOUNTER3, 0, 1UL, mhpm_count, __mhpm_skip);
> -       hfeatures->mhpm_bits = hart_pmu_get_allowed_bits();
> +       hfeatures->mhpm_bits = hart_mhpm_get_allowed_bits();
>
>         __check_csr_4(CSR_MHPMCOUNTER4, 0, 1UL, mhpm_count, __mhpm_skip);
>         __check_csr_8(CSR_MHPMCOUNTER8, 0, 1UL, mhpm_count, __mhpm_skip);
> --
> 2.34.1
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-07-09  5:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-06  4:15 [PATCH v2 0/4] Misc OpenSBI HART ISA extension improvements Anup Patel
2023-07-06  4:15 ` [PATCH v2 1/4] lib: sbi: Add Zicntr as a HART ISA extension Anup Patel
2023-07-09  5:40   ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox