public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Tsukasa OI <research_trasio@irq.a4lg.com>
To: Tsukasa OI <research_trasio@irq.a4lg.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Andrew Waterman <andrew@sifive.com>,
	Jim Wilson <jim.wilson.gcc@gmail.com>,
	Nelson Chu <nelson@rivosinc.com>,
	Kito Cheng <kito.cheng@sifive.com>, Jiawei <jiawei@iscas.ac.cn>
Cc: binutils@sourceware.org
Subject: [PATCH 1/1] RISC-V: Add 'Smcntrpmf' extension and its CSRs
Date: Sun,  3 Sep 2023 02:42:01 +0000	[thread overview]
Message-ID: <1d3089dcef14d2c7e19fd5424a2a4a11a665d2ff.1693708909.git.research_trasio@irq.a4lg.com> (raw)
In-Reply-To: <cover.1693708909.git.research_trasio@irq.a4lg.com>

From: Tsukasa OI <research_trasio@irq.a4lg.com>

This commit adds now stable and approved 'Smcntrpmf' extension defined by
the RISC-V Cycle and Instret Privilege Mode Filtering specification.

Note that mcyclecfg and minstretcfg CSRs conflict with the privileged
specification version 1.9.1, this extension is only enabled with the
privileged specification version 1.10 or later.

By checking the base privileged specification, we no longer need to change
the design of base CSR handling.

This is based on the specification version v1.0_rc1 (Frozen):
<https://github.com/riscv/riscv-smcntrpmf/commit/32b752c40d59c1b5e95de83399c1f54be6669163>

bfd/ChangeLog:

	* elfxx-riscv.c (riscv_implicit_subsets): Add implication rule from
	the new 'Smcntrpmf' extension.  (riscv_supported_std_s_ext): Add
	'Smcntrpmf' to the supported S extension list.

gas/ChangeLog:

	* config/tc-riscv.c (enum riscv_csr_class): Add new CSR classes
	CSR_CLASS_SMCNTRPMF and CSR_CLASS_SMCNTRPMF_32.
	(riscv_csr_address): Add handling for new CSR classes.
	* testsuite/gas/riscv/csr-dw-regnums.s: Add new CSRs.  Move
	"mscounteren" and "mhcounteren" CSRs and note that they are now
	aliases.
	* testsuite/gas/riscv/csr-dw-regnums.d: Reflect the change.
	* testsuite/gas/riscv/csr.s: Add new CSRs.  Move "mscounteren"
	and "mhcounteren" CSRs and note that they are now reused for
	the 'Smcntrpmf' extension.
	* testsuite/gas/riscv/csr-version-1p9p1.d: Reflect the changes of
	csr.s.
	* testsuite/gas/riscv/csr-version-1p9p1.l: Likewise.
	* testsuite/gas/riscv/csr-version-1p10.d: Likewise.
	* testsuite/gas/riscv/csr-version-1p10.l: Likewise.
	* testsuite/gas/riscv/csr-version-1p11.d: Likewise.
	* testsuite/gas/riscv/csr-version-1p11.l: Likewise.
	* testsuite/gas/riscv/csr-version-1p12.d: Likewise.
	* testsuite/gas/riscv/csr-version-1p12.l: Likewise.

include/ChangeLog:

	* opcode/riscv-opc.h: Add new CSRs noting that this extension is
	incompatible with the privileged specification version 1.9.1.
	Move "mscounteren" and "mhcounteren" CSRs and make them aliases.
	(CSR_MCYCLECFG, CSR_MINSTRETCFG, CSR_MCYCLECFGH, CSR_MINSTRETCFGH):
	New CSR macros.
---
 bfd/elfxx-riscv.c                           |  2 ++
 gas/config/tc-riscv.c                       |  9 +++++
 gas/testsuite/gas/riscv/csr-dw-regnums.d    |  8 +++--
 gas/testsuite/gas/riscv/csr-dw-regnums.s    |  9 +++--
 gas/testsuite/gas/riscv/csr-version-1p10.d  | 16 ++++++---
 gas/testsuite/gas/riscv/csr-version-1p10.l  | 40 ++++++++++++++++-----
 gas/testsuite/gas/riscv/csr-version-1p11.d  | 16 ++++++---
 gas/testsuite/gas/riscv/csr-version-1p11.l  | 40 ++++++++++++++++-----
 gas/testsuite/gas/riscv/csr-version-1p12.d  | 16 ++++++---
 gas/testsuite/gas/riscv/csr-version-1p12.l  | 40 ++++++++++++++++-----
 gas/testsuite/gas/riscv/csr-version-1p9p1.d | 16 ++++++---
 gas/testsuite/gas/riscv/csr-version-1p9p1.l | 40 +++++++++++++++++++++
 gas/testsuite/gas/riscv/csr.s               | 10 ++++--
 include/opcode/riscv-opc.h                  | 14 ++++++--
 14 files changed, 228 insertions(+), 48 deletions(-)

diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
index cb65024beaff..82e090235398 100644
--- a/bfd/elfxx-riscv.c
+++ b/bfd/elfxx-riscv.c
@@ -1183,6 +1183,7 @@ static struct riscv_implicit_subset riscv_implicit_subsets[] =
   {"zcd", "zca",	check_implicit_always},
   {"zcb", "zca",	check_implicit_always},
   {"smaia", "ssaia",		check_implicit_always},
+  {"smcntrpmf", "zicsr",	check_implicit_always},
   {"smstateen", "ssstateen",	check_implicit_always},
   {"smepmp", "zicsr",		check_implicit_always},
   {"ssaia", "zicsr",		check_implicit_always},
@@ -1328,6 +1329,7 @@ static struct riscv_supported_ext riscv_supported_std_z_ext[] =
 static struct riscv_supported_ext riscv_supported_std_s_ext[] =
 {
   {"smaia",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
+  {"smcntrpmf",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
   {"smepmp",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
   {"smstateen",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
   {"ssaia",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index e49b34fd5245..8c67623e88c1 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -74,6 +74,8 @@ enum riscv_csr_class
   CSR_CLASS_H_32,	/* hypervisor, rv32 only */
   CSR_CLASS_SMAIA,		/* Smaia */
   CSR_CLASS_SMAIA_32,		/* Smaia, rv32 only */
+  CSR_CLASS_SMCNTRPMF,		/* Smcntrpmf */
+  CSR_CLASS_SMCNTRPMF_32,	/* Smcntrpmf, rv32 only */
   CSR_CLASS_SMSTATEEN,		/* Smstateen only */
   CSR_CLASS_SMSTATEEN_32,	/* Smstateen RV32 only */
   CSR_CLASS_SSAIA,		/* Ssaia */
@@ -1052,6 +1054,13 @@ riscv_csr_address (const char *csr_name,
     case CSR_CLASS_SMAIA:
       extension = "smaia";
       break;
+    case CSR_CLASS_SMCNTRPMF_32:
+      is_rv32_only = true;
+      /* Fall through.  */
+    case CSR_CLASS_SMCNTRPMF:
+      need_check_version = true;
+      extension = "smcntrpmf";
+      break;
     case CSR_CLASS_SMSTATEEN_32:
       is_rv32_only = true;
       /* Fall through.  */
diff --git a/gas/testsuite/gas/riscv/csr-dw-regnums.d b/gas/testsuite/gas/riscv/csr-dw-regnums.d
index fd830666ab89..cabb7c719181 100644
--- a/gas/testsuite/gas/riscv/csr-dw-regnums.d
+++ b/gas/testsuite/gas/riscv/csr-dw-regnums.d
@@ -324,6 +324,10 @@ Contents of the .* section:
   DW_CFA_offset_extended_sf: r4888 \(mvienh\) at cfa\+3168
   DW_CFA_offset_extended_sf: r4889 \(mviph\) at cfa\+3172
   DW_CFA_offset_extended_sf: r4948 \(miph\) at cfa\+3408
+  DW_CFA_offset_extended_sf: r4897 \(mcyclecfg\) at cfa\+3204
+  DW_CFA_offset_extended_sf: r4898 \(minstretcfg\) at cfa\+3208
+  DW_CFA_offset_extended_sf: r5921 \(mcyclecfgh\) at cfa\+7300
+  DW_CFA_offset_extended_sf: r5922 \(minstretcfgh\) at cfa\+7304
   DW_CFA_offset_extended_sf: r4876 \(mstateen0\) at cfa\+3120
   DW_CFA_offset_extended_sf: r4877 \(mstateen1\) at cfa\+3124
   DW_CFA_offset_extended_sf: r4878 \(mstateen2\) at cfa\+3128
@@ -404,14 +408,14 @@ Contents of the .* section:
   DW_CFA_offset_extended_sf: r4480 \(satp\) at cfa\+1536
   DW_CFA_offset_extended_sf: r4931 \(mtval\) at cfa\+3340
   DW_CFA_offset_extended_sf: r4896 \(mcountinhibit\) at cfa\+3200
+  DW_CFA_offset_extended_sf: r4897 \(mcyclecfg\) at cfa\+3204
+  DW_CFA_offset_extended_sf: r4898 \(minstretcfg\) at cfa\+3208
   DW_CFA_offset_extended_sf: r4992 \(mbase\) at cfa\+3584
   DW_CFA_offset_extended_sf: r4993 \(mbound\) at cfa\+3588
   DW_CFA_offset_extended_sf: r4994 \(mibase\) at cfa\+3592
   DW_CFA_offset_extended_sf: r4995 \(mibound\) at cfa\+3596
   DW_CFA_offset_extended_sf: r4996 \(mdbase\) at cfa\+3600
   DW_CFA_offset_extended_sf: r4997 \(mdbound\) at cfa\+3604
-  DW_CFA_offset_extended_sf: r4897 \(mscounteren\) at cfa\+3204
-  DW_CFA_offset_extended_sf: r4898 \(mhcounteren\) at cfa\+3208
   DW_CFA_offset_extended: r4096 \(ustatus\) at cfa\+0
   DW_CFA_offset_extended_sf: r4100 \(uie\) at cfa\+16
   DW_CFA_offset_extended_sf: r4101 \(utvec\) at cfa\+20
diff --git a/gas/testsuite/gas/riscv/csr-dw-regnums.s b/gas/testsuite/gas/riscv/csr-dw-regnums.s
index b8b0f7902297..428d07707790 100644
--- a/gas/testsuite/gas/riscv/csr-dw-regnums.s
+++ b/gas/testsuite/gas/riscv/csr-dw-regnums.s
@@ -321,6 +321,11 @@ _start:
 	.cfi_offset mvienh, 3168
 	.cfi_offset mviph, 3172
 	.cfi_offset miph, 3408
+	# Smcntrpmf extension
+	.cfi_offset mcyclecfg, 3204
+	.cfi_offset minstretcfg, 3208
+	.cfi_offset mcyclecfgh, 7300
+	.cfi_offset minstretcfgh, 7304
 	# Smstateen extension
 	.cfi_offset mstateen0, 3120
 	.cfi_offset mstateen1, 3124
@@ -406,14 +411,14 @@ _start:
 	.cfi_offset sptbr, 1536		# aliases
 	.cfi_offset mbadaddr, 3340	# aliases
 	.cfi_offset mucounteren, 3200	# aliases
+	.cfi_offset mscounteren, 3204	# aliases
+	.cfi_offset mhcounteren, 3208	# aliases
 	.cfi_offset mbase, 3584
 	.cfi_offset mbound, 3588
 	.cfi_offset mibase, 3592
 	.cfi_offset mibound, 3596
 	.cfi_offset mdbase, 3600
 	.cfi_offset mdbound, 3604
-	.cfi_offset mscounteren, 3204
-	.cfi_offset mhcounteren, 3208
 	.cfi_offset ustatus, 0
 	.cfi_offset uie, 16
 	.cfi_offset utvec, 20
diff --git a/gas/testsuite/gas/riscv/csr-version-1p10.d b/gas/testsuite/gas/riscv/csr-version-1p10.d
index ee41e1025cce..dbdc077adac8 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p10.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p10.d
@@ -623,6 +623,14 @@ Disassembly of section .text:
 [ 	]+[0-9a-f]+:[ 	]+31959073[ 	]+csrw[ 	]+mviph,a1
 [ 	]+[0-9a-f]+:[ 	]+35402573[ 	]+csrr[ 	]+a0,miph
 [ 	]+[0-9a-f]+:[ 	]+35459073[ 	]+csrw[ 	]+miph,a1
+[ 	]+[0-9a-f]+:[ 	]+32102573[ 	]+csrr[ 	]+a0,mcyclecfg
+[ 	]+[0-9a-f]+:[ 	]+32159073[ 	]+csrw[ 	]+mcyclecfg,a1
+[ 	]+[0-9a-f]+:[ 	]+32202573[ 	]+csrr[ 	]+a0,minstretcfg
+[ 	]+[0-9a-f]+:[ 	]+32259073[ 	]+csrw[ 	]+minstretcfg,a1
+[ 	]+[0-9a-f]+:[ 	]+72102573[ 	]+csrr[ 	]+a0,mcyclecfgh
+[ 	]+[0-9a-f]+:[ 	]+72159073[ 	]+csrw[ 	]+mcyclecfgh,a1
+[ 	]+[0-9a-f]+:[ 	]+72202573[ 	]+csrr[ 	]+a0,minstretcfgh
+[ 	]+[0-9a-f]+:[ 	]+72259073[ 	]+csrw[ 	]+minstretcfgh,a1
 [ 	]+[0-9a-f]+:[ 	]+30c02573[ 	]+csrr[ 	]+a0,mstateen0
 [ 	]+[0-9a-f]+:[ 	]+30c59073[ 	]+csrw[ 	]+mstateen0,a1
 [ 	]+[0-9a-f]+:[ 	]+30d02573[ 	]+csrr[ 	]+a0,mstateen1
@@ -783,6 +791,10 @@ Disassembly of section .text:
 [ 	]+[0-9a-f]+:[ 	]+34359073[ 	]+csrw[ 	]+mtval,a1
 [ 	]+[0-9a-f]+:[ 	]+32002573[ 	]+csrr[ 	]+a0,0x320
 [ 	]+[0-9a-f]+:[ 	]+32059073[ 	]+csrw[ 	]+0x320,a1
+[ 	]+[0-9a-f]+:[ 	]+32102573[ 	]+csrr[ 	]+a0,mcyclecfg
+[ 	]+[0-9a-f]+:[ 	]+32159073[ 	]+csrw[ 	]+mcyclecfg,a1
+[ 	]+[0-9a-f]+:[ 	]+32202573[ 	]+csrr[ 	]+a0,minstretcfg
+[ 	]+[0-9a-f]+:[ 	]+32259073[ 	]+csrw[ 	]+minstretcfg,a1
 [ 	]+[0-9a-f]+:[ 	]+38002573[ 	]+csrr[ 	]+a0,0x380
 [ 	]+[0-9a-f]+:[ 	]+38059073[ 	]+csrw[ 	]+0x380,a1
 [ 	]+[0-9a-f]+:[ 	]+38102573[ 	]+csrr[ 	]+a0,0x381
@@ -795,10 +807,6 @@ Disassembly of section .text:
 [ 	]+[0-9a-f]+:[ 	]+38459073[ 	]+csrw[ 	]+0x384,a1
 [ 	]+[0-9a-f]+:[ 	]+38502573[ 	]+csrr[ 	]+a0,0x385
 [ 	]+[0-9a-f]+:[ 	]+38559073[ 	]+csrw[ 	]+0x385,a1
-[ 	]+[0-9a-f]+:[ 	]+32102573[ 	]+csrr[ 	]+a0,0x321
-[ 	]+[0-9a-f]+:[ 	]+32159073[ 	]+csrw[ 	]+0x321,a1
-[ 	]+[0-9a-f]+:[ 	]+32202573[ 	]+csrr[ 	]+a0,0x322
-[ 	]+[0-9a-f]+:[ 	]+32259073[ 	]+csrw[ 	]+0x322,a1
 [ 	]+[0-9a-f]+:[ 	]+00002573[ 	]+csrr[ 	]+a0,ustatus
 [ 	]+[0-9a-f]+:[ 	]+00059073[ 	]+csrw[ 	]+ustatus,a1
 [ 	]+[0-9a-f]+:[ 	]+00402573[ 	]+csrr[ 	]+a0,uie
diff --git a/gas/testsuite/gas/riscv/csr-version-1p10.l b/gas/testsuite/gas/riscv/csr-version-1p10.l
index 27bdc80c0d54..054179a416db 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p10.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p10.l
@@ -889,6 +889,30 @@
 .*Info: macro .*
 .*Warning: invalid CSR `miph', needs `smaia' extension
 .*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs `smcntrpmf' extension
+.*Info: macro .*
 .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
 .*Info: macro .*
 .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
@@ -1507,6 +1531,14 @@
 .*Info: macro .*
 .*Warning: invalid CSR `mucounteren' for the privileged spec `1.10'
 .*Info: macro .*
+.*Warning: invalid CSR `mscounteren' for the privileged spec `1.10'
+.*Info: macro .*
+.*Warning: invalid CSR `mscounteren' for the privileged spec `1.10'
+.*Info: macro .*
+.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.10'
+.*Info: macro .*
+.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.10'
+.*Info: macro .*
 .*Warning: invalid CSR `mbase' for the privileged spec `1.10'
 .*Info: macro .*
 .*Warning: invalid CSR `mbase' for the privileged spec `1.10'
@@ -1531,14 +1563,6 @@
 .*Info: macro .*
 .*Warning: invalid CSR `mdbound' for the privileged spec `1.10'
 .*Info: macro .*
-.*Warning: invalid CSR `mscounteren' for the privileged spec `1.10'
-.*Info: macro .*
-.*Warning: invalid CSR `mscounteren' for the privileged spec `1.10'
-.*Info: macro .*
-.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.10'
-.*Info: macro .*
-.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.10'
-.*Info: macro .*
 .*Warning: invalid CSR `fflags', needs `f' extension
 .*Info: macro .*
 .*Warning: invalid CSR `fflags', needs `f' extension
diff --git a/gas/testsuite/gas/riscv/csr-version-1p11.d b/gas/testsuite/gas/riscv/csr-version-1p11.d
index a83b1bf68f98..7ba88b6d1d53 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p11.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p11.d
@@ -623,6 +623,14 @@ Disassembly of section .text:
 [ 	]+[0-9a-f]+:[ 	]+31959073[ 	]+csrw[ 	]+mviph,a1
 [ 	]+[0-9a-f]+:[ 	]+35402573[ 	]+csrr[ 	]+a0,miph
 [ 	]+[0-9a-f]+:[ 	]+35459073[ 	]+csrw[ 	]+miph,a1
+[ 	]+[0-9a-f]+:[ 	]+32102573[ 	]+csrr[ 	]+a0,mcyclecfg
+[ 	]+[0-9a-f]+:[ 	]+32159073[ 	]+csrw[ 	]+mcyclecfg,a1
+[ 	]+[0-9a-f]+:[ 	]+32202573[ 	]+csrr[ 	]+a0,minstretcfg
+[ 	]+[0-9a-f]+:[ 	]+32259073[ 	]+csrw[ 	]+minstretcfg,a1
+[ 	]+[0-9a-f]+:[ 	]+72102573[ 	]+csrr[ 	]+a0,mcyclecfgh
+[ 	]+[0-9a-f]+:[ 	]+72159073[ 	]+csrw[ 	]+mcyclecfgh,a1
+[ 	]+[0-9a-f]+:[ 	]+72202573[ 	]+csrr[ 	]+a0,minstretcfgh
+[ 	]+[0-9a-f]+:[ 	]+72259073[ 	]+csrw[ 	]+minstretcfgh,a1
 [ 	]+[0-9a-f]+:[ 	]+30c02573[ 	]+csrr[ 	]+a0,mstateen0
 [ 	]+[0-9a-f]+:[ 	]+30c59073[ 	]+csrw[ 	]+mstateen0,a1
 [ 	]+[0-9a-f]+:[ 	]+30d02573[ 	]+csrr[ 	]+a0,mstateen1
@@ -783,6 +791,10 @@ Disassembly of section .text:
 [ 	]+[0-9a-f]+:[ 	]+34359073[ 	]+csrw[ 	]+mtval,a1
 [ 	]+[0-9a-f]+:[ 	]+32002573[ 	]+csrr[ 	]+a0,mcountinhibit
 [ 	]+[0-9a-f]+:[ 	]+32059073[ 	]+csrw[ 	]+mcountinhibit,a1
+[ 	]+[0-9a-f]+:[ 	]+32102573[ 	]+csrr[ 	]+a0,mcyclecfg
+[ 	]+[0-9a-f]+:[ 	]+32159073[ 	]+csrw[ 	]+mcyclecfg,a1
+[ 	]+[0-9a-f]+:[ 	]+32202573[ 	]+csrr[ 	]+a0,minstretcfg
+[ 	]+[0-9a-f]+:[ 	]+32259073[ 	]+csrw[ 	]+minstretcfg,a1
 [ 	]+[0-9a-f]+:[ 	]+38002573[ 	]+csrr[ 	]+a0,0x380
 [ 	]+[0-9a-f]+:[ 	]+38059073[ 	]+csrw[ 	]+0x380,a1
 [ 	]+[0-9a-f]+:[ 	]+38102573[ 	]+csrr[ 	]+a0,0x381
@@ -795,10 +807,6 @@ Disassembly of section .text:
 [ 	]+[0-9a-f]+:[ 	]+38459073[ 	]+csrw[ 	]+0x384,a1
 [ 	]+[0-9a-f]+:[ 	]+38502573[ 	]+csrr[ 	]+a0,0x385
 [ 	]+[0-9a-f]+:[ 	]+38559073[ 	]+csrw[ 	]+0x385,a1
-[ 	]+[0-9a-f]+:[ 	]+32102573[ 	]+csrr[ 	]+a0,0x321
-[ 	]+[0-9a-f]+:[ 	]+32159073[ 	]+csrw[ 	]+0x321,a1
-[ 	]+[0-9a-f]+:[ 	]+32202573[ 	]+csrr[ 	]+a0,0x322
-[ 	]+[0-9a-f]+:[ 	]+32259073[ 	]+csrw[ 	]+0x322,a1
 [ 	]+[0-9a-f]+:[ 	]+00002573[ 	]+csrr[ 	]+a0,ustatus
 [ 	]+[0-9a-f]+:[ 	]+00059073[ 	]+csrw[ 	]+ustatus,a1
 [ 	]+[0-9a-f]+:[ 	]+00402573[ 	]+csrr[ 	]+a0,uie
diff --git a/gas/testsuite/gas/riscv/csr-version-1p11.l b/gas/testsuite/gas/riscv/csr-version-1p11.l
index ba497228d7fd..cc365f1df415 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p11.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p11.l
@@ -885,6 +885,30 @@
 .*Info: macro .*
 .*Warning: invalid CSR `miph', needs `smaia' extension
 .*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs `smcntrpmf' extension
+.*Info: macro .*
 .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
 .*Info: macro .*
 .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
@@ -1503,6 +1527,14 @@
 .*Info: macro .*
 .*Warning: invalid CSR `mucounteren' for the privileged spec `1.11'
 .*Info: macro .*
+.*Warning: invalid CSR `mscounteren' for the privileged spec `1.11'
+.*Info: macro .*
+.*Warning: invalid CSR `mscounteren' for the privileged spec `1.11'
+.*Info: macro .*
+.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.11'
+.*Info: macro .*
+.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.11'
+.*Info: macro .*
 .*Warning: invalid CSR `mbase' for the privileged spec `1.11'
 .*Info: macro .*
 .*Warning: invalid CSR `mbase' for the privileged spec `1.11'
@@ -1527,14 +1559,6 @@
 .*Info: macro .*
 .*Warning: invalid CSR `mdbound' for the privileged spec `1.11'
 .*Info: macro .*
-.*Warning: invalid CSR `mscounteren' for the privileged spec `1.11'
-.*Info: macro .*
-.*Warning: invalid CSR `mscounteren' for the privileged spec `1.11'
-.*Info: macro .*
-.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.11'
-.*Info: macro .*
-.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.11'
-.*Info: macro .*
 .*Warning: invalid CSR `fflags', needs `f' extension
 .*Info: macro .*
 .*Warning: invalid CSR `fflags', needs `f' extension
diff --git a/gas/testsuite/gas/riscv/csr-version-1p12.d b/gas/testsuite/gas/riscv/csr-version-1p12.d
index 612aac280768..677820b95265 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p12.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p12.d
@@ -623,6 +623,14 @@ Disassembly of section .text:
 [ 	]+[0-9a-f]+:[ 	]+31959073[ 	]+csrw[ 	]+mviph,a1
 [ 	]+[0-9a-f]+:[ 	]+35402573[ 	]+csrr[ 	]+a0,miph
 [ 	]+[0-9a-f]+:[ 	]+35459073[ 	]+csrw[ 	]+miph,a1
+[ 	]+[0-9a-f]+:[ 	]+32102573[ 	]+csrr[ 	]+a0,mcyclecfg
+[ 	]+[0-9a-f]+:[ 	]+32159073[ 	]+csrw[ 	]+mcyclecfg,a1
+[ 	]+[0-9a-f]+:[ 	]+32202573[ 	]+csrr[ 	]+a0,minstretcfg
+[ 	]+[0-9a-f]+:[ 	]+32259073[ 	]+csrw[ 	]+minstretcfg,a1
+[ 	]+[0-9a-f]+:[ 	]+72102573[ 	]+csrr[ 	]+a0,mcyclecfgh
+[ 	]+[0-9a-f]+:[ 	]+72159073[ 	]+csrw[ 	]+mcyclecfgh,a1
+[ 	]+[0-9a-f]+:[ 	]+72202573[ 	]+csrr[ 	]+a0,minstretcfgh
+[ 	]+[0-9a-f]+:[ 	]+72259073[ 	]+csrw[ 	]+minstretcfgh,a1
 [ 	]+[0-9a-f]+:[ 	]+30c02573[ 	]+csrr[ 	]+a0,mstateen0
 [ 	]+[0-9a-f]+:[ 	]+30c59073[ 	]+csrw[ 	]+mstateen0,a1
 [ 	]+[0-9a-f]+:[ 	]+30d02573[ 	]+csrr[ 	]+a0,mstateen1
@@ -783,6 +791,10 @@ Disassembly of section .text:
 [ 	]+[0-9a-f]+:[ 	]+34359073[ 	]+csrw[ 	]+mtval,a1
 [ 	]+[0-9a-f]+:[ 	]+32002573[ 	]+csrr[ 	]+a0,mcountinhibit
 [ 	]+[0-9a-f]+:[ 	]+32059073[ 	]+csrw[ 	]+mcountinhibit,a1
+[ 	]+[0-9a-f]+:[ 	]+32102573[ 	]+csrr[ 	]+a0,mcyclecfg
+[ 	]+[0-9a-f]+:[ 	]+32159073[ 	]+csrw[ 	]+mcyclecfg,a1
+[ 	]+[0-9a-f]+:[ 	]+32202573[ 	]+csrr[ 	]+a0,minstretcfg
+[ 	]+[0-9a-f]+:[ 	]+32259073[ 	]+csrw[ 	]+minstretcfg,a1
 [ 	]+[0-9a-f]+:[ 	]+38002573[ 	]+csrr[ 	]+a0,0x380
 [ 	]+[0-9a-f]+:[ 	]+38059073[ 	]+csrw[ 	]+0x380,a1
 [ 	]+[0-9a-f]+:[ 	]+38102573[ 	]+csrr[ 	]+a0,0x381
@@ -795,10 +807,6 @@ Disassembly of section .text:
 [ 	]+[0-9a-f]+:[ 	]+38459073[ 	]+csrw[ 	]+0x384,a1
 [ 	]+[0-9a-f]+:[ 	]+38502573[ 	]+csrr[ 	]+a0,0x385
 [ 	]+[0-9a-f]+:[ 	]+38559073[ 	]+csrw[ 	]+0x385,a1
-[ 	]+[0-9a-f]+:[ 	]+32102573[ 	]+csrr[ 	]+a0,0x321
-[ 	]+[0-9a-f]+:[ 	]+32159073[ 	]+csrw[ 	]+0x321,a1
-[ 	]+[0-9a-f]+:[ 	]+32202573[ 	]+csrr[ 	]+a0,0x322
-[ 	]+[0-9a-f]+:[ 	]+32259073[ 	]+csrw[ 	]+0x322,a1
 [ 	]+[0-9a-f]+:[ 	]+00002573[ 	]+csrr[ 	]+a0,0x0
 [ 	]+[0-9a-f]+:[ 	]+00059073[ 	]+csrw[ 	]+0x0,a1
 [ 	]+[0-9a-f]+:[ 	]+00402573[ 	]+csrr[ 	]+a0,0x4
diff --git a/gas/testsuite/gas/riscv/csr-version-1p12.l b/gas/testsuite/gas/riscv/csr-version-1p12.l
index bdebea22334a..7a7f5f717c52 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p12.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p12.l
@@ -609,6 +609,30 @@
 .*Info: macro .*
 .*Warning: invalid CSR `miph', needs `smaia' extension
 .*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs `smcntrpmf' extension
+.*Info: macro .*
 .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
 .*Info: macro .*
 .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
@@ -1227,6 +1251,14 @@
 .*Info: macro .*
 .*Warning: invalid CSR `mucounteren' for the privileged spec `1.12'
 .*Info: macro .*
+.*Warning: invalid CSR `mscounteren' for the privileged spec `1.12'
+.*Info: macro .*
+.*Warning: invalid CSR `mscounteren' for the privileged spec `1.12'
+.*Info: macro .*
+.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.12'
+.*Info: macro .*
+.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.12'
+.*Info: macro .*
 .*Warning: invalid CSR `mbase' for the privileged spec `1.12'
 .*Info: macro .*
 .*Warning: invalid CSR `mbase' for the privileged spec `1.12'
@@ -1251,14 +1283,6 @@
 .*Info: macro .*
 .*Warning: invalid CSR `mdbound' for the privileged spec `1.12'
 .*Info: macro .*
-.*Warning: invalid CSR `mscounteren' for the privileged spec `1.12'
-.*Info: macro .*
-.*Warning: invalid CSR `mscounteren' for the privileged spec `1.12'
-.*Info: macro .*
-.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.12'
-.*Info: macro .*
-.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.12'
-.*Info: macro .*
 .*Warning: invalid CSR `ustatus' for the privileged spec `1.12'
 .*Info: macro .*
 .*Warning: invalid CSR `ustatus' for the privileged spec `1.12'
diff --git a/gas/testsuite/gas/riscv/csr-version-1p9p1.d b/gas/testsuite/gas/riscv/csr-version-1p9p1.d
index 0fe849c269c2..f4d2b04ca6a4 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p9p1.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p9p1.d
@@ -623,6 +623,14 @@ Disassembly of section .text:
 [ 	]+[0-9a-f]+:[ 	]+31959073[ 	]+csrw[ 	]+mviph,a1
 [ 	]+[0-9a-f]+:[ 	]+35402573[ 	]+csrr[ 	]+a0,miph
 [ 	]+[0-9a-f]+:[ 	]+35459073[ 	]+csrw[ 	]+miph,a1
+[ 	]+[0-9a-f]+:[ 	]+32102573[ 	]+csrr[ 	]+a0,mscounteren
+[ 	]+[0-9a-f]+:[ 	]+32159073[ 	]+csrw[ 	]+mscounteren,a1
+[ 	]+[0-9a-f]+:[ 	]+32202573[ 	]+csrr[ 	]+a0,mhcounteren
+[ 	]+[0-9a-f]+:[ 	]+32259073[ 	]+csrw[ 	]+mhcounteren,a1
+[ 	]+[0-9a-f]+:[ 	]+72102573[ 	]+csrr[ 	]+a0,0x721
+[ 	]+[0-9a-f]+:[ 	]+72159073[ 	]+csrw[ 	]+0x721,a1
+[ 	]+[0-9a-f]+:[ 	]+72202573[ 	]+csrr[ 	]+a0,0x722
+[ 	]+[0-9a-f]+:[ 	]+72259073[ 	]+csrw[ 	]+0x722,a1
 [ 	]+[0-9a-f]+:[ 	]+30c02573[ 	]+csrr[ 	]+a0,mstateen0
 [ 	]+[0-9a-f]+:[ 	]+30c59073[ 	]+csrw[ 	]+mstateen0,a1
 [ 	]+[0-9a-f]+:[ 	]+30d02573[ 	]+csrr[ 	]+a0,mstateen1
@@ -783,6 +791,10 @@ Disassembly of section .text:
 [ 	]+[0-9a-f]+:[ 	]+34359073[ 	]+csrw[ 	]+mbadaddr,a1
 [ 	]+[0-9a-f]+:[ 	]+32002573[ 	]+csrr[ 	]+a0,mucounteren
 [ 	]+[0-9a-f]+:[ 	]+32059073[ 	]+csrw[ 	]+mucounteren,a1
+[ 	]+[0-9a-f]+:[ 	]+32102573[ 	]+csrr[ 	]+a0,mscounteren
+[ 	]+[0-9a-f]+:[ 	]+32159073[ 	]+csrw[ 	]+mscounteren,a1
+[ 	]+[0-9a-f]+:[ 	]+32202573[ 	]+csrr[ 	]+a0,mhcounteren
+[ 	]+[0-9a-f]+:[ 	]+32259073[ 	]+csrw[ 	]+mhcounteren,a1
 [ 	]+[0-9a-f]+:[ 	]+38002573[ 	]+csrr[ 	]+a0,mbase
 [ 	]+[0-9a-f]+:[ 	]+38059073[ 	]+csrw[ 	]+mbase,a1
 [ 	]+[0-9a-f]+:[ 	]+38102573[ 	]+csrr[ 	]+a0,mbound
@@ -795,10 +807,6 @@ Disassembly of section .text:
 [ 	]+[0-9a-f]+:[ 	]+38459073[ 	]+csrw[ 	]+mdbase,a1
 [ 	]+[0-9a-f]+:[ 	]+38502573[ 	]+csrr[ 	]+a0,mdbound
 [ 	]+[0-9a-f]+:[ 	]+38559073[ 	]+csrw[ 	]+mdbound,a1
-[ 	]+[0-9a-f]+:[ 	]+32102573[ 	]+csrr[ 	]+a0,mscounteren
-[ 	]+[0-9a-f]+:[ 	]+32159073[ 	]+csrw[ 	]+mscounteren,a1
-[ 	]+[0-9a-f]+:[ 	]+32202573[ 	]+csrr[ 	]+a0,mhcounteren
-[ 	]+[0-9a-f]+:[ 	]+32259073[ 	]+csrw[ 	]+mhcounteren,a1
 [ 	]+[0-9a-f]+:[ 	]+00002573[ 	]+csrr[ 	]+a0,ustatus
 [ 	]+[0-9a-f]+:[ 	]+00059073[ 	]+csrw[ 	]+ustatus,a1
 [ 	]+[0-9a-f]+:[ 	]+00402573[ 	]+csrr[ 	]+a0,uie
diff --git a/gas/testsuite/gas/riscv/csr-version-1p9p1.l b/gas/testsuite/gas/riscv/csr-version-1p9p1.l
index 49bd95954e2c..7fcd73ab7ddd 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p9p1.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p9p1.l
@@ -989,6 +989,46 @@
 .*Info: macro .*
 .*Warning: invalid CSR `miph', needs `smaia' extension
 .*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg' for the privileged spec `1.9.1'
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg' for the privileged spec `1.9.1'
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg' for the privileged spec `1.9.1'
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg' for the privileged spec `1.9.1'
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh' for the privileged spec `1.9.1'
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh' for the privileged spec `1.9.1'
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh' for the privileged spec `1.9.1'
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh' for the privileged spec `1.9.1'
+.*Info: macro .*
 .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
 .*Info: macro .*
 .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
diff --git a/gas/testsuite/gas/riscv/csr.s b/gas/testsuite/gas/riscv/csr.s
index c7406ce34c2e..6457436af263 100644
--- a/gas/testsuite/gas/riscv/csr.s
+++ b/gas/testsuite/gas/riscv/csr.s
@@ -350,6 +350,12 @@
 	csr mviph
 	csr miph
 
+	# Smcntrpmf extension
+	csr mcyclecfg
+	csr minstretcfg
+	csr mcyclecfgh
+	csr minstretcfgh
+
 	# Smstateen/Ssstateen extensions
 	csr mstateen0
 	csr mstateen1
@@ -440,14 +446,14 @@
 	csr sptbr		# 0x180 in 1.9.1, but the value is satp since 1.10
 	csr mbadaddr		# 0x343 in 1.9.1, but the value is mtval since 1.10
 	csr mucounteren		# 0x320 in 1.9.1, dropped in 1.10, but the value is mcountinhibit since 1.11
+	csr mscounteren		# 0x321 in 1.9.1, dropped in 1.10, but the value is mcyclecfg for Smcntrpmf extension
+	csr mhcounteren		# 0x322 in 1.9.1, dropped in 1.10, but the value is mcyclecfg for Smcntrpmf extension
 	csr mbase		# 0x380 in 1.9.1, dropped in 1.10
 	csr mbound		# 0x381 in 1.9.1, dropped in 1.10
 	csr mibase		# 0x382 in 1.9.1, dropped in 1.10
 	csr mibound		# 0x383 in 1.9.1, dropped in 1.10
 	csr mdbase		# 0x384 in 1.9.1, dropped in 1.10
 	csr mdbound		# 0x385 in 1.9.1, dropped in 1.10
-	csr mscounteren		# 0x321 in 1.9.1, dropped in 1.10
-	csr mhcounteren		# 0x322 in 1.9.1, dropped in 1.10
 	csr ustatus		# 0x0   in 1.9.1, dropped in 1.12
 	csr uie			# 0x4   in 1.9.1, dropped in 1.12
 	csr utvec		# 0x5   in 1.9.1, dropped in 1.12
diff --git a/include/opcode/riscv-opc.h b/include/opcode/riscv-opc.h
index 26d2c04bf241..50922926a4cf 100644
--- a/include/opcode/riscv-opc.h
+++ b/include/opcode/riscv-opc.h
@@ -2880,6 +2880,11 @@
 #define CSR_MVIENH   0x318
 #define CSR_MVIPH    0x319
 #define CSR_MIPH     0x354
+/* Smcntrpmf extension.  */
+#define CSR_MCYCLECFG    0x321
+#define CSR_MINSTRETCFG  0x322
+#define CSR_MCYCLECFGH   0x721
+#define CSR_MINSTRETCFGH 0x722
 /* Smstateen extension */
 #define CSR_MSTATEEN0 0x30c
 #define CSR_MSTATEEN1 0x30d
@@ -3866,6 +3871,11 @@ DECLARE_CSR(mieh, CSR_MIEH, CSR_CLASS_SMAIA_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_
 DECLARE_CSR(mvienh, CSR_MVIENH, CSR_CLASS_SMAIA_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
 DECLARE_CSR(mviph, CSR_MVIPH, CSR_CLASS_SMAIA_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
 DECLARE_CSR(miph, CSR_MIPH, CSR_CLASS_SMAIA_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+/* Smcntrpmf extension (incompatible with the privileged spec v1.9.1).  */
+DECLARE_CSR(mcyclecfg, CSR_MCYCLECFG, CSR_CLASS_SMCNTRPMF, PRIV_SPEC_CLASS_1P10, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(minstretcfg, CSR_MINSTRETCFG, CSR_CLASS_SMCNTRPMF, PRIV_SPEC_CLASS_1P10, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mcyclecfgh, CSR_MCYCLECFGH, CSR_CLASS_SMCNTRPMF_32, PRIV_SPEC_CLASS_1P10, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(minstretcfgh, CSR_MINSTRETCFGH, CSR_CLASS_SMCNTRPMF_32, PRIV_SPEC_CLASS_1P10, PRIV_SPEC_CLASS_DRAFT)
 /* Smstateen/Ssstateen extensions.  */
 DECLARE_CSR(mstateen0, CSR_MSTATEEN0, CSR_CLASS_SMSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
 DECLARE_CSR(mstateen1, CSR_MSTATEEN1, CSR_CLASS_SMSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
@@ -3952,8 +3962,6 @@ DECLARE_CSR(mibase, CSR_MIBASE, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CL
 DECLARE_CSR(mibound, CSR_MIBOUND, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P10)
 DECLARE_CSR(mdbase, CSR_MDBASE, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P10)
 DECLARE_CSR(mdbound, CSR_MDBOUND, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P10)
-DECLARE_CSR(mscounteren, CSR_MSCOUNTEREN, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P10)
-DECLARE_CSR(mhcounteren, CSR_MHCOUNTEREN, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P10)
 DECLARE_CSR(ustatus, CSR_USTATUS, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P12)
 DECLARE_CSR(uie, CSR_UIE, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P12)
 DECLARE_CSR(utvec, CSR_UTVEC, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P12)
@@ -4000,6 +4008,8 @@ DECLARE_CSR_ALIAS(sbadaddr, CSR_STVAL, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_
 DECLARE_CSR_ALIAS(sptbr, CSR_SATP, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P10)
 DECLARE_CSR_ALIAS(mbadaddr, CSR_MTVAL, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P10)
 DECLARE_CSR_ALIAS(mucounteren, CSR_MCOUNTINHIBIT, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P10)
+DECLARE_CSR_ALIAS(mscounteren, CSR_MSCOUNTEREN, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P10)
+DECLARE_CSR_ALIAS(mhcounteren, CSR_MHCOUNTEREN, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P10)
 DECLARE_CSR_ALIAS(dscratch, CSR_DSCRATCH0, CSR_CLASS_DEBUG, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
 DECLARE_CSR_ALIAS(mcontrol, CSR_TDATA1, CSR_CLASS_DEBUG, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
 DECLARE_CSR_ALIAS(mcontrol6, CSR_TDATA1, CSR_CLASS_DEBUG, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
-- 
2.42.0


  reply	other threads:[~2023-09-03  2:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-03  2:42 [PATCH 0/1] " Tsukasa OI
2023-09-03  2:42 ` Tsukasa OI [this message]
2023-09-03  2:47   ` [PATCH 1/1] " Tsukasa OI
2023-09-05  1:12   ` Nelson Chu
2023-09-05  3:18     ` Tsukasa OI

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=1d3089dcef14d2c7e19fd5424a2a4a11a665d2ff.1693708909.git.research_trasio@irq.a4lg.com \
    --to=research_trasio@irq.a4lg.com \
    --cc=andrew@sifive.com \
    --cc=binutils@sourceware.org \
    --cc=jiawei@iscas.ac.cn \
    --cc=jim.wilson.gcc@gmail.com \
    --cc=kito.cheng@sifive.com \
    --cc=nelson@rivosinc.com \
    --cc=palmer@dabbelt.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).