[5/6] RISC-V: Add 'Sscofpmf' extension with its CSRs

Message ID 122cb28cd403468a1c0338b97dda05f5299111f1.1641898723.git.research_trasio@irq.a4lg.com
State New
Headers show
Series
  • RISC-V: Add Privileged Arch 1.12 and More CSRs
Related show

Commit Message

H.J. Lu via Binutils Jan. 11, 2022, 10:59 a.m.
This commit adds Count Overflow and Mode-Based Filtering Extension
(Sscofpmf) and its CSRs.

bfd/ChangeLog:

	* elfxx-riscv.c (riscv_supported_std_s_ext): Add 'Sscofpmf'
	extension to valid 'S' extension list.

gas/ChangeLog:

	* config/tc-riscv.c (enum riscv_csr_class): Add CSR classes for
	'Sscofpmf' extension. (riscv_csr_address): Add handling for new
	CSR classes.
	* testsuite/gas/riscv/csr-dw-regnums.s: Add new CSRs.
	* testsuite/gas/riscv/csr-dw-regnums.d: Likewise.
	* testsuite/gas/riscv/csr.s: Add new CSRs.
	* testsuite/gas/riscv/csr-version-1p9p1.d: Likewise.
	* 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 (CSR_SCOUNTOVF, CSR_MHPMEVENT3H,
	CSR_MHPMEVENT4H, CSR_MHPMEVENT5H, CSR_MHPMEVENT6H,
	CSR_MHPMEVENT7H, CSR_MHPMEVENT8H, CSR_MHPMEVENT9H,
	CSR_MHPMEVENT10H, CSR_MHPMEVENT11H, CSR_MHPMEVENT12H,
	CSR_MHPMEVENT13H, CSR_MHPMEVENT14H, CSR_MHPMEVENT15H,
	CSR_MHPMEVENT16H, CSR_MHPMEVENT17H, CSR_MHPMEVENT18H,
	CSR_MHPMEVENT19H, CSR_MHPMEVENT20H, CSR_MHPMEVENT21H,
	CSR_MHPMEVENT22H, CSR_MHPMEVENT23H, CSR_MHPMEVENT24H,
	CSR_MHPMEVENT25H, CSR_MHPMEVENT26H, CSR_MHPMEVENT27H,
	CSR_MHPMEVENT28H, CSR_MHPMEVENT29H, CSR_MHPMEVENT30H,
	CSR_MHPMEVENT31H): New CSR macros.
---
 bfd/elfxx-riscv.c                           |   1 +
 gas/config/tc-riscv.c                       |   8 ++
 gas/testsuite/gas/riscv/csr-dw-regnums.d    |  30 +++++
 gas/testsuite/gas/riscv/csr-dw-regnums.s    |  31 +++++
 gas/testsuite/gas/riscv/csr-version-1p10.d  |  60 ++++++++++
 gas/testsuite/gas/riscv/csr-version-1p10.l  | 121 ++++++++++++++++++++
 gas/testsuite/gas/riscv/csr-version-1p11.d  |  60 ++++++++++
 gas/testsuite/gas/riscv/csr-version-1p11.l  |  61 ++++++++++
 gas/testsuite/gas/riscv/csr-version-1p12.d  |  60 ++++++++++
 gas/testsuite/gas/riscv/csr-version-1p12.l  |  61 ++++++++++
 gas/testsuite/gas/riscv/csr-version-1p9p1.d |  60 ++++++++++
 gas/testsuite/gas/riscv/csr-version-1p9p1.l | 121 ++++++++++++++++++++
 gas/testsuite/gas/riscv/csr.s               |  32 ++++++
 include/opcode/riscv-opc.h                  |  62 ++++++++++
 14 files changed, 768 insertions(+)

-- 
2.32.0

Patch

diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
index 99cce0f113b..f8061869047 100644
--- a/bfd/elfxx-riscv.c
+++ b/bfd/elfxx-riscv.c
@@ -1228,6 +1228,7 @@  static struct riscv_supported_ext riscv_supported_std_z_ext[] =
 static struct riscv_supported_ext riscv_supported_std_s_ext[] =
 {
   {"smstateen",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
+  {"sscofpmf",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
   {"svinval",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
   {NULL, 0, 0, 0, 0}
 };
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index 832823ad083..03389605869 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -67,6 +67,8 @@  enum riscv_csr_class
   CSR_CLASS_V,		/* rvv only */
   CSR_CLASS_SMSTATEEN,		/* Smstateen only */
   CSR_CLASS_SMSTATEEN_32,	/* Smstateen RV32 only */
+  CSR_CLASS_SSCOFPMF,		/* Sscofpmf only */
+  CSR_CLASS_SSCOFPMF_32,	/* Sscofpmf RV32 only */
   CSR_CLASS_DEBUG	/* debug CSR */
 };
 
@@ -913,6 +915,12 @@  riscv_csr_address (const char *csr_name,
     case CSR_CLASS_SMSTATEEN_32:
       result = (xlen == 32 && riscv_subset_supports (&riscv_rps_as, "smstateen"));
       break;
+    case CSR_CLASS_SSCOFPMF:
+      result = riscv_subset_supports (&riscv_rps_as, "sscofpmf");
+      break;
+    case CSR_CLASS_SSCOFPMF_32:
+      result = (xlen == 32 && riscv_subset_supports (&riscv_rps_as, "sscofpmf"));
+      break;
     case CSR_CLASS_DEBUG:
       need_check_version = false;
       break;
diff --git a/gas/testsuite/gas/riscv/csr-dw-regnums.d b/gas/testsuite/gas/riscv/csr-dw-regnums.d
index e4181a9274d..355272e5327 100644
--- a/gas/testsuite/gas/riscv/csr-dw-regnums.d
+++ b/gas/testsuite/gas/riscv/csr-dw-regnums.d
@@ -344,6 +344,36 @@  Contents of the .* section:
   DW_CFA_offset_extended_sf: r5661 \(hstateen1h\) at cfa\+6260
   DW_CFA_offset_extended_sf: r5662 \(hstateen2h\) at cfa\+6264
   DW_CFA_offset_extended_sf: r5663 \(hstateen3h\) at cfa\+6268
+  DW_CFA_offset_extended_sf: r7584 \(scountovf\) at cfa\+13952
+  DW_CFA_offset_extended_sf: r5923 \(mhpmevent3h\) at cfa\+7308
+  DW_CFA_offset_extended_sf: r5924 \(mhpmevent4h\) at cfa\+7312
+  DW_CFA_offset_extended_sf: r5925 \(mhpmevent5h\) at cfa\+7316
+  DW_CFA_offset_extended_sf: r5926 \(mhpmevent6h\) at cfa\+7320
+  DW_CFA_offset_extended_sf: r5927 \(mhpmevent7h\) at cfa\+7324
+  DW_CFA_offset_extended_sf: r5928 \(mhpmevent8h\) at cfa\+7328
+  DW_CFA_offset_extended_sf: r5929 \(mhpmevent9h\) at cfa\+7332
+  DW_CFA_offset_extended_sf: r5930 \(mhpmevent10h\) at cfa\+7336
+  DW_CFA_offset_extended_sf: r5931 \(mhpmevent11h\) at cfa\+7340
+  DW_CFA_offset_extended_sf: r5932 \(mhpmevent12h\) at cfa\+7344
+  DW_CFA_offset_extended_sf: r5933 \(mhpmevent13h\) at cfa\+7348
+  DW_CFA_offset_extended_sf: r5934 \(mhpmevent14h\) at cfa\+7352
+  DW_CFA_offset_extended_sf: r5935 \(mhpmevent15h\) at cfa\+7356
+  DW_CFA_offset_extended_sf: r5936 \(mhpmevent16h\) at cfa\+7360
+  DW_CFA_offset_extended_sf: r5937 \(mhpmevent17h\) at cfa\+7364
+  DW_CFA_offset_extended_sf: r5938 \(mhpmevent18h\) at cfa\+7368
+  DW_CFA_offset_extended_sf: r5939 \(mhpmevent19h\) at cfa\+7372
+  DW_CFA_offset_extended_sf: r5940 \(mhpmevent20h\) at cfa\+7376
+  DW_CFA_offset_extended_sf: r5941 \(mhpmevent21h\) at cfa\+7380
+  DW_CFA_offset_extended_sf: r5942 \(mhpmevent22h\) at cfa\+7384
+  DW_CFA_offset_extended_sf: r5943 \(mhpmevent23h\) at cfa\+7388
+  DW_CFA_offset_extended_sf: r5944 \(mhpmevent24h\) at cfa\+7392
+  DW_CFA_offset_extended_sf: r5945 \(mhpmevent25h\) at cfa\+7396
+  DW_CFA_offset_extended_sf: r5946 \(mhpmevent26h\) at cfa\+7400
+  DW_CFA_offset_extended_sf: r5947 \(mhpmevent27h\) at cfa\+7404
+  DW_CFA_offset_extended_sf: r5948 \(mhpmevent28h\) at cfa\+7408
+  DW_CFA_offset_extended_sf: r5949 \(mhpmevent29h\) at cfa\+7412
+  DW_CFA_offset_extended_sf: r5950 \(mhpmevent30h\) at cfa\+7416
+  DW_CFA_offset_extended_sf: r5951 \(mhpmevent31h\) at cfa\+7420
   DW_CFA_offset_extended_sf: r4163 \(utval\) at cfa\+268
   DW_CFA_offset_extended_sf: r4419 \(stval\) at cfa\+1292
   DW_CFA_offset_extended_sf: r4480 \(satp\) at cfa\+1536
diff --git a/gas/testsuite/gas/riscv/csr-dw-regnums.s b/gas/testsuite/gas/riscv/csr-dw-regnums.s
index 936c6f8bf18..3f7a520c6f2 100644
--- a/gas/testsuite/gas/riscv/csr-dw-regnums.s
+++ b/gas/testsuite/gas/riscv/csr-dw-regnums.s
@@ -336,6 +336,37 @@  _start:
 	.cfi_offset hstateen1h, 6260
 	.cfi_offset hstateen2h, 6264
 	.cfi_offset hstateen3h, 6268
+	# Sscofpmf extension
+	.cfi_offset scountovf, 13952
+	.cfi_offset mhpmevent3h, 7308
+	.cfi_offset mhpmevent4h, 7312
+	.cfi_offset mhpmevent5h, 7316
+	.cfi_offset mhpmevent6h, 7320
+	.cfi_offset mhpmevent7h, 7324
+	.cfi_offset mhpmevent8h, 7328
+	.cfi_offset mhpmevent9h, 7332
+	.cfi_offset mhpmevent10h, 7336
+	.cfi_offset mhpmevent11h, 7340
+	.cfi_offset mhpmevent12h, 7344
+	.cfi_offset mhpmevent13h, 7348
+	.cfi_offset mhpmevent14h, 7352
+	.cfi_offset mhpmevent15h, 7356
+	.cfi_offset mhpmevent16h, 7360
+	.cfi_offset mhpmevent17h, 7364
+	.cfi_offset mhpmevent18h, 7368
+	.cfi_offset mhpmevent19h, 7372
+	.cfi_offset mhpmevent20h, 7376
+	.cfi_offset mhpmevent21h, 7380
+	.cfi_offset mhpmevent22h, 7384
+	.cfi_offset mhpmevent23h, 7388
+	.cfi_offset mhpmevent24h, 7392
+	.cfi_offset mhpmevent25h, 7396
+	.cfi_offset mhpmevent26h, 7400
+	.cfi_offset mhpmevent27h, 7404
+	.cfi_offset mhpmevent28h, 7408
+	.cfi_offset mhpmevent29h, 7412
+	.cfi_offset mhpmevent30h, 7416
+	.cfi_offset mhpmevent31h, 7420
 	# dropped aliases
 	.cfi_offset ubadaddr, 268
 	.cfi_offset sbadaddr, 1292
diff --git a/gas/testsuite/gas/riscv/csr-version-1p10.d b/gas/testsuite/gas/riscv/csr-version-1p10.d
index 884904ed632..84cd8c651ce 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p10.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p10.d
@@ -663,6 +663,66 @@  Disassembly of section .text:
 [ 	]+[0-9a-f]+:[ 	]+61e59073[ 	]+csrw[ 	]+0x61e,a1
 [ 	]+[0-9a-f]+:[ 	]+61f02573[ 	]+csrr[ 	]+a0,0x61f
 [ 	]+[0-9a-f]+:[ 	]+61f59073[ 	]+csrw[ 	]+0x61f,a1
+[ 	]+[0-9a-f]+:[ 	]+da002573[ 	]+csrr[ 	]+a0,0xda0
+[ 	]+[0-9a-f]+:[ 	]+da059073[ 	]+csrw[ 	]+0xda0,a1
+[ 	]+[0-9a-f]+:[ 	]+72302573[ 	]+csrr[ 	]+a0,0x723
+[ 	]+[0-9a-f]+:[ 	]+72359073[ 	]+csrw[ 	]+0x723,a1
+[ 	]+[0-9a-f]+:[ 	]+72402573[ 	]+csrr[ 	]+a0,0x724
+[ 	]+[0-9a-f]+:[ 	]+72459073[ 	]+csrw[ 	]+0x724,a1
+[ 	]+[0-9a-f]+:[ 	]+72502573[ 	]+csrr[ 	]+a0,0x725
+[ 	]+[0-9a-f]+:[ 	]+72559073[ 	]+csrw[ 	]+0x725,a1
+[ 	]+[0-9a-f]+:[ 	]+72602573[ 	]+csrr[ 	]+a0,0x726
+[ 	]+[0-9a-f]+:[ 	]+72659073[ 	]+csrw[ 	]+0x726,a1
+[ 	]+[0-9a-f]+:[ 	]+72702573[ 	]+csrr[ 	]+a0,0x727
+[ 	]+[0-9a-f]+:[ 	]+72759073[ 	]+csrw[ 	]+0x727,a1
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,a1
+[ 	]+[0-9a-f]+:[ 	]+73d02573[ 	]+csrr[ 	]+a0,0x73d
+[ 	]+[0-9a-f]+:[ 	]+73d59073[ 	]+csrw[ 	]+0x73d,a1
+[ 	]+[0-9a-f]+:[ 	]+73e02573[ 	]+csrr[ 	]+a0,0x73e
+[ 	]+[0-9a-f]+:[ 	]+73e59073[ 	]+csrw[ 	]+0x73e,a1
+[ 	]+[0-9a-f]+:[ 	]+73f02573[ 	]+csrr[ 	]+a0,0x73f
+[ 	]+[0-9a-f]+:[ 	]+73f59073[ 	]+csrw[ 	]+0x73f,a1
 [ 	]+[0-9a-f]+:[ 	]+04302573[ 	]+csrr[ 	]+a0,utval
 [ 	]+[0-9a-f]+:[ 	]+04359073[ 	]+csrw[ 	]+utval,a1
 [ 	]+[0-9a-f]+:[ 	]+14302573[ 	]+csrr[ 	]+a0,stval
diff --git a/gas/testsuite/gas/riscv/csr-version-1p10.l b/gas/testsuite/gas/riscv/csr-version-1p10.l
index e67ec153578..264bda20b2a 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p10.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p10.l
@@ -469,6 +469,127 @@ 
 .*Warning: invalid CSR `hstateen3h' for the privileged spec `1.10'
 .*Warning: invalid CSR `hstateen3h' for the current ISA
 .*Warning: invalid CSR `hstateen3h' for the privileged spec `1.10'
+.*Warning: invalid CSR `scountovf' for the current ISA
+.*Warning: invalid CSR `scountovf' for the privileged spec `1.10'
+.*Warning: invalid CSR `scountovf' for the current ISA
+.*Warning: invalid CSR `scountovf' for the privileged spec `1.10'
+.*Warning: read-only CSR is written `csrw scountovf,a1'
+.*Warning: invalid CSR `mhpmevent3h' for the current ISA
+.*Warning: invalid CSR `mhpmevent3h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent3h' for the current ISA
+.*Warning: invalid CSR `mhpmevent3h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent4h' for the current ISA
+.*Warning: invalid CSR `mhpmevent4h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent4h' for the current ISA
+.*Warning: invalid CSR `mhpmevent4h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent5h' for the current ISA
+.*Warning: invalid CSR `mhpmevent5h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent5h' for the current ISA
+.*Warning: invalid CSR `mhpmevent5h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent6h' for the current ISA
+.*Warning: invalid CSR `mhpmevent6h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent6h' for the current ISA
+.*Warning: invalid CSR `mhpmevent6h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent7h' for the current ISA
+.*Warning: invalid CSR `mhpmevent7h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent7h' for the current ISA
+.*Warning: invalid CSR `mhpmevent7h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent8h' for the current ISA
+.*Warning: invalid CSR `mhpmevent8h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent8h' for the current ISA
+.*Warning: invalid CSR `mhpmevent8h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent9h' for the current ISA
+.*Warning: invalid CSR `mhpmevent9h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent9h' for the current ISA
+.*Warning: invalid CSR `mhpmevent9h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent10h' for the current ISA
+.*Warning: invalid CSR `mhpmevent10h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent10h' for the current ISA
+.*Warning: invalid CSR `mhpmevent10h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent11h' for the current ISA
+.*Warning: invalid CSR `mhpmevent11h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent11h' for the current ISA
+.*Warning: invalid CSR `mhpmevent11h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent12h' for the current ISA
+.*Warning: invalid CSR `mhpmevent12h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent12h' for the current ISA
+.*Warning: invalid CSR `mhpmevent12h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent13h' for the current ISA
+.*Warning: invalid CSR `mhpmevent13h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent13h' for the current ISA
+.*Warning: invalid CSR `mhpmevent13h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent14h' for the current ISA
+.*Warning: invalid CSR `mhpmevent14h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent14h' for the current ISA
+.*Warning: invalid CSR `mhpmevent14h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent15h' for the current ISA
+.*Warning: invalid CSR `mhpmevent15h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent15h' for the current ISA
+.*Warning: invalid CSR `mhpmevent15h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent16h' for the current ISA
+.*Warning: invalid CSR `mhpmevent16h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent16h' for the current ISA
+.*Warning: invalid CSR `mhpmevent16h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent17h' for the current ISA
+.*Warning: invalid CSR `mhpmevent17h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent17h' for the current ISA
+.*Warning: invalid CSR `mhpmevent17h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent18h' for the current ISA
+.*Warning: invalid CSR `mhpmevent18h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent18h' for the current ISA
+.*Warning: invalid CSR `mhpmevent18h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent19h' for the current ISA
+.*Warning: invalid CSR `mhpmevent19h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent19h' for the current ISA
+.*Warning: invalid CSR `mhpmevent19h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent20h' for the current ISA
+.*Warning: invalid CSR `mhpmevent20h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent20h' for the current ISA
+.*Warning: invalid CSR `mhpmevent20h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent21h' for the current ISA
+.*Warning: invalid CSR `mhpmevent21h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent21h' for the current ISA
+.*Warning: invalid CSR `mhpmevent21h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent22h' for the current ISA
+.*Warning: invalid CSR `mhpmevent22h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent22h' for the current ISA
+.*Warning: invalid CSR `mhpmevent22h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent23h' for the current ISA
+.*Warning: invalid CSR `mhpmevent23h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent23h' for the current ISA
+.*Warning: invalid CSR `mhpmevent23h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent24h' for the current ISA
+.*Warning: invalid CSR `mhpmevent24h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent24h' for the current ISA
+.*Warning: invalid CSR `mhpmevent24h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent25h' for the current ISA
+.*Warning: invalid CSR `mhpmevent25h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent25h' for the current ISA
+.*Warning: invalid CSR `mhpmevent25h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent26h' for the current ISA
+.*Warning: invalid CSR `mhpmevent26h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent26h' for the current ISA
+.*Warning: invalid CSR `mhpmevent26h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent27h' for the current ISA
+.*Warning: invalid CSR `mhpmevent27h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent27h' for the current ISA
+.*Warning: invalid CSR `mhpmevent27h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent28h' for the current ISA
+.*Warning: invalid CSR `mhpmevent28h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent28h' for the current ISA
+.*Warning: invalid CSR `mhpmevent28h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent29h' for the current ISA
+.*Warning: invalid CSR `mhpmevent29h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent29h' for the current ISA
+.*Warning: invalid CSR `mhpmevent29h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent30h' for the current ISA
+.*Warning: invalid CSR `mhpmevent30h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent30h' for the current ISA
+.*Warning: invalid CSR `mhpmevent30h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent31h' for the current ISA
+.*Warning: invalid CSR `mhpmevent31h' for the privileged spec `1.10'
+.*Warning: invalid CSR `mhpmevent31h' for the current ISA
+.*Warning: invalid CSR `mhpmevent31h' for the privileged spec `1.10'
 .*Warning: invalid CSR `ubadaddr' for the privileged spec `1.10'
 .*Warning: invalid CSR `ubadaddr' for the privileged spec `1.10'
 .*Warning: invalid CSR `sbadaddr' for the privileged spec `1.10'
diff --git a/gas/testsuite/gas/riscv/csr-version-1p11.d b/gas/testsuite/gas/riscv/csr-version-1p11.d
index c48e7cba2e8..0a37e88654c 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p11.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p11.d
@@ -663,6 +663,66 @@  Disassembly of section .text:
 [ 	]+[0-9a-f]+:[ 	]+61e59073[ 	]+csrw[ 	]+0x61e,a1
 [ 	]+[0-9a-f]+:[ 	]+61f02573[ 	]+csrr[ 	]+a0,0x61f
 [ 	]+[0-9a-f]+:[ 	]+61f59073[ 	]+csrw[ 	]+0x61f,a1
+[ 	]+[0-9a-f]+:[ 	]+da002573[ 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a1
+[ 	]+[0-9a-f]+:[ 	]+72c02573[ 	]+csrr[ 	]+a0,mhpmevent12h
+[ 	]+[0-9a-f]+:[ 	]+72c59073[ 	]+csrw[ 	]+mhpmevent12h,a1
+[ 	]+[0-9a-f]+:[ 	]+72d02573[ 	]+csrr[ 	]+a0,mhpmevent13h
+[ 	]+[0-9a-f]+:[ 	]+72d59073[ 	]+csrw[ 	]+mhpmevent13h,a1
+[ 	]+[0-9a-f]+:[ 	]+72e02573[ 	]+csrr[ 	]+a0,mhpmevent14h
+[ 	]+[0-9a-f]+:[ 	]+72e59073[ 	]+csrw[ 	]+mhpmevent14h,a1
+[ 	]+[0-9a-f]+:[ 	]+72f02573[ 	]+csrr[ 	]+a0,mhpmevent15h
+[ 	]+[0-9a-f]+:[ 	]+72f59073[ 	]+csrw[ 	]+mhpmevent15h,a1
+[ 	]+[0-9a-f]+:[ 	]+73002573[ 	]+csrr[ 	]+a0,mhpmevent16h
+[ 	]+[0-9a-f]+:[ 	]+73059073[ 	]+csrw[ 	]+mhpmevent16h,a1
+[ 	]+[0-9a-f]+:[ 	]+73102573[ 	]+csrr[ 	]+a0,mhpmevent17h
+[ 	]+[0-9a-f]+:[ 	]+73159073[ 	]+csrw[ 	]+mhpmevent17h,a1
+[ 	]+[0-9a-f]+:[ 	]+73202573[ 	]+csrr[ 	]+a0,mhpmevent18h
+[ 	]+[0-9a-f]+:[ 	]+73259073[ 	]+csrw[ 	]+mhpmevent18h,a1
+[ 	]+[0-9a-f]+:[ 	]+73302573[ 	]+csrr[ 	]+a0,mhpmevent19h
+[ 	]+[0-9a-f]+:[ 	]+73359073[ 	]+csrw[ 	]+mhpmevent19h,a1
+[ 	]+[0-9a-f]+:[ 	]+73402573[ 	]+csrr[ 	]+a0,mhpmevent20h
+[ 	]+[0-9a-f]+:[ 	]+73459073[ 	]+csrw[ 	]+mhpmevent20h,a1
+[ 	]+[0-9a-f]+:[ 	]+73502573[ 	]+csrr[ 	]+a0,mhpmevent21h
+[ 	]+[0-9a-f]+:[ 	]+73559073[ 	]+csrw[ 	]+mhpmevent21h,a1
+[ 	]+[0-9a-f]+:[ 	]+73602573[ 	]+csrr[ 	]+a0,mhpmevent22h
+[ 	]+[0-9a-f]+:[ 	]+73659073[ 	]+csrw[ 	]+mhpmevent22h,a1
+[ 	]+[0-9a-f]+:[ 	]+73702573[ 	]+csrr[ 	]+a0,mhpmevent23h
+[ 	]+[0-9a-f]+:[ 	]+73759073[ 	]+csrw[ 	]+mhpmevent23h,a1
+[ 	]+[0-9a-f]+:[ 	]+73802573[ 	]+csrr[ 	]+a0,mhpmevent24h
+[ 	]+[0-9a-f]+:[ 	]+73859073[ 	]+csrw[ 	]+mhpmevent24h,a1
+[ 	]+[0-9a-f]+:[ 	]+73902573[ 	]+csrr[ 	]+a0,mhpmevent25h
+[ 	]+[0-9a-f]+:[ 	]+73959073[ 	]+csrw[ 	]+mhpmevent25h,a1
+[ 	]+[0-9a-f]+:[ 	]+73a02573[ 	]+csrr[ 	]+a0,mhpmevent26h
+[ 	]+[0-9a-f]+:[ 	]+73a59073[ 	]+csrw[ 	]+mhpmevent26h,a1
+[ 	]+[0-9a-f]+:[ 	]+73b02573[ 	]+csrr[ 	]+a0,mhpmevent27h
+[ 	]+[0-9a-f]+:[ 	]+73b59073[ 	]+csrw[ 	]+mhpmevent27h,a1
+[ 	]+[0-9a-f]+:[ 	]+73c02573[ 	]+csrr[ 	]+a0,mhpmevent28h
+[ 	]+[0-9a-f]+:[ 	]+73c59073[ 	]+csrw[ 	]+mhpmevent28h,a1
+[ 	]+[0-9a-f]+:[ 	]+73d02573[ 	]+csrr[ 	]+a0,mhpmevent29h
+[ 	]+[0-9a-f]+:[ 	]+73d59073[ 	]+csrw[ 	]+mhpmevent29h,a1
+[ 	]+[0-9a-f]+:[ 	]+73e02573[ 	]+csrr[ 	]+a0,mhpmevent30h
+[ 	]+[0-9a-f]+:[ 	]+73e59073[ 	]+csrw[ 	]+mhpmevent30h,a1
+[ 	]+[0-9a-f]+:[ 	]+73f02573[ 	]+csrr[ 	]+a0,mhpmevent31h
+[ 	]+[0-9a-f]+:[ 	]+73f59073[ 	]+csrw[ 	]+mhpmevent31h,a1
 [ 	]+[0-9a-f]+:[ 	]+04302573[ 	]+csrr[ 	]+a0,utval
 [ 	]+[0-9a-f]+:[ 	]+04359073[ 	]+csrw[ 	]+utval,a1
 [ 	]+[0-9a-f]+:[ 	]+14302573[ 	]+csrr[ 	]+a0,stval
diff --git a/gas/testsuite/gas/riscv/csr-version-1p11.l b/gas/testsuite/gas/riscv/csr-version-1p11.l
index 80abdfe575a..89e0894c21d 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p11.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p11.l
@@ -467,6 +467,67 @@ 
 .*Warning: invalid CSR `hstateen3h' for the privileged spec `1.11'
 .*Warning: invalid CSR `hstateen3h' for the current ISA
 .*Warning: invalid CSR `hstateen3h' for the privileged spec `1.11'
+.*Warning: invalid CSR `scountovf' for the current ISA
+.*Warning: invalid CSR `scountovf' for the current ISA
+.*Warning: read-only CSR is written `csrw scountovf,a1'
+.*Warning: invalid CSR `mhpmevent3h' for the current ISA
+.*Warning: invalid CSR `mhpmevent3h' for the current ISA
+.*Warning: invalid CSR `mhpmevent4h' for the current ISA
+.*Warning: invalid CSR `mhpmevent4h' for the current ISA
+.*Warning: invalid CSR `mhpmevent5h' for the current ISA
+.*Warning: invalid CSR `mhpmevent5h' for the current ISA
+.*Warning: invalid CSR `mhpmevent6h' for the current ISA
+.*Warning: invalid CSR `mhpmevent6h' for the current ISA
+.*Warning: invalid CSR `mhpmevent7h' for the current ISA
+.*Warning: invalid CSR `mhpmevent7h' for the current ISA
+.*Warning: invalid CSR `mhpmevent8h' for the current ISA
+.*Warning: invalid CSR `mhpmevent8h' for the current ISA
+.*Warning: invalid CSR `mhpmevent9h' for the current ISA
+.*Warning: invalid CSR `mhpmevent9h' for the current ISA
+.*Warning: invalid CSR `mhpmevent10h' for the current ISA
+.*Warning: invalid CSR `mhpmevent10h' for the current ISA
+.*Warning: invalid CSR `mhpmevent11h' for the current ISA
+.*Warning: invalid CSR `mhpmevent11h' for the current ISA
+.*Warning: invalid CSR `mhpmevent12h' for the current ISA
+.*Warning: invalid CSR `mhpmevent12h' for the current ISA
+.*Warning: invalid CSR `mhpmevent13h' for the current ISA
+.*Warning: invalid CSR `mhpmevent13h' for the current ISA
+.*Warning: invalid CSR `mhpmevent14h' for the current ISA
+.*Warning: invalid CSR `mhpmevent14h' for the current ISA
+.*Warning: invalid CSR `mhpmevent15h' for the current ISA
+.*Warning: invalid CSR `mhpmevent15h' for the current ISA
+.*Warning: invalid CSR `mhpmevent16h' for the current ISA
+.*Warning: invalid CSR `mhpmevent16h' for the current ISA
+.*Warning: invalid CSR `mhpmevent17h' for the current ISA
+.*Warning: invalid CSR `mhpmevent17h' for the current ISA
+.*Warning: invalid CSR `mhpmevent18h' for the current ISA
+.*Warning: invalid CSR `mhpmevent18h' for the current ISA
+.*Warning: invalid CSR `mhpmevent19h' for the current ISA
+.*Warning: invalid CSR `mhpmevent19h' for the current ISA
+.*Warning: invalid CSR `mhpmevent20h' for the current ISA
+.*Warning: invalid CSR `mhpmevent20h' for the current ISA
+.*Warning: invalid CSR `mhpmevent21h' for the current ISA
+.*Warning: invalid CSR `mhpmevent21h' for the current ISA
+.*Warning: invalid CSR `mhpmevent22h' for the current ISA
+.*Warning: invalid CSR `mhpmevent22h' for the current ISA
+.*Warning: invalid CSR `mhpmevent23h' for the current ISA
+.*Warning: invalid CSR `mhpmevent23h' for the current ISA
+.*Warning: invalid CSR `mhpmevent24h' for the current ISA
+.*Warning: invalid CSR `mhpmevent24h' for the current ISA
+.*Warning: invalid CSR `mhpmevent25h' for the current ISA
+.*Warning: invalid CSR `mhpmevent25h' for the current ISA
+.*Warning: invalid CSR `mhpmevent26h' for the current ISA
+.*Warning: invalid CSR `mhpmevent26h' for the current ISA
+.*Warning: invalid CSR `mhpmevent27h' for the current ISA
+.*Warning: invalid CSR `mhpmevent27h' for the current ISA
+.*Warning: invalid CSR `mhpmevent28h' for the current ISA
+.*Warning: invalid CSR `mhpmevent28h' for the current ISA
+.*Warning: invalid CSR `mhpmevent29h' for the current ISA
+.*Warning: invalid CSR `mhpmevent29h' for the current ISA
+.*Warning: invalid CSR `mhpmevent30h' for the current ISA
+.*Warning: invalid CSR `mhpmevent30h' for the current ISA
+.*Warning: invalid CSR `mhpmevent31h' for the current ISA
+.*Warning: invalid CSR `mhpmevent31h' for the current ISA
 .*Warning: invalid CSR `ubadaddr' for the privileged spec `1.11'
 .*Warning: invalid CSR `ubadaddr' for the privileged spec `1.11'
 .*Warning: invalid CSR `sbadaddr' for the privileged spec `1.11'
diff --git a/gas/testsuite/gas/riscv/csr-version-1p12.d b/gas/testsuite/gas/riscv/csr-version-1p12.d
index 08da50283fb..c30f413eccf 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p12.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p12.d
@@ -663,6 +663,66 @@  Disassembly of section .text:
 [ 	]+[0-9a-f]+:[ 	]+61e59073[ 	]+csrw[ 	]+hstateen2h,a1
 [ 	]+[0-9a-f]+:[ 	]+61f02573[ 	]+csrr[ 	]+a0,hstateen3h
 [ 	]+[0-9a-f]+:[ 	]+61f59073[ 	]+csrw[ 	]+hstateen3h,a1
+[ 	]+[0-9a-f]+:[ 	]+da002573[ 	]+csrr[ 	]+a0,scountovf
+[ 	]+[0-9a-f]+:[ 	]+da059073[ 	]+csrw[ 	]+scountovf,a1
+[ 	]+[0-9a-f]+:[ 	]+72302573[ 	]+csrr[ 	]+a0,mhpmevent3h
+[ 	]+[0-9a-f]+:[ 	]+72359073[ 	]+csrw[ 	]+mhpmevent3h,a1
+[ 	]+[0-9a-f]+:[ 	]+72402573[ 	]+csrr[ 	]+a0,mhpmevent4h
+[ 	]+[0-9a-f]+:[ 	]+72459073[ 	]+csrw[ 	]+mhpmevent4h,a1
+[ 	]+[0-9a-f]+:[ 	]+72502573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rw[ 	]+mhpmevent14h,a1
+[ 	]+[0-9a-f]+:[ 	]+72f02573[ 	]+csrr[ 	]+a0,mhpmevent15h
+[ 	]+[0-9a-f]+:[ 	]+72f59073[ 	]+csrw[ 	]+mhpmevent15h,a1
+[ 	]+[0-9a-f]+:[ 	]+73002573[ 	]+csrr[ 	]+a0,mhpmevent16h
+[ 	]+[0-9a-f]+:[ 	]+73059073[ 	]+csrw[ 	]+mhpmevent16h,a1
+[ 	]+[0-9a-f]+:[ 	]+73102573[ 	]+csrr[ 	]+a0,mhpmevent17h
+[ 	]+[0-9a-f]+:[ 	]+73159073[ 	]+csrw[ 	]+mhpmevent17h,a1
+[ 	]+[0-9a-f]+:[ 	]+73202573[ 	]+csrr[ 	]+a0,mhpmevent18h
+[ 	]+[0-9a-f]+:[ 	]+73259073[ 	]+csrw[ 	]+mhpmevent18h,a1
+[ 	]+[0-9a-f]+:[ 	]+73302573[ 	]+csrr[ 	]+a0,mhpmevent19h
+[ 	]+[0-9a-f]+:[ 	]+73359073[ 	]+csrw[ 	]+mhpmevent19h,a1
+[ 	]+[0-9a-f]+:[ 	]+73402573[ 	]+csrr[ 	]+a0,mhpmevent20h
+[ 	]+[0-9a-f]+:[ 	]+73459073[ 	]+csrw[ 	]+mhpmevent20h,a1
+[ 	]+[0-9a-f]+:[ 	]+73502573[ 	]+csrr[ 	]+a0,mhpmevent21h
+[ 	]+[0-9a-f]+:[ 	]+73559073[ 	]+csrw[ 	]+mhpmevent21h,a1
+[ 	]+[0-9a-f]+:[ 	]+73602573[ 	]+csrr[ 	]+a0,mhpmevent22h
+[ 	]+[0-9a-f]+:[ 	]+73659073[ 	]+csrw[ 	]+mhpmevent22h,a1
+[ 	]+[0-9a-f]+:[ 	]+73702573[ 	]+csrr[ 	]+a0,mhpmevent23h
+[ 	]+[0-9a-f]+:[ 	]+73759073[ 	]+csrw[ 	]+mhpmevent23h,a1
+[ 	]+[0-9a-f]+:[ 	]+73802573[ 	]+csrr[ 	]+a0,mhpmevent24h
+[ 	]+[0-9a-f]+:[ 	]+73859073[ 	]+csrw[ 	]+mhpmevent24h,a1
+[ 	]+[0-9a-f]+:[ 	]+73902573[ 	]+csrr[ 	]+a0,mhpmevent25h
+[ 	]+[0-9a-f]+:[ 	]+73959073[ 	]+csrw[ 	]+mhpmevent25h,a1
+[ 	]+[0-9a-f]+:[ 	]+73a02573[ 	]+csrr[ 	]+a0,mhpmevent26h
+[ 	]+[0-9a-f]+:[ 	]+73a59073[ 	]+csrw[ 	]+mhpmevent26h,a1
+[ 	]+[0-9a-f]+:[ 	]+73b02573[ 	]+csrr[ 	]+a0,mhpmevent27h
+[ 	]+[0-9a-f]+:[ 	]+73b59073[ 	]+csrw[ 	]+mhpmevent27h,a1
+[ 	]+[0-9a-f]+:[ 	]+73c02573[ 	]+csrr[ 	]+a0,mhpmevent28h
+[ 	]+[0-9a-f]+:[ 	]+73c59073[ 	]+csrw[ 	]+mhpmevent28h,a1
+[ 	]+[0-9a-f]+:[ 	]+73d02573[ 	]+csrr[ 	]+a0,mhpmevent29h
+[ 	]+[0-9a-f]+:[ 	]+73d59073[ 	]+csrw[ 	]+mhpmevent29h,a1
+[ 	]+[0-9a-f]+:[ 	]+73e02573[ 	]+csrr[ 	]+a0,mhpmevent30h
+[ 	]+[0-9a-f]+:[ 	]+73e59073[ 	]+csrw[ 	]+mhpmevent30h,a1
+[ 	]+[0-9a-f]+:[ 	]+73f02573[ 	]+csrr[ 	]+a0,mhpmevent31h
+[ 	]+[0-9a-f]+:[ 	]+73f59073[ 	]+csrw[ 	]+mhpmevent31h,a1
 [ 	]+[0-9a-f]+:[ 	]+04302573[ 	]+csrr[ 	]+a0,utval
 [ 	]+[0-9a-f]+:[ 	]+04359073[ 	]+csrw[ 	]+utval,a1
 [ 	]+[0-9a-f]+:[ 	]+14302573[ 	]+csrr[ 	]+a0,stval
diff --git a/gas/testsuite/gas/riscv/csr-version-1p12.l b/gas/testsuite/gas/riscv/csr-version-1p12.l
index 6f45008b62f..ce1d689e104 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p12.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p12.l
@@ -261,6 +261,67 @@ 
 .*Warning: invalid CSR `hstateen2h' for the current ISA
 .*Warning: invalid CSR `hstateen3h' for the current ISA
 .*Warning: invalid CSR `hstateen3h' for the current ISA
+.*Warning: invalid CSR `scountovf' for the current ISA
+.*Warning: invalid CSR `scountovf' for the current ISA
+.*Warning: read-only CSR is written `csrw scountovf,a1'
+.*Warning: invalid CSR `mhpmevent3h' for the current ISA
+.*Warning: invalid CSR `mhpmevent3h' for the current ISA
+.*Warning: invalid CSR `mhpmevent4h' for the current ISA
+.*Warning: invalid CSR `mhpmevent4h' for the current ISA
+.*Warning: invalid CSR `mhpmevent5h' for the current ISA
+.*Warning: invalid CSR `mhpmevent5h' for the current ISA
+.*Warning: invalid CSR `mhpmevent6h' for the current ISA
+.*Warning: invalid CSR `mhpmevent6h' for the current ISA
+.*Warning: invalid CSR `mhpmevent7h' for the current ISA
+.*Warning: invalid CSR `mhpmevent7h' for the current ISA
+.*Warning: invalid CSR `mhpmevent8h' for the current ISA
+.*Warning: invalid CSR `mhpmevent8h' for the current ISA
+.*Warning: invalid CSR `mhpmevent9h' for the current ISA
+.*Warning: invalid CSR `mhpmevent9h' for the current ISA
+.*Warning: invalid CSR `mhpmevent10h' for the current ISA
+.*Warning: invalid CSR `mhpmevent10h' for the current ISA
+.*Warning: invalid CSR `mhpmevent11h' for the current ISA
+.*Warning: invalid CSR `mhpmevent11h' for the current ISA
+.*Warning: invalid CSR `mhpmevent12h' for the current ISA
+.*Warning: invalid CSR `mhpmevent12h' for the current ISA
+.*Warning: invalid CSR `mhpmevent13h' for the current ISA
+.*Warning: invalid CSR `mhpmevent13h' for the current ISA
+.*Warning: invalid CSR `mhpmevent14h' for the current ISA
+.*Warning: invalid CSR `mhpmevent14h' for the current ISA
+.*Warning: invalid CSR `mhpmevent15h' for the current ISA
+.*Warning: invalid CSR `mhpmevent15h' for the current ISA
+.*Warning: invalid CSR `mhpmevent16h' for the current ISA
+.*Warning: invalid CSR `mhpmevent16h' for the current ISA
+.*Warning: invalid CSR `mhpmevent17h' for the current ISA
+.*Warning: invalid CSR `mhpmevent17h' for the current ISA
+.*Warning: invalid CSR `mhpmevent18h' for the current ISA
+.*Warning: invalid CSR `mhpmevent18h' for the current ISA
+.*Warning: invalid CSR `mhpmevent19h' for the current ISA
+.*Warning: invalid CSR `mhpmevent19h' for the current ISA
+.*Warning: invalid CSR `mhpmevent20h' for the current ISA
+.*Warning: invalid CSR `mhpmevent20h' for the current ISA
+.*Warning: invalid CSR `mhpmevent21h' for the current ISA
+.*Warning: invalid CSR `mhpmevent21h' for the current ISA
+.*Warning: invalid CSR `mhpmevent22h' for the current ISA
+.*Warning: invalid CSR `mhpmevent22h' for the current ISA
+.*Warning: invalid CSR `mhpmevent23h' for the current ISA
+.*Warning: invalid CSR `mhpmevent23h' for the current ISA
+.*Warning: invalid CSR `mhpmevent24h' for the current ISA
+.*Warning: invalid CSR `mhpmevent24h' for the current ISA
+.*Warning: invalid CSR `mhpmevent25h' for the current ISA
+.*Warning: invalid CSR `mhpmevent25h' for the current ISA
+.*Warning: invalid CSR `mhpmevent26h' for the current ISA
+.*Warning: invalid CSR `mhpmevent26h' for the current ISA
+.*Warning: invalid CSR `mhpmevent27h' for the current ISA
+.*Warning: invalid CSR `mhpmevent27h' for the current ISA
+.*Warning: invalid CSR `mhpmevent28h' for the current ISA
+.*Warning: invalid CSR `mhpmevent28h' for the current ISA
+.*Warning: invalid CSR `mhpmevent29h' for the current ISA
+.*Warning: invalid CSR `mhpmevent29h' for the current ISA
+.*Warning: invalid CSR `mhpmevent30h' for the current ISA
+.*Warning: invalid CSR `mhpmevent30h' for the current ISA
+.*Warning: invalid CSR `mhpmevent31h' for the current ISA
+.*Warning: invalid CSR `mhpmevent31h' for the current ISA
 .*Warning: invalid CSR `ubadaddr' for the privileged spec `1.12'
 .*Warning: invalid CSR `ubadaddr' for the privileged spec `1.12'
 .*Warning: invalid CSR `sbadaddr' 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 d41bc634284..294742fefb3 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p9p1.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p9p1.d
@@ -663,6 +663,66 @@  Disassembly of section .text:
 [ 	]+[0-9a-f]+:[ 	]+61e59073[ 	]+csrw[ 	]+0x61e,a1
 [ 	]+[0-9a-f]+:[ 	]+61f02573[ 	]+csrr[ 	]+a0,0x61f
 [ 	]+[0-9a-f]+:[ 	]+61f59073[ 	]+csrw[ 	]+0x61f,a1
+[ 	]+[0-9a-f]+:[ 	]+da002573[ 	]+csrr[ 	]+a0,0xda0
+[ 	]+[0-9a-f]+:[ 	]+da059073[ 	]+csrw[ 	]+0xda0,a1
+[ 	]+[0-9a-f]+:[ 	]+72302573[ 	]+csrr[ 	]+a0,0x723
+[ 	]+[0-9a-f]+:[ 	]+72359073[ 	]+csrw[ 	]+0x723,a1
+[ 	]+[0-9a-f]+:[ 	]+72402573[ 	]+csrr[ 	]+a0,0x724
+[ 	]+[0-9a-f]+:[ 	]+72459073[ 	]+csrw[ 	]+0x724,a1
+[ 	]+[0-9a-f]+:[ 	]+72502573[ 	]+csrr[ 	]+a0,0x725
+[ 	]+[0-9a-f]+:[ 	]+72559073[ 	]+csrw[ 	]+0x725,a1
+[ 	]+[0-9a-f]+:[ 	]+72602573[ 	]+csrr[ 	]+a0,0x726
+[ 	]+[0-9a-f]+:[ 	]+72659073[ 	]+csrw[ 	]+0x726,a1
+[ 	]+[0-9a-f]+:[ 	]+72702573[ 	]+csrr[ 	]+a0,0x727
+[ 	]+[0-9a-f]+:[ 	]+72759073[ 	]+csrw[ 	]+0x727,a1
+[ 	]+[0-9a-f]+:[ 	]+72802573[ 	]+csrr[ 	]+a0,0x728
+[ 	]+[0-9a-f]+:[ 	]+72859073[ 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73d59073[ 	]+csrw[ 	]+0x73d,a1
+[ 	]+[0-9a-f]+:[ 	]+73e02573[ 	]+csrr[ 	]+a0,0x73e
+[ 	]+[0-9a-f]+:[ 	]+73e59073[ 	]+csrw[ 	]+0x73e,a1
+[ 	]+[0-9a-f]+:[ 	]+73f02573[ 	]+csrr[ 	]+a0,0x73f
+[ 	]+[0-9a-f]+:[ 	]+73f59073[ 	]+csrw[ 	]+0x73f,a1
 [ 	]+[0-9a-f]+:[ 	]+04302573[ 	]+csrr[ 	]+a0,ubadaddr
 [ 	]+[0-9a-f]+:[ 	]+04359073[ 	]+csrw[ 	]+ubadaddr,a1
 [ 	]+[0-9a-f]+:[ 	]+14302573[ 	]+csrr[ 	]+a0,sbadaddr
diff --git a/gas/testsuite/gas/riscv/csr-version-1p9p1.l b/gas/testsuite/gas/riscv/csr-version-1p9p1.l
index 6e9c35495eb..9ff40ef8249 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p9p1.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p9p1.l
@@ -521,6 +521,127 @@ 
 .*Warning: invalid CSR `hstateen3h' for the privileged spec `1.9.1'
 .*Warning: invalid CSR `hstateen3h' for the current ISA
 .*Warning: invalid CSR `hstateen3h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `scountovf' for the current ISA
+.*Warning: invalid CSR `scountovf' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `scountovf' for the current ISA
+.*Warning: invalid CSR `scountovf' for the privileged spec `1.9.1'
+.*Warning: read-only CSR is written `csrw scountovf,a1'
+.*Warning: invalid CSR `mhpmevent3h' for the current ISA
+.*Warning: invalid CSR `mhpmevent3h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent3h' for the current ISA
+.*Warning: invalid CSR `mhpmevent3h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent4h' for the current ISA
+.*Warning: invalid CSR `mhpmevent4h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent4h' for the current ISA
+.*Warning: invalid CSR `mhpmevent4h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent5h' for the current ISA
+.*Warning: invalid CSR `mhpmevent5h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent5h' for the current ISA
+.*Warning: invalid CSR `mhpmevent5h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent6h' for the current ISA
+.*Warning: invalid CSR `mhpmevent6h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent6h' for the current ISA
+.*Warning: invalid CSR `mhpmevent6h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent7h' for the current ISA
+.*Warning: invalid CSR `mhpmevent7h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent7h' for the current ISA
+.*Warning: invalid CSR `mhpmevent7h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent8h' for the current ISA
+.*Warning: invalid CSR `mhpmevent8h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent8h' for the current ISA
+.*Warning: invalid CSR `mhpmevent8h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent9h' for the current ISA
+.*Warning: invalid CSR `mhpmevent9h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent9h' for the current ISA
+.*Warning: invalid CSR `mhpmevent9h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent10h' for the current ISA
+.*Warning: invalid CSR `mhpmevent10h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent10h' for the current ISA
+.*Warning: invalid CSR `mhpmevent10h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent11h' for the current ISA
+.*Warning: invalid CSR `mhpmevent11h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent11h' for the current ISA
+.*Warning: invalid CSR `mhpmevent11h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent12h' for the current ISA
+.*Warning: invalid CSR `mhpmevent12h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent12h' for the current ISA
+.*Warning: invalid CSR `mhpmevent12h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent13h' for the current ISA
+.*Warning: invalid CSR `mhpmevent13h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent13h' for the current ISA
+.*Warning: invalid CSR `mhpmevent13h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent14h' for the current ISA
+.*Warning: invalid CSR `mhpmevent14h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent14h' for the current ISA
+.*Warning: invalid CSR `mhpmevent14h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent15h' for the current ISA
+.*Warning: invalid CSR `mhpmevent15h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent15h' for the current ISA
+.*Warning: invalid CSR `mhpmevent15h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent16h' for the current ISA
+.*Warning: invalid CSR `mhpmevent16h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent16h' for the current ISA
+.*Warning: invalid CSR `mhpmevent16h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent17h' for the current ISA
+.*Warning: invalid CSR `mhpmevent17h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent17h' for the current ISA
+.*Warning: invalid CSR `mhpmevent17h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent18h' for the current ISA
+.*Warning: invalid CSR `mhpmevent18h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent18h' for the current ISA
+.*Warning: invalid CSR `mhpmevent18h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent19h' for the current ISA
+.*Warning: invalid CSR `mhpmevent19h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent19h' for the current ISA
+.*Warning: invalid CSR `mhpmevent19h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent20h' for the current ISA
+.*Warning: invalid CSR `mhpmevent20h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent20h' for the current ISA
+.*Warning: invalid CSR `mhpmevent20h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent21h' for the current ISA
+.*Warning: invalid CSR `mhpmevent21h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent21h' for the current ISA
+.*Warning: invalid CSR `mhpmevent21h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent22h' for the current ISA
+.*Warning: invalid CSR `mhpmevent22h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent22h' for the current ISA
+.*Warning: invalid CSR `mhpmevent22h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent23h' for the current ISA
+.*Warning: invalid CSR `mhpmevent23h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent23h' for the current ISA
+.*Warning: invalid CSR `mhpmevent23h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent24h' for the current ISA
+.*Warning: invalid CSR `mhpmevent24h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent24h' for the current ISA
+.*Warning: invalid CSR `mhpmevent24h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent25h' for the current ISA
+.*Warning: invalid CSR `mhpmevent25h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent25h' for the current ISA
+.*Warning: invalid CSR `mhpmevent25h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent26h' for the current ISA
+.*Warning: invalid CSR `mhpmevent26h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent26h' for the current ISA
+.*Warning: invalid CSR `mhpmevent26h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent27h' for the current ISA
+.*Warning: invalid CSR `mhpmevent27h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent27h' for the current ISA
+.*Warning: invalid CSR `mhpmevent27h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent28h' for the current ISA
+.*Warning: invalid CSR `mhpmevent28h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent28h' for the current ISA
+.*Warning: invalid CSR `mhpmevent28h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent29h' for the current ISA
+.*Warning: invalid CSR `mhpmevent29h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent29h' for the current ISA
+.*Warning: invalid CSR `mhpmevent29h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent30h' for the current ISA
+.*Warning: invalid CSR `mhpmevent30h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent30h' for the current ISA
+.*Warning: invalid CSR `mhpmevent30h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent31h' for the current ISA
+.*Warning: invalid CSR `mhpmevent31h' for the privileged spec `1.9.1'
+.*Warning: invalid CSR `mhpmevent31h' for the current ISA
+.*Warning: invalid CSR `mhpmevent31h' for the privileged spec `1.9.1'
 .*Warning: invalid CSR `fflags' for the current ISA
 .*Warning: invalid CSR `fflags' for the current ISA
 .*Warning: invalid CSR `frm' for the current ISA
diff --git a/gas/testsuite/gas/riscv/csr.s b/gas/testsuite/gas/riscv/csr.s
index a65dbe534b2..38c5015fc94 100644
--- a/gas/testsuite/gas/riscv/csr.s
+++ b/gas/testsuite/gas/riscv/csr.s
@@ -372,6 +372,38 @@ 
 	csr hstateen2h
 	csr hstateen3h
 
+	# Sscofpmf extension
+	csr scountovf
+	csr mhpmevent3h
+	csr mhpmevent4h
+	csr mhpmevent5h
+	csr mhpmevent6h
+	csr mhpmevent7h
+	csr mhpmevent8h
+	csr mhpmevent9h
+	csr mhpmevent10h
+	csr mhpmevent11h
+	csr mhpmevent12h
+	csr mhpmevent13h
+	csr mhpmevent14h
+	csr mhpmevent15h
+	csr mhpmevent16h
+	csr mhpmevent17h
+	csr mhpmevent18h
+	csr mhpmevent19h
+	csr mhpmevent20h
+	csr mhpmevent21h
+	csr mhpmevent22h
+	csr mhpmevent23h
+	csr mhpmevent24h
+	csr mhpmevent25h
+	csr mhpmevent26h
+	csr mhpmevent27h
+	csr mhpmevent28h
+	csr mhpmevent29h
+	csr mhpmevent30h
+	csr mhpmevent31h
+
 	# Supported in previous priv spec, but dropped now
 
 	csr ubadaddr		# 0x043 in 1.9.1, but the value is utval since 1.10
diff --git a/include/opcode/riscv-opc.h b/include/opcode/riscv-opc.h
index e218f6641cc..d5802d9cc18 100644
--- a/include/opcode/riscv-opc.h
+++ b/include/opcode/riscv-opc.h
@@ -2367,6 +2367,37 @@ 
 #define CSR_HSTATEEN1H 0x61d
 #define CSR_HSTATEEN2H 0x61e
 #define CSR_HSTATEEN3H 0x61f
+/* Sscofpmf extension */
+#define CSR_SCOUNTOVF 0xda0
+#define CSR_MHPMEVENT3H 0x723
+#define CSR_MHPMEVENT4H 0x724
+#define CSR_MHPMEVENT5H 0x725
+#define CSR_MHPMEVENT6H 0x726
+#define CSR_MHPMEVENT7H 0x727
+#define CSR_MHPMEVENT8H 0x728
+#define CSR_MHPMEVENT9H 0x729
+#define CSR_MHPMEVENT10H 0x72a
+#define CSR_MHPMEVENT11H 0x72b
+#define CSR_MHPMEVENT12H 0x72c
+#define CSR_MHPMEVENT13H 0x72d
+#define CSR_MHPMEVENT14H 0x72e
+#define CSR_MHPMEVENT15H 0x72f
+#define CSR_MHPMEVENT16H 0x730
+#define CSR_MHPMEVENT17H 0x731
+#define CSR_MHPMEVENT18H 0x732
+#define CSR_MHPMEVENT19H 0x733
+#define CSR_MHPMEVENT20H 0x734
+#define CSR_MHPMEVENT21H 0x735
+#define CSR_MHPMEVENT22H 0x736
+#define CSR_MHPMEVENT23H 0x737
+#define CSR_MHPMEVENT24H 0x738
+#define CSR_MHPMEVENT25H 0x739
+#define CSR_MHPMEVENT26H 0x73a
+#define CSR_MHPMEVENT27H 0x73b
+#define CSR_MHPMEVENT28H 0x73c
+#define CSR_MHPMEVENT29H 0x73d
+#define CSR_MHPMEVENT30H 0x73e
+#define CSR_MHPMEVENT31H 0x73f
 /* Unprivileged CSR addresses.  */
 #define CSR_FFLAGS 0x1
 #define CSR_FRM 0x2
@@ -3050,6 +3081,37 @@  DECLARE_CSR(hstateen0h, CSR_HSTATEEN0H, CSR_CLASS_SMSTATEEN_32, PRIV_SPEC_CLASS_
 DECLARE_CSR(hstateen1h, CSR_HSTATEEN1H, CSR_CLASS_SMSTATEEN_32, PRIV_SPEC_CLASS_1P12, PRIV_SPEC_CLASS_DRAFT)
 DECLARE_CSR(hstateen2h, CSR_HSTATEEN2H, CSR_CLASS_SMSTATEEN_32, PRIV_SPEC_CLASS_1P12, PRIV_SPEC_CLASS_DRAFT)
 DECLARE_CSR(hstateen3h, CSR_HSTATEEN3H, CSR_CLASS_SMSTATEEN_32, PRIV_SPEC_CLASS_1P12, PRIV_SPEC_CLASS_DRAFT)
+/* Sscofpmf extension */
+DECLARE_CSR(scountovf, CSR_SCOUNTOVF, CSR_CLASS_SSCOFPMF, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent3h, CSR_MHPMEVENT3H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent4h, CSR_MHPMEVENT4H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent5h, CSR_MHPMEVENT5H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent6h, CSR_MHPMEVENT6H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent7h, CSR_MHPMEVENT7H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent8h, CSR_MHPMEVENT8H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent9h, CSR_MHPMEVENT9H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent10h, CSR_MHPMEVENT10H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent11h, CSR_MHPMEVENT11H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent12h, CSR_MHPMEVENT12H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent13h, CSR_MHPMEVENT13H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent14h, CSR_MHPMEVENT14H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent15h, CSR_MHPMEVENT15H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent16h, CSR_MHPMEVENT16H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent17h, CSR_MHPMEVENT17H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent18h, CSR_MHPMEVENT18H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent19h, CSR_MHPMEVENT19H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent20h, CSR_MHPMEVENT20H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent21h, CSR_MHPMEVENT21H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent22h, CSR_MHPMEVENT22H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent23h, CSR_MHPMEVENT23H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent24h, CSR_MHPMEVENT24H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent25h, CSR_MHPMEVENT25H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent26h, CSR_MHPMEVENT26H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent27h, CSR_MHPMEVENT27H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent28h, CSR_MHPMEVENT28H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent29h, CSR_MHPMEVENT29H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent30h, CSR_MHPMEVENT30H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mhpmevent31h, CSR_MHPMEVENT31H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_1P11, PRIV_SPEC_CLASS_DRAFT)
 /* Dropped CSRs.  */
 DECLARE_CSR(mbase, CSR_MBASE, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P10)
 DECLARE_CSR(mbound, CSR_MBOUND, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P10)