public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [REVIEW ONLY 0/1] UNRATIFIED RISC-V: Add 'Smclic' extension and its CSRs
@ 2022-11-29  1:19 Tsukasa OI
  2022-11-29  1:19 ` [REVIEW ONLY 1/1] " Tsukasa OI
  2023-09-12  1:39 ` [REVIEW ONLY v2 0/1] UNRATIFIED RISC-V: Add support for Core-Local Interrupt Controller (CLIC) extensions and their CSRs Tsukasa OI
  0 siblings, 2 replies; 7+ messages in thread
From: Tsukasa OI @ 2022-11-29  1:19 UTC (permalink / raw)
  To: Tsukasa OI; +Cc: binutils

*** WAIT FOR SPECIFICATION FREEZE ***
This is an implementation for unratified and not frozen RISC-V extension
and not intended to be merged for now.
The only intent to submit this patchset is to test new instructions for
your (possibly virtual) environment and early review for fast adoption
after ratification.


This patchset adds following unratified extension to GNU Binutils:

-   'Smclic' (RISC-V Core-Local Interrupt Controller; CLIC)
    version 0.9 (may change on ratification)

which adds 18 CSRs.

This extension is a software side of Core-Local Interrupt Controller (CLIC)
which provides lower latency local interrupts.


This is based on the specification document, version 0.9-draft:
<https://github.com/riscv/riscv-fast-interrupt/blob/e601b94bf43af0e9842b20134814404e488511e3/clic.pdf>


Although that 18 CSRs are assigned with actual numbers (this is why I'm not
attaching "CSR instantiation" script in this patchset), it may be changed
before ratification.  Be careful.




Tsukasa OI (1):
  UNRATIFIED RISC-V: Add 'Smclic' extension and its CSRs

 bfd/elfxx-riscv.c                           |  2 ++
 gas/config/tc-riscv.c                       |  4 +++
 gas/testsuite/gas/riscv/csr-dw-regnums.d    | 18 ++++++++++
 gas/testsuite/gas/riscv/csr-dw-regnums.s    | 19 ++++++++++
 gas/testsuite/gas/riscv/csr-version-1p10.d  | 36 +++++++++++++++++++
 gas/testsuite/gas/riscv/csr-version-1p10.l  | 39 +++++++++++++++++++++
 gas/testsuite/gas/riscv/csr-version-1p11.d  | 36 +++++++++++++++++++
 gas/testsuite/gas/riscv/csr-version-1p11.l  | 39 +++++++++++++++++++++
 gas/testsuite/gas/riscv/csr-version-1p12.d  | 36 +++++++++++++++++++
 gas/testsuite/gas/riscv/csr-version-1p12.l  | 39 +++++++++++++++++++++
 gas/testsuite/gas/riscv/csr-version-1p9p1.d | 36 +++++++++++++++++++
 gas/testsuite/gas/riscv/csr-version-1p9p1.l | 39 +++++++++++++++++++++
 gas/testsuite/gas/riscv/csr.s               | 20 +++++++++++
 include/opcode/riscv-opc.h                  | 38 ++++++++++++++++++++
 14 files changed, 401 insertions(+)


base-commit: cb44f89ce977b1ab2d4063f2487950bddfb75bc7
-- 
2.38.1


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

* [REVIEW ONLY 1/1] UNRATIFIED RISC-V: Add 'Smclic' extension and its CSRs
  2022-11-29  1:19 [REVIEW ONLY 0/1] UNRATIFIED RISC-V: Add 'Smclic' extension and its CSRs Tsukasa OI
@ 2022-11-29  1:19 ` Tsukasa OI
  2022-11-29  2:03   ` Palmer Dabbelt
  2023-09-12  1:39 ` [REVIEW ONLY v2 0/1] UNRATIFIED RISC-V: Add support for Core-Local Interrupt Controller (CLIC) extensions and their CSRs Tsukasa OI
  1 sibling, 1 reply; 7+ messages in thread
From: Tsukasa OI @ 2022-11-29  1:19 UTC (permalink / raw)
  To: Tsukasa OI; +Cc: binutils

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

[DO NOT MERGE]
Until 'Smclic' extension is frozen/ratified and final version number is
determined, this patch should not be merged upstream.  This commit uses
unratified version 0.9 as in the documentation (instead of possible 1.0
after ratification).

[RFC]
It implements u* CSRs as supported in all privileged architectures.
Since user-mode interrupt is dropped, we might need to mask or remove them.

This commit adds CSR support for the 'Smclic' extension, a part of Core-
Local Interrupt Controller (CLIC) extension.

This is based on the latest Core-Local Interrupt Controller (CLIC)
extension draft (version 0.9-draft):
<https://github.com/riscv/riscv-fast-interrupt/blob/e601b94bf43af0e9842b20134814404e488511e3/clic.pdf>

bfd/ChangeLog:

	* elfxx-riscv.c (riscv_implicit_subsets): Add implication from
	'Smclic' to 'Zicsr'.  (riscv_supported_std_s_ext) Add 'Smclic'.

gas/ChangeLog:

	* config/tc-riscv.c (enum riscv_csr_class): Add new CSR class.
	(riscv_csr_address): Add new CSR class handling.
	* testsuite/gas/riscv/csr.s: Add new CSR test.
	* testsuite/gas/riscv/csr-dw-regnums.s: Likewise.
	* testsuite/gas/riscv/csr-dw-regnums.d: Likewise.
	* 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_MTVT, CSR_MNXTI, CSR_MINTSTATUS,
	CSR_MINTTHRESH, CSR_MSCRATCHCSW, CSR_MSCRATCHCSWL, CSR_STVT,
	CSR_SNXTI, CSR_SINTSTATUS, CSR_SINTTHRESH, CSR_SSCRATCHCSW,
	CSR_SSCRATCHCSWL, CSR_UTVT, CSR_UNXTI, CSR_UINTSTATUS,
	CSR_UINTTHRESH, CSR_USCRATCHCSW, CSR_USCRATCHCSWL): New.
---
 bfd/elfxx-riscv.c                           |  2 ++
 gas/config/tc-riscv.c                       |  4 +++
 gas/testsuite/gas/riscv/csr-dw-regnums.d    | 18 ++++++++++
 gas/testsuite/gas/riscv/csr-dw-regnums.s    | 19 ++++++++++
 gas/testsuite/gas/riscv/csr-version-1p10.d  | 36 +++++++++++++++++++
 gas/testsuite/gas/riscv/csr-version-1p10.l  | 39 +++++++++++++++++++++
 gas/testsuite/gas/riscv/csr-version-1p11.d  | 36 +++++++++++++++++++
 gas/testsuite/gas/riscv/csr-version-1p11.l  | 39 +++++++++++++++++++++
 gas/testsuite/gas/riscv/csr-version-1p12.d  | 36 +++++++++++++++++++
 gas/testsuite/gas/riscv/csr-version-1p12.l  | 39 +++++++++++++++++++++
 gas/testsuite/gas/riscv/csr-version-1p9p1.d | 36 +++++++++++++++++++
 gas/testsuite/gas/riscv/csr-version-1p9p1.l | 39 +++++++++++++++++++++
 gas/testsuite/gas/riscv/csr.s               | 20 +++++++++++
 include/opcode/riscv-opc.h                  | 38 ++++++++++++++++++++
 14 files changed, 401 insertions(+)

diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
index 0bcf2fdcfa34..6c60cf7c888e 100644
--- a/bfd/elfxx-riscv.c
+++ b/bfd/elfxx-riscv.c
@@ -1103,6 +1103,7 @@ static struct riscv_implicit_subset riscv_implicit_subsets[] =
   {"zks", "zksh",	check_implicit_always},
   {"smaia", "ssaia",		check_implicit_always},
   {"smstateen", "ssstateen",	check_implicit_always},
+  {"smclic", "zicsr",		check_implicit_always},
   {"smepmp", "zicsr",		check_implicit_always},
   {"ssaia", "zicsr",		check_implicit_always},
   {"sscofpmf", "zicsr",		check_implicit_always},
@@ -1224,6 +1225,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 },
+  {"smclic",		ISA_SPEC_CLASS_DRAFT,		0, 9, 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 0682eb355241..e90e0ba53987 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -74,6 +74,7 @@ enum riscv_csr_class
   CSR_CLASS_H_32,	/* hypervisor, rv32 only */
   CSR_CLASS_SMAIA,		/* Smaia */
   CSR_CLASS_SMAIA_32,		/* Smaia, rv32 only */
+  CSR_CLASS_SMCLIC,		/* Smclic only */
   CSR_CLASS_SMSTATEEN,		/* Smstateen only */
   CSR_CLASS_SMSTATEEN_32,	/* Smstateen RV32 only */
   CSR_CLASS_SSAIA,		/* Ssaia */
@@ -1049,6 +1050,9 @@ riscv_csr_address (const char *csr_name,
     case CSR_CLASS_SMAIA:
       extension = "smaia";
       break;
+    case CSR_CLASS_SMCLIC:
+      extension = "smclic";
+      break;
     case CSR_CLASS_SMSTATEEN:
     case CSR_CLASS_SMSTATEEN_32:
       is_rv32_only = (csr_class == CSR_CLASS_SMSTATEEN_32);
diff --git a/gas/testsuite/gas/riscv/csr-dw-regnums.d b/gas/testsuite/gas/riscv/csr-dw-regnums.d
index fd830666ab89..2b58c6a955b1 100644
--- a/gas/testsuite/gas/riscv/csr-dw-regnums.d
+++ b/gas/testsuite/gas/riscv/csr-dw-regnums.d
@@ -324,6 +324,24 @@ 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: r4871 \(mtvt\) at cfa\+3100
+  DW_CFA_offset_extended_sf: r4933 \(mnxti\) at cfa\+3348
+  DW_CFA_offset_extended_sf: r8006 \(mintstatus\) at cfa\+15640
+  DW_CFA_offset_extended_sf: r4935 \(mintthresh\) at cfa\+3356
+  DW_CFA_offset_extended_sf: r4936 \(mscratchcsw\) at cfa\+3360
+  DW_CFA_offset_extended_sf: r4937 \(mscratchcswl\) at cfa\+3364
+  DW_CFA_offset_extended_sf: r4359 \(stvt\) at cfa\+1052
+  DW_CFA_offset_extended_sf: r4421 \(snxti\) at cfa\+1300
+  DW_CFA_offset_extended_sf: r7494 \(sintstatus\) at cfa\+13592
+  DW_CFA_offset_extended_sf: r4423 \(sintthresh\) at cfa\+1308
+  DW_CFA_offset_extended_sf: r4424 \(sscratchcsw\) at cfa\+1312
+  DW_CFA_offset_extended_sf: r4425 \(sscratchcswl\) at cfa\+1316
+  DW_CFA_offset_extended_sf: r4103 \(utvt\) at cfa\+28
+  DW_CFA_offset_extended_sf: r4165 \(unxti\) at cfa\+276
+  DW_CFA_offset_extended_sf: r7238 \(uintstatus\) at cfa\+12568
+  DW_CFA_offset_extended_sf: r4167 \(uintthresh\) at cfa\+284
+  DW_CFA_offset_extended_sf: r4168 \(uscratchcsw\) at cfa\+288
+  DW_CFA_offset_extended_sf: r4169 \(uscratchcswl\) at cfa\+292
   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
diff --git a/gas/testsuite/gas/riscv/csr-dw-regnums.s b/gas/testsuite/gas/riscv/csr-dw-regnums.s
index b8b0f7902297..af1158eb0089 100644
--- a/gas/testsuite/gas/riscv/csr-dw-regnums.s
+++ b/gas/testsuite/gas/riscv/csr-dw-regnums.s
@@ -321,6 +321,25 @@ _start:
 	.cfi_offset mvienh, 3168
 	.cfi_offset mviph, 3172
 	.cfi_offset miph, 3408
+	# Smclic extension
+	.cfi_offset mtvt, 3100
+	.cfi_offset mnxti, 3348
+	.cfi_offset mintstatus, 15640
+	.cfi_offset mintthresh, 3356
+	.cfi_offset mscratchcsw, 3360
+	.cfi_offset mscratchcswl, 3364
+	.cfi_offset stvt, 1052
+	.cfi_offset snxti, 1300
+	.cfi_offset sintstatus, 13592
+	.cfi_offset sintthresh, 1308
+	.cfi_offset sscratchcsw, 1312
+	.cfi_offset sscratchcswl, 1316
+	.cfi_offset utvt, 28
+	.cfi_offset unxti, 276
+	.cfi_offset uintstatus, 12568
+	.cfi_offset uintthresh, 284
+	.cfi_offset uscratchcsw, 288
+	.cfi_offset uscratchcswl, 292
 	# Smstateen extension
 	.cfi_offset mstateen0, 3120
 	.cfi_offset mstateen1, 3124
diff --git a/gas/testsuite/gas/riscv/csr-version-1p10.d b/gas/testsuite/gas/riscv/csr-version-1p10.d
index ee41e1025cce..aa116a75fadd 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p10.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p10.d
@@ -623,6 +623,42 @@ 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]+:[ 	]+30702573[ 	]+csrr[ 	]+a0,mtvt
+[ 	]+[0-9a-f]+:[ 	]+30759073[ 	]+csrw[ 	]+mtvt,a1
+[ 	]+[0-9a-f]+:[ 	]+34502573[ 	]+csrr[ 	]+a0,mnxti
+[ 	]+[0-9a-f]+:[ 	]+34559073[ 	]+csrw[ 	]+mnxti,a1
+[ 	]+[0-9a-f]+:[ 	]+f4602573[ 	]+csrr[ 	]+a0,mintstatus
+[ 	]+[0-9a-f]+:[ 	]+f4659073[ 	]+csrw[ 	]+mintstatus,a1
+[ 	]+[0-9a-f]+:[ 	]+34702573[ 	]+csrr[ 	]+a0,mintthresh
+[ 	]+[0-9a-f]+:[ 	]+34759073[ 	]+csrw[ 	]+mintthresh,a1
+[ 	]+[0-9a-f]+:[ 	]+34802573[ 	]+csrr[ 	]+a0,mscratchcsw
+[ 	]+[0-9a-f]+:[ 	]+34859073[ 	]+csrw[ 	]+mscratchcsw,a1
+[ 	]+[0-9a-f]+:[ 	]+34902573[ 	]+csrr[ 	]+a0,mscratchcswl
+[ 	]+[0-9a-f]+:[ 	]+34959073[ 	]+csrw[ 	]+mscratchcswl,a1
+[ 	]+[0-9a-f]+:[ 	]+10702573[ 	]+csrr[ 	]+a0,stvt
+[ 	]+[0-9a-f]+:[ 	]+10759073[ 	]+csrw[ 	]+stvt,a1
+[ 	]+[0-9a-f]+:[ 	]+14502573[ 	]+csrr[ 	]+a0,snxti
+[ 	]+[0-9a-f]+:[ 	]+14559073[ 	]+csrw[ 	]+snxti,a1
+[ 	]+[0-9a-f]+:[ 	]+d4602573[ 	]+csrr[ 	]+a0,sintstatus
+[ 	]+[0-9a-f]+:[ 	]+d4659073[ 	]+csrw[ 	]+sintstatus,a1
+[ 	]+[0-9a-f]+:[ 	]+14702573[ 	]+csrr[ 	]+a0,sintthresh
+[ 	]+[0-9a-f]+:[ 	]+14759073[ 	]+csrw[ 	]+sintthresh,a1
+[ 	]+[0-9a-f]+:[ 	]+14802573[ 	]+csrr[ 	]+a0,sscratchcsw
+[ 	]+[0-9a-f]+:[ 	]+14859073[ 	]+csrw[ 	]+sscratchcsw,a1
+[ 	]+[0-9a-f]+:[ 	]+14902573[ 	]+csrr[ 	]+a0,sscratchcswl
+[ 	]+[0-9a-f]+:[ 	]+14959073[ 	]+csrw[ 	]+sscratchcswl,a1
+[ 	]+[0-9a-f]+:[ 	]+00702573[ 	]+csrr[ 	]+a0,utvt
+[ 	]+[0-9a-f]+:[ 	]+00759073[ 	]+csrw[ 	]+utvt,a1
+[ 	]+[0-9a-f]+:[ 	]+04502573[ 	]+csrr[ 	]+a0,unxti
+[ 	]+[0-9a-f]+:[ 	]+04559073[ 	]+csrw[ 	]+unxti,a1
+[ 	]+[0-9a-f]+:[ 	]+c4602573[ 	]+csrr[ 	]+a0,uintstatus
+[ 	]+[0-9a-f]+:[ 	]+c4659073[ 	]+csrw[ 	]+uintstatus,a1
+[ 	]+[0-9a-f]+:[ 	]+04702573[ 	]+csrr[ 	]+a0,uintthresh
+[ 	]+[0-9a-f]+:[ 	]+04759073[ 	]+csrw[ 	]+uintthresh,a1
+[ 	]+[0-9a-f]+:[ 	]+04802573[ 	]+csrr[ 	]+a0,uscratchcsw
+[ 	]+[0-9a-f]+:[ 	]+04859073[ 	]+csrw[ 	]+uscratchcsw,a1
+[ 	]+[0-9a-f]+:[ 	]+04902573[ 	]+csrr[ 	]+a0,uscratchcswl
+[ 	]+[0-9a-f]+:[ 	]+04959073[ 	]+csrw[ 	]+uscratchcswl,a1
 [ 	]+[0-9a-f]+:[ 	]+30c02573[ 	]+csrr[ 	]+a0,mstateen0
 [ 	]+[0-9a-f]+:[ 	]+30c59073[ 	]+csrw[ 	]+mstateen0,a1
 [ 	]+[0-9a-f]+:[ 	]+30d02573[ 	]+csrr[ 	]+a0,mstateen1
diff --git a/gas/testsuite/gas/riscv/csr-version-1p10.l b/gas/testsuite/gas/riscv/csr-version-1p10.l
index e677b78b8bb8..15431cef4590 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p10.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p10.l
@@ -444,6 +444,45 @@
 .*Warning: invalid CSR `miph', needs `smaia' extension
 .*Warning: invalid CSR `miph', needs rv32i extension
 .*Warning: invalid CSR `miph', needs `smaia' extension
+.*Warning: invalid CSR `mtvt', needs `smclic' extension
+.*Warning: invalid CSR `mtvt', needs `smclic' extension
+.*Warning: invalid CSR `mnxti', needs `smclic' extension
+.*Warning: invalid CSR `mnxti', needs `smclic' extension
+.*Warning: invalid CSR `mintstatus', needs `smclic' extension
+.*Warning: invalid CSR `mintstatus', needs `smclic' extension
+.*Warning: read-only CSR is written `csrw mintstatus,a1'
+.*Warning: invalid CSR `mintthresh', needs `smclic' extension
+.*Warning: invalid CSR `mintthresh', needs `smclic' extension
+.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
+.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
+.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
+.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
+.*Warning: invalid CSR `stvt', needs `smclic' extension
+.*Warning: invalid CSR `stvt', needs `smclic' extension
+.*Warning: invalid CSR `snxti', needs `smclic' extension
+.*Warning: invalid CSR `snxti', needs `smclic' extension
+.*Warning: invalid CSR `sintstatus', needs `smclic' extension
+.*Warning: invalid CSR `sintstatus', needs `smclic' extension
+.*Warning: read-only CSR is written `csrw sintstatus,a1'
+.*Warning: invalid CSR `sintthresh', needs `smclic' extension
+.*Warning: invalid CSR `sintthresh', needs `smclic' extension
+.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
+.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
+.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
+.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
+.*Warning: invalid CSR `utvt', needs `smclic' extension
+.*Warning: invalid CSR `utvt', needs `smclic' extension
+.*Warning: invalid CSR `unxti', needs `smclic' extension
+.*Warning: invalid CSR `unxti', needs `smclic' extension
+.*Warning: invalid CSR `uintstatus', needs `smclic' extension
+.*Warning: invalid CSR `uintstatus', needs `smclic' extension
+.*Warning: read-only CSR is written `csrw uintstatus,a1'
+.*Warning: invalid CSR `uintthresh', needs `smclic' extension
+.*Warning: invalid CSR `uintthresh', needs `smclic' extension
+.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
+.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
+.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
+.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
 .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
 .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
 .*Warning: invalid CSR `mstateen1', needs `smstateen' extension
diff --git a/gas/testsuite/gas/riscv/csr-version-1p11.d b/gas/testsuite/gas/riscv/csr-version-1p11.d
index a83b1bf68f98..c7af6b7cafac 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p11.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p11.d
@@ -623,6 +623,42 @@ 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]+:[ 	]+30702573[ 	]+csrr[ 	]+a0,mtvt
+[ 	]+[0-9a-f]+:[ 	]+30759073[ 	]+csrw[ 	]+mtvt,a1
+[ 	]+[0-9a-f]+:[ 	]+34502573[ 	]+csrr[ 	]+a0,mnxti
+[ 	]+[0-9a-f]+:[ 	]+34559073[ 	]+csrw[ 	]+mnxti,a1
+[ 	]+[0-9a-f]+:[ 	]+f4602573[ 	]+csrr[ 	]+a0,mintstatus
+[ 	]+[0-9a-f]+:[ 	]+f4659073[ 	]+csrw[ 	]+mintstatus,a1
+[ 	]+[0-9a-f]+:[ 	]+34702573[ 	]+csrr[ 	]+a0,mintthresh
+[ 	]+[0-9a-f]+:[ 	]+34759073[ 	]+csrw[ 	]+mintthresh,a1
+[ 	]+[0-9a-f]+:[ 	]+34802573[ 	]+csrr[ 	]+a0,mscratchcsw
+[ 	]+[0-9a-f]+:[ 	]+34859073[ 	]+csrw[ 	]+mscratchcsw,a1
+[ 	]+[0-9a-f]+:[ 	]+34902573[ 	]+csrr[ 	]+a0,mscratchcswl
+[ 	]+[0-9a-f]+:[ 	]+34959073[ 	]+csrw[ 	]+mscratchcswl,a1
+[ 	]+[0-9a-f]+:[ 	]+10702573[ 	]+csrr[ 	]+a0,stvt
+[ 	]+[0-9a-f]+:[ 	]+10759073[ 	]+csrw[ 	]+stvt,a1
+[ 	]+[0-9a-f]+:[ 	]+14502573[ 	]+csrr[ 	]+a0,snxti
+[ 	]+[0-9a-f]+:[ 	]+14559073[ 	]+csrw[ 	]+snxti,a1
+[ 	]+[0-9a-f]+:[ 	]+d4602573[ 	]+csrr[ 	]+a0,sintstatus
+[ 	]+[0-9a-f]+:[ 	]+d4659073[ 	]+csrw[ 	]+sintstatus,a1
+[ 	]+[0-9a-f]+:[ 	]+14702573[ 	]+csrr[ 	]+a0,sintthresh
+[ 	]+[0-9a-f]+:[ 	]+14759073[ 	]+csrw[ 	]+sintthresh,a1
+[ 	]+[0-9a-f]+:[ 	]+14802573[ 	]+csrr[ 	]+a0,sscratchcsw
+[ 	]+[0-9a-f]+:[ 	]+14859073[ 	]+csrw[ 	]+sscratchcsw,a1
+[ 	]+[0-9a-f]+:[ 	]+14902573[ 	]+csrr[ 	]+a0,sscratchcswl
+[ 	]+[0-9a-f]+:[ 	]+14959073[ 	]+csrw[ 	]+sscratchcswl,a1
+[ 	]+[0-9a-f]+:[ 	]+00702573[ 	]+csrr[ 	]+a0,utvt
+[ 	]+[0-9a-f]+:[ 	]+00759073[ 	]+csrw[ 	]+utvt,a1
+[ 	]+[0-9a-f]+:[ 	]+04502573[ 	]+csrr[ 	]+a0,unxti
+[ 	]+[0-9a-f]+:[ 	]+04559073[ 	]+csrw[ 	]+unxti,a1
+[ 	]+[0-9a-f]+:[ 	]+c4602573[ 	]+csrr[ 	]+a0,uintstatus
+[ 	]+[0-9a-f]+:[ 	]+c4659073[ 	]+csrw[ 	]+uintstatus,a1
+[ 	]+[0-9a-f]+:[ 	]+04702573[ 	]+csrr[ 	]+a0,uintthresh
+[ 	]+[0-9a-f]+:[ 	]+04759073[ 	]+csrw[ 	]+uintthresh,a1
+[ 	]+[0-9a-f]+:[ 	]+04802573[ 	]+csrr[ 	]+a0,uscratchcsw
+[ 	]+[0-9a-f]+:[ 	]+04859073[ 	]+csrw[ 	]+uscratchcsw,a1
+[ 	]+[0-9a-f]+:[ 	]+04902573[ 	]+csrr[ 	]+a0,uscratchcswl
+[ 	]+[0-9a-f]+:[ 	]+04959073[ 	]+csrw[ 	]+uscratchcswl,a1
 [ 	]+[0-9a-f]+:[ 	]+30c02573[ 	]+csrr[ 	]+a0,mstateen0
 [ 	]+[0-9a-f]+:[ 	]+30c59073[ 	]+csrw[ 	]+mstateen0,a1
 [ 	]+[0-9a-f]+:[ 	]+30d02573[ 	]+csrr[ 	]+a0,mstateen1
diff --git a/gas/testsuite/gas/riscv/csr-version-1p11.l b/gas/testsuite/gas/riscv/csr-version-1p11.l
index 81ca86ca7bcc..94c3142c07ff 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p11.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p11.l
@@ -442,6 +442,45 @@
 .*Warning: invalid CSR `miph', needs `smaia' extension
 .*Warning: invalid CSR `miph', needs rv32i extension
 .*Warning: invalid CSR `miph', needs `smaia' extension
+.*Warning: invalid CSR `mtvt', needs `smclic' extension
+.*Warning: invalid CSR `mtvt', needs `smclic' extension
+.*Warning: invalid CSR `mnxti', needs `smclic' extension
+.*Warning: invalid CSR `mnxti', needs `smclic' extension
+.*Warning: invalid CSR `mintstatus', needs `smclic' extension
+.*Warning: invalid CSR `mintstatus', needs `smclic' extension
+.*Warning: read-only CSR is written `csrw mintstatus,a1'
+.*Warning: invalid CSR `mintthresh', needs `smclic' extension
+.*Warning: invalid CSR `mintthresh', needs `smclic' extension
+.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
+.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
+.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
+.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
+.*Warning: invalid CSR `stvt', needs `smclic' extension
+.*Warning: invalid CSR `stvt', needs `smclic' extension
+.*Warning: invalid CSR `snxti', needs `smclic' extension
+.*Warning: invalid CSR `snxti', needs `smclic' extension
+.*Warning: invalid CSR `sintstatus', needs `smclic' extension
+.*Warning: invalid CSR `sintstatus', needs `smclic' extension
+.*Warning: read-only CSR is written `csrw sintstatus,a1'
+.*Warning: invalid CSR `sintthresh', needs `smclic' extension
+.*Warning: invalid CSR `sintthresh', needs `smclic' extension
+.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
+.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
+.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
+.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
+.*Warning: invalid CSR `utvt', needs `smclic' extension
+.*Warning: invalid CSR `utvt', needs `smclic' extension
+.*Warning: invalid CSR `unxti', needs `smclic' extension
+.*Warning: invalid CSR `unxti', needs `smclic' extension
+.*Warning: invalid CSR `uintstatus', needs `smclic' extension
+.*Warning: invalid CSR `uintstatus', needs `smclic' extension
+.*Warning: read-only CSR is written `csrw uintstatus,a1'
+.*Warning: invalid CSR `uintthresh', needs `smclic' extension
+.*Warning: invalid CSR `uintthresh', needs `smclic' extension
+.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
+.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
+.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
+.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
 .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
 .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
 .*Warning: invalid CSR `mstateen1', needs `smstateen' extension
diff --git a/gas/testsuite/gas/riscv/csr-version-1p12.d b/gas/testsuite/gas/riscv/csr-version-1p12.d
index 612aac280768..357f9ae1a626 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p12.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p12.d
@@ -623,6 +623,42 @@ 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]+:[ 	]+30702573[ 	]+csrr[ 	]+a0,mtvt
+[ 	]+[0-9a-f]+:[ 	]+30759073[ 	]+csrw[ 	]+mtvt,a1
+[ 	]+[0-9a-f]+:[ 	]+34502573[ 	]+csrr[ 	]+a0,mnxti
+[ 	]+[0-9a-f]+:[ 	]+34559073[ 	]+csrw[ 	]+mnxti,a1
+[ 	]+[0-9a-f]+:[ 	]+f4602573[ 	]+csrr[ 	]+a0,mintstatus
+[ 	]+[0-9a-f]+:[ 	]+f4659073[ 	]+csrw[ 	]+mintstatus,a1
+[ 	]+[0-9a-f]+:[ 	]+34702573[ 	]+csrr[ 	]+a0,mintthresh
+[ 	]+[0-9a-f]+:[ 	]+34759073[ 	]+csrw[ 	]+mintthresh,a1
+[ 	]+[0-9a-f]+:[ 	]+34802573[ 	]+csrr[ 	]+a0,mscratchcsw
+[ 	]+[0-9a-f]+:[ 	]+34859073[ 	]+csrw[ 	]+mscratchcsw,a1
+[ 	]+[0-9a-f]+:[ 	]+34902573[ 	]+csrr[ 	]+a0,mscratchcswl
+[ 	]+[0-9a-f]+:[ 	]+34959073[ 	]+csrw[ 	]+mscratchcswl,a1
+[ 	]+[0-9a-f]+:[ 	]+10702573[ 	]+csrr[ 	]+a0,stvt
+[ 	]+[0-9a-f]+:[ 	]+10759073[ 	]+csrw[ 	]+stvt,a1
+[ 	]+[0-9a-f]+:[ 	]+14502573[ 	]+csrr[ 	]+a0,snxti
+[ 	]+[0-9a-f]+:[ 	]+14559073[ 	]+csrw[ 	]+snxti,a1
+[ 	]+[0-9a-f]+:[ 	]+d4602573[ 	]+csrr[ 	]+a0,sintstatus
+[ 	]+[0-9a-f]+:[ 	]+d4659073[ 	]+csrw[ 	]+sintstatus,a1
+[ 	]+[0-9a-f]+:[ 	]+14702573[ 	]+csrr[ 	]+a0,sintthresh
+[ 	]+[0-9a-f]+:[ 	]+14759073[ 	]+csrw[ 	]+sintthresh,a1
+[ 	]+[0-9a-f]+:[ 	]+14802573[ 	]+csrr[ 	]+a0,sscratchcsw
+[ 	]+[0-9a-f]+:[ 	]+14859073[ 	]+csrw[ 	]+sscratchcsw,a1
+[ 	]+[0-9a-f]+:[ 	]+14902573[ 	]+csrr[ 	]+a0,sscratchcswl
+[ 	]+[0-9a-f]+:[ 	]+14959073[ 	]+csrw[ 	]+sscratchcswl,a1
+[ 	]+[0-9a-f]+:[ 	]+00702573[ 	]+csrr[ 	]+a0,utvt
+[ 	]+[0-9a-f]+:[ 	]+00759073[ 	]+csrw[ 	]+utvt,a1
+[ 	]+[0-9a-f]+:[ 	]+04502573[ 	]+csrr[ 	]+a0,unxti
+[ 	]+[0-9a-f]+:[ 	]+04559073[ 	]+csrw[ 	]+unxti,a1
+[ 	]+[0-9a-f]+:[ 	]+c4602573[ 	]+csrr[ 	]+a0,uintstatus
+[ 	]+[0-9a-f]+:[ 	]+c4659073[ 	]+csrw[ 	]+uintstatus,a1
+[ 	]+[0-9a-f]+:[ 	]+04702573[ 	]+csrr[ 	]+a0,uintthresh
+[ 	]+[0-9a-f]+:[ 	]+04759073[ 	]+csrw[ 	]+uintthresh,a1
+[ 	]+[0-9a-f]+:[ 	]+04802573[ 	]+csrr[ 	]+a0,uscratchcsw
+[ 	]+[0-9a-f]+:[ 	]+04859073[ 	]+csrw[ 	]+uscratchcsw,a1
+[ 	]+[0-9a-f]+:[ 	]+04902573[ 	]+csrr[ 	]+a0,uscratchcswl
+[ 	]+[0-9a-f]+:[ 	]+04959073[ 	]+csrw[ 	]+uscratchcswl,a1
 [ 	]+[0-9a-f]+:[ 	]+30c02573[ 	]+csrr[ 	]+a0,mstateen0
 [ 	]+[0-9a-f]+:[ 	]+30c59073[ 	]+csrw[ 	]+mstateen0,a1
 [ 	]+[0-9a-f]+:[ 	]+30d02573[ 	]+csrr[ 	]+a0,mstateen1
diff --git a/gas/testsuite/gas/riscv/csr-version-1p12.l b/gas/testsuite/gas/riscv/csr-version-1p12.l
index 1c0bb4ef2d8f..1655fe4ce833 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p12.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p12.l
@@ -304,6 +304,45 @@
 .*Warning: invalid CSR `miph', needs `smaia' extension
 .*Warning: invalid CSR `miph', needs rv32i extension
 .*Warning: invalid CSR `miph', needs `smaia' extension
+.*Warning: invalid CSR `mtvt', needs `smclic' extension
+.*Warning: invalid CSR `mtvt', needs `smclic' extension
+.*Warning: invalid CSR `mnxti', needs `smclic' extension
+.*Warning: invalid CSR `mnxti', needs `smclic' extension
+.*Warning: invalid CSR `mintstatus', needs `smclic' extension
+.*Warning: invalid CSR `mintstatus', needs `smclic' extension
+.*Warning: read-only CSR is written `csrw mintstatus,a1'
+.*Warning: invalid CSR `mintthresh', needs `smclic' extension
+.*Warning: invalid CSR `mintthresh', needs `smclic' extension
+.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
+.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
+.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
+.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
+.*Warning: invalid CSR `stvt', needs `smclic' extension
+.*Warning: invalid CSR `stvt', needs `smclic' extension
+.*Warning: invalid CSR `snxti', needs `smclic' extension
+.*Warning: invalid CSR `snxti', needs `smclic' extension
+.*Warning: invalid CSR `sintstatus', needs `smclic' extension
+.*Warning: invalid CSR `sintstatus', needs `smclic' extension
+.*Warning: read-only CSR is written `csrw sintstatus,a1'
+.*Warning: invalid CSR `sintthresh', needs `smclic' extension
+.*Warning: invalid CSR `sintthresh', needs `smclic' extension
+.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
+.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
+.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
+.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
+.*Warning: invalid CSR `utvt', needs `smclic' extension
+.*Warning: invalid CSR `utvt', needs `smclic' extension
+.*Warning: invalid CSR `unxti', needs `smclic' extension
+.*Warning: invalid CSR `unxti', needs `smclic' extension
+.*Warning: invalid CSR `uintstatus', needs `smclic' extension
+.*Warning: invalid CSR `uintstatus', needs `smclic' extension
+.*Warning: read-only CSR is written `csrw uintstatus,a1'
+.*Warning: invalid CSR `uintthresh', needs `smclic' extension
+.*Warning: invalid CSR `uintthresh', needs `smclic' extension
+.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
+.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
+.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
+.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
 .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
 .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
 .*Warning: invalid CSR `mstateen1', needs `smstateen' extension
diff --git a/gas/testsuite/gas/riscv/csr-version-1p9p1.d b/gas/testsuite/gas/riscv/csr-version-1p9p1.d
index 0fe849c269c2..8688fa6ecb7e 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p9p1.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p9p1.d
@@ -623,6 +623,42 @@ 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]+:[ 	]+30702573[ 	]+csrr[ 	]+a0,mtvt
+[ 	]+[0-9a-f]+:[ 	]+30759073[ 	]+csrw[ 	]+mtvt,a1
+[ 	]+[0-9a-f]+:[ 	]+34502573[ 	]+csrr[ 	]+a0,mnxti
+[ 	]+[0-9a-f]+:[ 	]+34559073[ 	]+csrw[ 	]+mnxti,a1
+[ 	]+[0-9a-f]+:[ 	]+f4602573[ 	]+csrr[ 	]+a0,mintstatus
+[ 	]+[0-9a-f]+:[ 	]+f4659073[ 	]+csrw[ 	]+mintstatus,a1
+[ 	]+[0-9a-f]+:[ 	]+34702573[ 	]+csrr[ 	]+a0,mintthresh
+[ 	]+[0-9a-f]+:[ 	]+34759073[ 	]+csrw[ 	]+mintthresh,a1
+[ 	]+[0-9a-f]+:[ 	]+34802573[ 	]+csrr[ 	]+a0,mscratchcsw
+[ 	]+[0-9a-f]+:[ 	]+34859073[ 	]+csrw[ 	]+mscratchcsw,a1
+[ 	]+[0-9a-f]+:[ 	]+34902573[ 	]+csrr[ 	]+a0,mscratchcswl
+[ 	]+[0-9a-f]+:[ 	]+34959073[ 	]+csrw[ 	]+mscratchcswl,a1
+[ 	]+[0-9a-f]+:[ 	]+10702573[ 	]+csrr[ 	]+a0,stvt
+[ 	]+[0-9a-f]+:[ 	]+10759073[ 	]+csrw[ 	]+stvt,a1
+[ 	]+[0-9a-f]+:[ 	]+14502573[ 	]+csrr[ 	]+a0,snxti
+[ 	]+[0-9a-f]+:[ 	]+14559073[ 	]+csrw[ 	]+snxti,a1
+[ 	]+[0-9a-f]+:[ 	]+d4602573[ 	]+csrr[ 	]+a0,sintstatus
+[ 	]+[0-9a-f]+:[ 	]+d4659073[ 	]+csrw[ 	]+sintstatus,a1
+[ 	]+[0-9a-f]+:[ 	]+14702573[ 	]+csrr[ 	]+a0,sintthresh
+[ 	]+[0-9a-f]+:[ 	]+14759073[ 	]+csrw[ 	]+sintthresh,a1
+[ 	]+[0-9a-f]+:[ 	]+14802573[ 	]+csrr[ 	]+a0,sscratchcsw
+[ 	]+[0-9a-f]+:[ 	]+14859073[ 	]+csrw[ 	]+sscratchcsw,a1
+[ 	]+[0-9a-f]+:[ 	]+14902573[ 	]+csrr[ 	]+a0,sscratchcswl
+[ 	]+[0-9a-f]+:[ 	]+14959073[ 	]+csrw[ 	]+sscratchcswl,a1
+[ 	]+[0-9a-f]+:[ 	]+00702573[ 	]+csrr[ 	]+a0,utvt
+[ 	]+[0-9a-f]+:[ 	]+00759073[ 	]+csrw[ 	]+utvt,a1
+[ 	]+[0-9a-f]+:[ 	]+04502573[ 	]+csrr[ 	]+a0,unxti
+[ 	]+[0-9a-f]+:[ 	]+04559073[ 	]+csrw[ 	]+unxti,a1
+[ 	]+[0-9a-f]+:[ 	]+c4602573[ 	]+csrr[ 	]+a0,uintstatus
+[ 	]+[0-9a-f]+:[ 	]+c4659073[ 	]+csrw[ 	]+uintstatus,a1
+[ 	]+[0-9a-f]+:[ 	]+04702573[ 	]+csrr[ 	]+a0,uintthresh
+[ 	]+[0-9a-f]+:[ 	]+04759073[ 	]+csrw[ 	]+uintthresh,a1
+[ 	]+[0-9a-f]+:[ 	]+04802573[ 	]+csrr[ 	]+a0,uscratchcsw
+[ 	]+[0-9a-f]+:[ 	]+04859073[ 	]+csrw[ 	]+uscratchcsw,a1
+[ 	]+[0-9a-f]+:[ 	]+04902573[ 	]+csrr[ 	]+a0,uscratchcswl
+[ 	]+[0-9a-f]+:[ 	]+04959073[ 	]+csrw[ 	]+uscratchcswl,a1
 [ 	]+[0-9a-f]+:[ 	]+30c02573[ 	]+csrr[ 	]+a0,mstateen0
 [ 	]+[0-9a-f]+:[ 	]+30c59073[ 	]+csrw[ 	]+mstateen0,a1
 [ 	]+[0-9a-f]+:[ 	]+30d02573[ 	]+csrr[ 	]+a0,mstateen1
diff --git a/gas/testsuite/gas/riscv/csr-version-1p9p1.l b/gas/testsuite/gas/riscv/csr-version-1p9p1.l
index c65d0b48e414..22bed0aecfd0 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p9p1.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p9p1.l
@@ -494,6 +494,45 @@
 .*Warning: invalid CSR `miph', needs `smaia' extension
 .*Warning: invalid CSR `miph', needs rv32i extension
 .*Warning: invalid CSR `miph', needs `smaia' extension
+.*Warning: invalid CSR `mtvt', needs `smclic' extension
+.*Warning: invalid CSR `mtvt', needs `smclic' extension
+.*Warning: invalid CSR `mnxti', needs `smclic' extension
+.*Warning: invalid CSR `mnxti', needs `smclic' extension
+.*Warning: invalid CSR `mintstatus', needs `smclic' extension
+.*Warning: invalid CSR `mintstatus', needs `smclic' extension
+.*Warning: read-only CSR is written `csrw mintstatus,a1'
+.*Warning: invalid CSR `mintthresh', needs `smclic' extension
+.*Warning: invalid CSR `mintthresh', needs `smclic' extension
+.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
+.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
+.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
+.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
+.*Warning: invalid CSR `stvt', needs `smclic' extension
+.*Warning: invalid CSR `stvt', needs `smclic' extension
+.*Warning: invalid CSR `snxti', needs `smclic' extension
+.*Warning: invalid CSR `snxti', needs `smclic' extension
+.*Warning: invalid CSR `sintstatus', needs `smclic' extension
+.*Warning: invalid CSR `sintstatus', needs `smclic' extension
+.*Warning: read-only CSR is written `csrw sintstatus,a1'
+.*Warning: invalid CSR `sintthresh', needs `smclic' extension
+.*Warning: invalid CSR `sintthresh', needs `smclic' extension
+.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
+.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
+.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
+.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
+.*Warning: invalid CSR `utvt', needs `smclic' extension
+.*Warning: invalid CSR `utvt', needs `smclic' extension
+.*Warning: invalid CSR `unxti', needs `smclic' extension
+.*Warning: invalid CSR `unxti', needs `smclic' extension
+.*Warning: invalid CSR `uintstatus', needs `smclic' extension
+.*Warning: invalid CSR `uintstatus', needs `smclic' extension
+.*Warning: read-only CSR is written `csrw uintstatus,a1'
+.*Warning: invalid CSR `uintthresh', needs `smclic' extension
+.*Warning: invalid CSR `uintthresh', needs `smclic' extension
+.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
+.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
+.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
+.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
 .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
 .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
 .*Warning: invalid CSR `mstateen1', needs `smstateen' extension
diff --git a/gas/testsuite/gas/riscv/csr.s b/gas/testsuite/gas/riscv/csr.s
index c7406ce34c2e..29a0710df812 100644
--- a/gas/testsuite/gas/riscv/csr.s
+++ b/gas/testsuite/gas/riscv/csr.s
@@ -350,6 +350,26 @@
 	csr mviph
 	csr miph
 
+	# Smclic extension
+	csr mtvt
+	csr mnxti
+	csr mintstatus
+	csr mintthresh
+	csr mscratchcsw
+	csr mscratchcswl
+	csr stvt
+	csr snxti
+	csr sintstatus
+	csr sintthresh
+	csr sscratchcsw
+	csr sscratchcswl
+	csr utvt
+	csr unxti
+	csr uintstatus
+	csr uintthresh
+	csr uscratchcsw
+	csr uscratchcswl
+
 	# Smstateen/Ssstateen extensions
 	csr mstateen0
 	csr mstateen1
diff --git a/include/opcode/riscv-opc.h b/include/opcode/riscv-opc.h
index 06e3df0f5a63..3f072bf01b3c 100644
--- a/include/opcode/riscv-opc.h
+++ b/include/opcode/riscv-opc.h
@@ -2673,6 +2673,25 @@
 #define CSR_MVIENH   0x318
 #define CSR_MVIPH    0x319
 #define CSR_MIPH     0x354
+/* Smclic extension CSR addresses (including user interrupts).  */
+#define CSR_MTVT 0x307
+#define CSR_MNXTI 0x345
+#define CSR_MINTSTATUS 0xf46
+#define CSR_MINTTHRESH 0x347
+#define CSR_MSCRATCHCSW 0x348
+#define CSR_MSCRATCHCSWL 0x349
+#define CSR_STVT 0x107
+#define CSR_SNXTI 0x145
+#define CSR_SINTSTATUS 0xd46
+#define CSR_SINTTHRESH 0x147
+#define CSR_SSCRATCHCSW 0x148
+#define CSR_SSCRATCHCSWL 0x149
+#define CSR_UTVT 0x7
+#define CSR_UNXTI 0x45
+#define CSR_UINTSTATUS 0xc46
+#define CSR_UINTTHRESH 0x47
+#define CSR_USCRATCHCSW 0x48
+#define CSR_USCRATCHCSWL 0x49
 /* Smstateen extension */
 #define CSR_MSTATEEN0 0x30c
 #define CSR_MSTATEEN1 0x30d
@@ -3550,6 +3569,25 @@ 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)
+/* Smclic extension CSRs (including user interrupts).  */
+DECLARE_CSR(mtvt, CSR_MTVT, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(mnxti, CSR_MNXTI, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(mintstatus, CSR_MINTSTATUS, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(mintthresh, CSR_MINTTHRESH, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(mscratchcsw, CSR_MSCRATCHCSW, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(mscratchcswl, CSR_MSCRATCHCSWL, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(stvt, CSR_STVT, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(snxti, CSR_SNXTI, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(sintstatus, CSR_SINTSTATUS, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(sintthresh, CSR_SINTTHRESH, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(sscratchcsw, CSR_SSCRATCHCSW, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(sscratchcswl, CSR_SSCRATCHCSWL, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(utvt, CSR_UTVT, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(unxti, CSR_UNXTI, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(uintstatus, CSR_UINTSTATUS, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(uintthresh, CSR_UINTTHRESH, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(uscratchcsw, CSR_USCRATCHCSW, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(uscratchcswl, CSR_USCRATCHCSWL, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
 /* 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)
-- 
2.38.1


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

* Re: [REVIEW ONLY 1/1] UNRATIFIED RISC-V: Add 'Smclic' extension and its CSRs
  2022-11-29  1:19 ` [REVIEW ONLY 1/1] " Tsukasa OI
@ 2022-11-29  2:03   ` Palmer Dabbelt
  2022-11-29  2:16     ` Tsukasa OI
  0 siblings, 1 reply; 7+ messages in thread
From: Palmer Dabbelt @ 2022-11-29  2:03 UTC (permalink / raw)
  To: binutils; +Cc: research_trasio, binutils

On Mon, 28 Nov 2022 17:19:53 PST (-0800), binutils@sourceware.org wrote:
> From: Tsukasa OI <research_trasio@irq.a4lg.com>
>
> [DO NOT MERGE]
> Until 'Smclic' extension is frozen/ratified and final version number is
> determined, this patch should not be merged upstream.  This commit uses
> unratified version 0.9 as in the documentation (instead of possible 1.0
> after ratification).
>
> [RFC]
> It implements u* CSRs as supported in all privileged architectures.
> Since user-mode interrupt is dropped, we might need to mask or remove them.

Looks like there's some issues related to these, though it's not super 
clear what the plan is 
<https://github.com/riscv/riscv-fast-interrupt/issues/160>.  Probably 
best to just wait until it's frozen to sort that out?

>
> This commit adds CSR support for the 'Smclic' extension, a part of Core-
> Local Interrupt Controller (CLIC) extension.
>
> This is based on the latest Core-Local Interrupt Controller (CLIC)
> extension draft (version 0.9-draft):
> <https://github.com/riscv/riscv-fast-interrupt/blob/e601b94bf43af0e9842b20134814404e488511e3/clic.pdf>
>
> bfd/ChangeLog:
>
> 	* elfxx-riscv.c (riscv_implicit_subsets): Add implication from
> 	'Smclic' to 'Zicsr'.  (riscv_supported_std_s_ext) Add 'Smclic'.
>
> gas/ChangeLog:
>
> 	* config/tc-riscv.c (enum riscv_csr_class): Add new CSR class.
> 	(riscv_csr_address): Add new CSR class handling.
> 	* testsuite/gas/riscv/csr.s: Add new CSR test.
> 	* testsuite/gas/riscv/csr-dw-regnums.s: Likewise.
> 	* testsuite/gas/riscv/csr-dw-regnums.d: Likewise.
> 	* 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_MTVT, CSR_MNXTI, CSR_MINTSTATUS,
> 	CSR_MINTTHRESH, CSR_MSCRATCHCSW, CSR_MSCRATCHCSWL, CSR_STVT,
> 	CSR_SNXTI, CSR_SINTSTATUS, CSR_SINTTHRESH, CSR_SSCRATCHCSW,
> 	CSR_SSCRATCHCSWL, CSR_UTVT, CSR_UNXTI, CSR_UINTSTATUS,
> 	CSR_UINTTHRESH, CSR_USCRATCHCSW, CSR_USCRATCHCSWL): New.
> ---
>  bfd/elfxx-riscv.c                           |  2 ++
>  gas/config/tc-riscv.c                       |  4 +++
>  gas/testsuite/gas/riscv/csr-dw-regnums.d    | 18 ++++++++++
>  gas/testsuite/gas/riscv/csr-dw-regnums.s    | 19 ++++++++++
>  gas/testsuite/gas/riscv/csr-version-1p10.d  | 36 +++++++++++++++++++
>  gas/testsuite/gas/riscv/csr-version-1p10.l  | 39 +++++++++++++++++++++
>  gas/testsuite/gas/riscv/csr-version-1p11.d  | 36 +++++++++++++++++++
>  gas/testsuite/gas/riscv/csr-version-1p11.l  | 39 +++++++++++++++++++++
>  gas/testsuite/gas/riscv/csr-version-1p12.d  | 36 +++++++++++++++++++
>  gas/testsuite/gas/riscv/csr-version-1p12.l  | 39 +++++++++++++++++++++
>  gas/testsuite/gas/riscv/csr-version-1p9p1.d | 36 +++++++++++++++++++
>  gas/testsuite/gas/riscv/csr-version-1p9p1.l | 39 +++++++++++++++++++++
>  gas/testsuite/gas/riscv/csr.s               | 20 +++++++++++
>  include/opcode/riscv-opc.h                  | 38 ++++++++++++++++++++
>  14 files changed, 401 insertions(+)
>
> diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
> index 0bcf2fdcfa34..6c60cf7c888e 100644
> --- a/bfd/elfxx-riscv.c
> +++ b/bfd/elfxx-riscv.c
> @@ -1103,6 +1103,7 @@ static struct riscv_implicit_subset riscv_implicit_subsets[] =
>    {"zks", "zksh",	check_implicit_always},
>    {"smaia", "ssaia",		check_implicit_always},
>    {"smstateen", "ssstateen",	check_implicit_always},
> +  {"smclic", "zicsr",		check_implicit_always},
>    {"smepmp", "zicsr",		check_implicit_always},
>    {"ssaia", "zicsr",		check_implicit_always},
>    {"sscofpmf", "zicsr",		check_implicit_always},
> @@ -1224,6 +1225,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 },
> +  {"smclic",		ISA_SPEC_CLASS_DRAFT,		0, 9, 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 0682eb355241..e90e0ba53987 100644
> --- a/gas/config/tc-riscv.c
> +++ b/gas/config/tc-riscv.c
> @@ -74,6 +74,7 @@ enum riscv_csr_class
>    CSR_CLASS_H_32,	/* hypervisor, rv32 only */
>    CSR_CLASS_SMAIA,		/* Smaia */
>    CSR_CLASS_SMAIA_32,		/* Smaia, rv32 only */
> +  CSR_CLASS_SMCLIC,		/* Smclic only */
>    CSR_CLASS_SMSTATEEN,		/* Smstateen only */
>    CSR_CLASS_SMSTATEEN_32,	/* Smstateen RV32 only */
>    CSR_CLASS_SSAIA,		/* Ssaia */
> @@ -1049,6 +1050,9 @@ riscv_csr_address (const char *csr_name,
>      case CSR_CLASS_SMAIA:
>        extension = "smaia";
>        break;
> +    case CSR_CLASS_SMCLIC:
> +      extension = "smclic";
> +      break;
>      case CSR_CLASS_SMSTATEEN:
>      case CSR_CLASS_SMSTATEEN_32:
>        is_rv32_only = (csr_class == CSR_CLASS_SMSTATEEN_32);
> diff --git a/gas/testsuite/gas/riscv/csr-dw-regnums.d b/gas/testsuite/gas/riscv/csr-dw-regnums.d
> index fd830666ab89..2b58c6a955b1 100644
> --- a/gas/testsuite/gas/riscv/csr-dw-regnums.d
> +++ b/gas/testsuite/gas/riscv/csr-dw-regnums.d
> @@ -324,6 +324,24 @@ 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: r4871 \(mtvt\) at cfa\+3100
> +  DW_CFA_offset_extended_sf: r4933 \(mnxti\) at cfa\+3348
> +  DW_CFA_offset_extended_sf: r8006 \(mintstatus\) at cfa\+15640
> +  DW_CFA_offset_extended_sf: r4935 \(mintthresh\) at cfa\+3356
> +  DW_CFA_offset_extended_sf: r4936 \(mscratchcsw\) at cfa\+3360
> +  DW_CFA_offset_extended_sf: r4937 \(mscratchcswl\) at cfa\+3364
> +  DW_CFA_offset_extended_sf: r4359 \(stvt\) at cfa\+1052
> +  DW_CFA_offset_extended_sf: r4421 \(snxti\) at cfa\+1300
> +  DW_CFA_offset_extended_sf: r7494 \(sintstatus\) at cfa\+13592
> +  DW_CFA_offset_extended_sf: r4423 \(sintthresh\) at cfa\+1308
> +  DW_CFA_offset_extended_sf: r4424 \(sscratchcsw\) at cfa\+1312
> +  DW_CFA_offset_extended_sf: r4425 \(sscratchcswl\) at cfa\+1316
> +  DW_CFA_offset_extended_sf: r4103 \(utvt\) at cfa\+28
> +  DW_CFA_offset_extended_sf: r4165 \(unxti\) at cfa\+276
> +  DW_CFA_offset_extended_sf: r7238 \(uintstatus\) at cfa\+12568
> +  DW_CFA_offset_extended_sf: r4167 \(uintthresh\) at cfa\+284
> +  DW_CFA_offset_extended_sf: r4168 \(uscratchcsw\) at cfa\+288
> +  DW_CFA_offset_extended_sf: r4169 \(uscratchcswl\) at cfa\+292
>    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
> diff --git a/gas/testsuite/gas/riscv/csr-dw-regnums.s b/gas/testsuite/gas/riscv/csr-dw-regnums.s
> index b8b0f7902297..af1158eb0089 100644
> --- a/gas/testsuite/gas/riscv/csr-dw-regnums.s
> +++ b/gas/testsuite/gas/riscv/csr-dw-regnums.s
> @@ -321,6 +321,25 @@ _start:
>  	.cfi_offset mvienh, 3168
>  	.cfi_offset mviph, 3172
>  	.cfi_offset miph, 3408
> +	# Smclic extension
> +	.cfi_offset mtvt, 3100
> +	.cfi_offset mnxti, 3348
> +	.cfi_offset mintstatus, 15640
> +	.cfi_offset mintthresh, 3356
> +	.cfi_offset mscratchcsw, 3360
> +	.cfi_offset mscratchcswl, 3364
> +	.cfi_offset stvt, 1052
> +	.cfi_offset snxti, 1300
> +	.cfi_offset sintstatus, 13592
> +	.cfi_offset sintthresh, 1308
> +	.cfi_offset sscratchcsw, 1312
> +	.cfi_offset sscratchcswl, 1316
> +	.cfi_offset utvt, 28
> +	.cfi_offset unxti, 276
> +	.cfi_offset uintstatus, 12568
> +	.cfi_offset uintthresh, 284
> +	.cfi_offset uscratchcsw, 288
> +	.cfi_offset uscratchcswl, 292
>  	# Smstateen extension
>  	.cfi_offset mstateen0, 3120
>  	.cfi_offset mstateen1, 3124
> diff --git a/gas/testsuite/gas/riscv/csr-version-1p10.d b/gas/testsuite/gas/riscv/csr-version-1p10.d
> index ee41e1025cce..aa116a75fadd 100644
> --- a/gas/testsuite/gas/riscv/csr-version-1p10.d
> +++ b/gas/testsuite/gas/riscv/csr-version-1p10.d
> @@ -623,6 +623,42 @@ 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]+:[ 	]+30702573[ 	]+csrr[ 	]+a0,mtvt
> +[ 	]+[0-9a-f]+:[ 	]+30759073[ 	]+csrw[ 	]+mtvt,a1
> +[ 	]+[0-9a-f]+:[ 	]+34502573[ 	]+csrr[ 	]+a0,mnxti
> +[ 	]+[0-9a-f]+:[ 	]+34559073[ 	]+csrw[ 	]+mnxti,a1
> +[ 	]+[0-9a-f]+:[ 	]+f4602573[ 	]+csrr[ 	]+a0,mintstatus
> +[ 	]+[0-9a-f]+:[ 	]+f4659073[ 	]+csrw[ 	]+mintstatus,a1
> +[ 	]+[0-9a-f]+:[ 	]+34702573[ 	]+csrr[ 	]+a0,mintthresh
> +[ 	]+[0-9a-f]+:[ 	]+34759073[ 	]+csrw[ 	]+mintthresh,a1
> +[ 	]+[0-9a-f]+:[ 	]+34802573[ 	]+csrr[ 	]+a0,mscratchcsw
> +[ 	]+[0-9a-f]+:[ 	]+34859073[ 	]+csrw[ 	]+mscratchcsw,a1
> +[ 	]+[0-9a-f]+:[ 	]+34902573[ 	]+csrr[ 	]+a0,mscratchcswl
> +[ 	]+[0-9a-f]+:[ 	]+34959073[ 	]+csrw[ 	]+mscratchcswl,a1
> +[ 	]+[0-9a-f]+:[ 	]+10702573[ 	]+csrr[ 	]+a0,stvt
> +[ 	]+[0-9a-f]+:[ 	]+10759073[ 	]+csrw[ 	]+stvt,a1
> +[ 	]+[0-9a-f]+:[ 	]+14502573[ 	]+csrr[ 	]+a0,snxti
> +[ 	]+[0-9a-f]+:[ 	]+14559073[ 	]+csrw[ 	]+snxti,a1
> +[ 	]+[0-9a-f]+:[ 	]+d4602573[ 	]+csrr[ 	]+a0,sintstatus
> +[ 	]+[0-9a-f]+:[ 	]+d4659073[ 	]+csrw[ 	]+sintstatus,a1
> +[ 	]+[0-9a-f]+:[ 	]+14702573[ 	]+csrr[ 	]+a0,sintthresh
> +[ 	]+[0-9a-f]+:[ 	]+14759073[ 	]+csrw[ 	]+sintthresh,a1
> +[ 	]+[0-9a-f]+:[ 	]+14802573[ 	]+csrr[ 	]+a0,sscratchcsw
> +[ 	]+[0-9a-f]+:[ 	]+14859073[ 	]+csrw[ 	]+sscratchcsw,a1
> +[ 	]+[0-9a-f]+:[ 	]+14902573[ 	]+csrr[ 	]+a0,sscratchcswl
> +[ 	]+[0-9a-f]+:[ 	]+14959073[ 	]+csrw[ 	]+sscratchcswl,a1
> +[ 	]+[0-9a-f]+:[ 	]+00702573[ 	]+csrr[ 	]+a0,utvt
> +[ 	]+[0-9a-f]+:[ 	]+00759073[ 	]+csrw[ 	]+utvt,a1
> +[ 	]+[0-9a-f]+:[ 	]+04502573[ 	]+csrr[ 	]+a0,unxti
> +[ 	]+[0-9a-f]+:[ 	]+04559073[ 	]+csrw[ 	]+unxti,a1
> +[ 	]+[0-9a-f]+:[ 	]+c4602573[ 	]+csrr[ 	]+a0,uintstatus
> +[ 	]+[0-9a-f]+:[ 	]+c4659073[ 	]+csrw[ 	]+uintstatus,a1
> +[ 	]+[0-9a-f]+:[ 	]+04702573[ 	]+csrr[ 	]+a0,uintthresh
> +[ 	]+[0-9a-f]+:[ 	]+04759073[ 	]+csrw[ 	]+uintthresh,a1
> +[ 	]+[0-9a-f]+:[ 	]+04802573[ 	]+csrr[ 	]+a0,uscratchcsw
> +[ 	]+[0-9a-f]+:[ 	]+04859073[ 	]+csrw[ 	]+uscratchcsw,a1
> +[ 	]+[0-9a-f]+:[ 	]+04902573[ 	]+csrr[ 	]+a0,uscratchcswl
> +[ 	]+[0-9a-f]+:[ 	]+04959073[ 	]+csrw[ 	]+uscratchcswl,a1
>  [ 	]+[0-9a-f]+:[ 	]+30c02573[ 	]+csrr[ 	]+a0,mstateen0
>  [ 	]+[0-9a-f]+:[ 	]+30c59073[ 	]+csrw[ 	]+mstateen0,a1
>  [ 	]+[0-9a-f]+:[ 	]+30d02573[ 	]+csrr[ 	]+a0,mstateen1
> diff --git a/gas/testsuite/gas/riscv/csr-version-1p10.l b/gas/testsuite/gas/riscv/csr-version-1p10.l
> index e677b78b8bb8..15431cef4590 100644
> --- a/gas/testsuite/gas/riscv/csr-version-1p10.l
> +++ b/gas/testsuite/gas/riscv/csr-version-1p10.l
> @@ -444,6 +444,45 @@
>  .*Warning: invalid CSR `miph', needs `smaia' extension
>  .*Warning: invalid CSR `miph', needs rv32i extension
>  .*Warning: invalid CSR `miph', needs `smaia' extension
> +.*Warning: invalid CSR `mtvt', needs `smclic' extension
> +.*Warning: invalid CSR `mtvt', needs `smclic' extension
> +.*Warning: invalid CSR `mnxti', needs `smclic' extension
> +.*Warning: invalid CSR `mnxti', needs `smclic' extension
> +.*Warning: invalid CSR `mintstatus', needs `smclic' extension
> +.*Warning: invalid CSR `mintstatus', needs `smclic' extension
> +.*Warning: read-only CSR is written `csrw mintstatus,a1'
> +.*Warning: invalid CSR `mintthresh', needs `smclic' extension
> +.*Warning: invalid CSR `mintthresh', needs `smclic' extension
> +.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
> +.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
> +.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
> +.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
> +.*Warning: invalid CSR `stvt', needs `smclic' extension
> +.*Warning: invalid CSR `stvt', needs `smclic' extension
> +.*Warning: invalid CSR `snxti', needs `smclic' extension
> +.*Warning: invalid CSR `snxti', needs `smclic' extension
> +.*Warning: invalid CSR `sintstatus', needs `smclic' extension
> +.*Warning: invalid CSR `sintstatus', needs `smclic' extension
> +.*Warning: read-only CSR is written `csrw sintstatus,a1'
> +.*Warning: invalid CSR `sintthresh', needs `smclic' extension
> +.*Warning: invalid CSR `sintthresh', needs `smclic' extension
> +.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
> +.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
> +.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
> +.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
> +.*Warning: invalid CSR `utvt', needs `smclic' extension
> +.*Warning: invalid CSR `utvt', needs `smclic' extension
> +.*Warning: invalid CSR `unxti', needs `smclic' extension
> +.*Warning: invalid CSR `unxti', needs `smclic' extension
> +.*Warning: invalid CSR `uintstatus', needs `smclic' extension
> +.*Warning: invalid CSR `uintstatus', needs `smclic' extension
> +.*Warning: read-only CSR is written `csrw uintstatus,a1'
> +.*Warning: invalid CSR `uintthresh', needs `smclic' extension
> +.*Warning: invalid CSR `uintthresh', needs `smclic' extension
> +.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
> +.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
> +.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
> +.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>  .*Warning: invalid CSR `mstateen1', needs `smstateen' extension
> diff --git a/gas/testsuite/gas/riscv/csr-version-1p11.d b/gas/testsuite/gas/riscv/csr-version-1p11.d
> index a83b1bf68f98..c7af6b7cafac 100644
> --- a/gas/testsuite/gas/riscv/csr-version-1p11.d
> +++ b/gas/testsuite/gas/riscv/csr-version-1p11.d
> @@ -623,6 +623,42 @@ 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]+:[ 	]+30702573[ 	]+csrr[ 	]+a0,mtvt
> +[ 	]+[0-9a-f]+:[ 	]+30759073[ 	]+csrw[ 	]+mtvt,a1
> +[ 	]+[0-9a-f]+:[ 	]+34502573[ 	]+csrr[ 	]+a0,mnxti
> +[ 	]+[0-9a-f]+:[ 	]+34559073[ 	]+csrw[ 	]+mnxti,a1
> +[ 	]+[0-9a-f]+:[ 	]+f4602573[ 	]+csrr[ 	]+a0,mintstatus
> +[ 	]+[0-9a-f]+:[ 	]+f4659073[ 	]+csrw[ 	]+mintstatus,a1
> +[ 	]+[0-9a-f]+:[ 	]+34702573[ 	]+csrr[ 	]+a0,mintthresh
> +[ 	]+[0-9a-f]+:[ 	]+34759073[ 	]+csrw[ 	]+mintthresh,a1
> +[ 	]+[0-9a-f]+:[ 	]+34802573[ 	]+csrr[ 	]+a0,mscratchcsw
> +[ 	]+[0-9a-f]+:[ 	]+34859073[ 	]+csrw[ 	]+mscratchcsw,a1
> +[ 	]+[0-9a-f]+:[ 	]+34902573[ 	]+csrr[ 	]+a0,mscratchcswl
> +[ 	]+[0-9a-f]+:[ 	]+34959073[ 	]+csrw[ 	]+mscratchcswl,a1
> +[ 	]+[0-9a-f]+:[ 	]+10702573[ 	]+csrr[ 	]+a0,stvt
> +[ 	]+[0-9a-f]+:[ 	]+10759073[ 	]+csrw[ 	]+stvt,a1
> +[ 	]+[0-9a-f]+:[ 	]+14502573[ 	]+csrr[ 	]+a0,snxti
> +[ 	]+[0-9a-f]+:[ 	]+14559073[ 	]+csrw[ 	]+snxti,a1
> +[ 	]+[0-9a-f]+:[ 	]+d4602573[ 	]+csrr[ 	]+a0,sintstatus
> +[ 	]+[0-9a-f]+:[ 	]+d4659073[ 	]+csrw[ 	]+sintstatus,a1
> +[ 	]+[0-9a-f]+:[ 	]+14702573[ 	]+csrr[ 	]+a0,sintthresh
> +[ 	]+[0-9a-f]+:[ 	]+14759073[ 	]+csrw[ 	]+sintthresh,a1
> +[ 	]+[0-9a-f]+:[ 	]+14802573[ 	]+csrr[ 	]+a0,sscratchcsw
> +[ 	]+[0-9a-f]+:[ 	]+14859073[ 	]+csrw[ 	]+sscratchcsw,a1
> +[ 	]+[0-9a-f]+:[ 	]+14902573[ 	]+csrr[ 	]+a0,sscratchcswl
> +[ 	]+[0-9a-f]+:[ 	]+14959073[ 	]+csrw[ 	]+sscratchcswl,a1
> +[ 	]+[0-9a-f]+:[ 	]+00702573[ 	]+csrr[ 	]+a0,utvt
> +[ 	]+[0-9a-f]+:[ 	]+00759073[ 	]+csrw[ 	]+utvt,a1
> +[ 	]+[0-9a-f]+:[ 	]+04502573[ 	]+csrr[ 	]+a0,unxti
> +[ 	]+[0-9a-f]+:[ 	]+04559073[ 	]+csrw[ 	]+unxti,a1
> +[ 	]+[0-9a-f]+:[ 	]+c4602573[ 	]+csrr[ 	]+a0,uintstatus
> +[ 	]+[0-9a-f]+:[ 	]+c4659073[ 	]+csrw[ 	]+uintstatus,a1
> +[ 	]+[0-9a-f]+:[ 	]+04702573[ 	]+csrr[ 	]+a0,uintthresh
> +[ 	]+[0-9a-f]+:[ 	]+04759073[ 	]+csrw[ 	]+uintthresh,a1
> +[ 	]+[0-9a-f]+:[ 	]+04802573[ 	]+csrr[ 	]+a0,uscratchcsw
> +[ 	]+[0-9a-f]+:[ 	]+04859073[ 	]+csrw[ 	]+uscratchcsw,a1
> +[ 	]+[0-9a-f]+:[ 	]+04902573[ 	]+csrr[ 	]+a0,uscratchcswl
> +[ 	]+[0-9a-f]+:[ 	]+04959073[ 	]+csrw[ 	]+uscratchcswl,a1
>  [ 	]+[0-9a-f]+:[ 	]+30c02573[ 	]+csrr[ 	]+a0,mstateen0
>  [ 	]+[0-9a-f]+:[ 	]+30c59073[ 	]+csrw[ 	]+mstateen0,a1
>  [ 	]+[0-9a-f]+:[ 	]+30d02573[ 	]+csrr[ 	]+a0,mstateen1
> diff --git a/gas/testsuite/gas/riscv/csr-version-1p11.l b/gas/testsuite/gas/riscv/csr-version-1p11.l
> index 81ca86ca7bcc..94c3142c07ff 100644
> --- a/gas/testsuite/gas/riscv/csr-version-1p11.l
> +++ b/gas/testsuite/gas/riscv/csr-version-1p11.l
> @@ -442,6 +442,45 @@
>  .*Warning: invalid CSR `miph', needs `smaia' extension
>  .*Warning: invalid CSR `miph', needs rv32i extension
>  .*Warning: invalid CSR `miph', needs `smaia' extension
> +.*Warning: invalid CSR `mtvt', needs `smclic' extension
> +.*Warning: invalid CSR `mtvt', needs `smclic' extension
> +.*Warning: invalid CSR `mnxti', needs `smclic' extension
> +.*Warning: invalid CSR `mnxti', needs `smclic' extension
> +.*Warning: invalid CSR `mintstatus', needs `smclic' extension
> +.*Warning: invalid CSR `mintstatus', needs `smclic' extension
> +.*Warning: read-only CSR is written `csrw mintstatus,a1'
> +.*Warning: invalid CSR `mintthresh', needs `smclic' extension
> +.*Warning: invalid CSR `mintthresh', needs `smclic' extension
> +.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
> +.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
> +.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
> +.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
> +.*Warning: invalid CSR `stvt', needs `smclic' extension
> +.*Warning: invalid CSR `stvt', needs `smclic' extension
> +.*Warning: invalid CSR `snxti', needs `smclic' extension
> +.*Warning: invalid CSR `snxti', needs `smclic' extension
> +.*Warning: invalid CSR `sintstatus', needs `smclic' extension
> +.*Warning: invalid CSR `sintstatus', needs `smclic' extension
> +.*Warning: read-only CSR is written `csrw sintstatus,a1'
> +.*Warning: invalid CSR `sintthresh', needs `smclic' extension
> +.*Warning: invalid CSR `sintthresh', needs `smclic' extension
> +.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
> +.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
> +.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
> +.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
> +.*Warning: invalid CSR `utvt', needs `smclic' extension
> +.*Warning: invalid CSR `utvt', needs `smclic' extension
> +.*Warning: invalid CSR `unxti', needs `smclic' extension
> +.*Warning: invalid CSR `unxti', needs `smclic' extension
> +.*Warning: invalid CSR `uintstatus', needs `smclic' extension
> +.*Warning: invalid CSR `uintstatus', needs `smclic' extension
> +.*Warning: read-only CSR is written `csrw uintstatus,a1'
> +.*Warning: invalid CSR `uintthresh', needs `smclic' extension
> +.*Warning: invalid CSR `uintthresh', needs `smclic' extension
> +.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
> +.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
> +.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
> +.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>  .*Warning: invalid CSR `mstateen1', needs `smstateen' extension
> diff --git a/gas/testsuite/gas/riscv/csr-version-1p12.d b/gas/testsuite/gas/riscv/csr-version-1p12.d
> index 612aac280768..357f9ae1a626 100644
> --- a/gas/testsuite/gas/riscv/csr-version-1p12.d
> +++ b/gas/testsuite/gas/riscv/csr-version-1p12.d
> @@ -623,6 +623,42 @@ 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]+:[ 	]+30702573[ 	]+csrr[ 	]+a0,mtvt
> +[ 	]+[0-9a-f]+:[ 	]+30759073[ 	]+csrw[ 	]+mtvt,a1
> +[ 	]+[0-9a-f]+:[ 	]+34502573[ 	]+csrr[ 	]+a0,mnxti
> +[ 	]+[0-9a-f]+:[ 	]+34559073[ 	]+csrw[ 	]+mnxti,a1
> +[ 	]+[0-9a-f]+:[ 	]+f4602573[ 	]+csrr[ 	]+a0,mintstatus
> +[ 	]+[0-9a-f]+:[ 	]+f4659073[ 	]+csrw[ 	]+mintstatus,a1
> +[ 	]+[0-9a-f]+:[ 	]+34702573[ 	]+csrr[ 	]+a0,mintthresh
> +[ 	]+[0-9a-f]+:[ 	]+34759073[ 	]+csrw[ 	]+mintthresh,a1
> +[ 	]+[0-9a-f]+:[ 	]+34802573[ 	]+csrr[ 	]+a0,mscratchcsw
> +[ 	]+[0-9a-f]+:[ 	]+34859073[ 	]+csrw[ 	]+mscratchcsw,a1
> +[ 	]+[0-9a-f]+:[ 	]+34902573[ 	]+csrr[ 	]+a0,mscratchcswl
> +[ 	]+[0-9a-f]+:[ 	]+34959073[ 	]+csrw[ 	]+mscratchcswl,a1
> +[ 	]+[0-9a-f]+:[ 	]+10702573[ 	]+csrr[ 	]+a0,stvt
> +[ 	]+[0-9a-f]+:[ 	]+10759073[ 	]+csrw[ 	]+stvt,a1
> +[ 	]+[0-9a-f]+:[ 	]+14502573[ 	]+csrr[ 	]+a0,snxti
> +[ 	]+[0-9a-f]+:[ 	]+14559073[ 	]+csrw[ 	]+snxti,a1
> +[ 	]+[0-9a-f]+:[ 	]+d4602573[ 	]+csrr[ 	]+a0,sintstatus
> +[ 	]+[0-9a-f]+:[ 	]+d4659073[ 	]+csrw[ 	]+sintstatus,a1
> +[ 	]+[0-9a-f]+:[ 	]+14702573[ 	]+csrr[ 	]+a0,sintthresh
> +[ 	]+[0-9a-f]+:[ 	]+14759073[ 	]+csrw[ 	]+sintthresh,a1
> +[ 	]+[0-9a-f]+:[ 	]+14802573[ 	]+csrr[ 	]+a0,sscratchcsw
> +[ 	]+[0-9a-f]+:[ 	]+14859073[ 	]+csrw[ 	]+sscratchcsw,a1
> +[ 	]+[0-9a-f]+:[ 	]+14902573[ 	]+csrr[ 	]+a0,sscratchcswl
> +[ 	]+[0-9a-f]+:[ 	]+14959073[ 	]+csrw[ 	]+sscratchcswl,a1
> +[ 	]+[0-9a-f]+:[ 	]+00702573[ 	]+csrr[ 	]+a0,utvt
> +[ 	]+[0-9a-f]+:[ 	]+00759073[ 	]+csrw[ 	]+utvt,a1
> +[ 	]+[0-9a-f]+:[ 	]+04502573[ 	]+csrr[ 	]+a0,unxti
> +[ 	]+[0-9a-f]+:[ 	]+04559073[ 	]+csrw[ 	]+unxti,a1
> +[ 	]+[0-9a-f]+:[ 	]+c4602573[ 	]+csrr[ 	]+a0,uintstatus
> +[ 	]+[0-9a-f]+:[ 	]+c4659073[ 	]+csrw[ 	]+uintstatus,a1
> +[ 	]+[0-9a-f]+:[ 	]+04702573[ 	]+csrr[ 	]+a0,uintthresh
> +[ 	]+[0-9a-f]+:[ 	]+04759073[ 	]+csrw[ 	]+uintthresh,a1
> +[ 	]+[0-9a-f]+:[ 	]+04802573[ 	]+csrr[ 	]+a0,uscratchcsw
> +[ 	]+[0-9a-f]+:[ 	]+04859073[ 	]+csrw[ 	]+uscratchcsw,a1
> +[ 	]+[0-9a-f]+:[ 	]+04902573[ 	]+csrr[ 	]+a0,uscratchcswl
> +[ 	]+[0-9a-f]+:[ 	]+04959073[ 	]+csrw[ 	]+uscratchcswl,a1
>  [ 	]+[0-9a-f]+:[ 	]+30c02573[ 	]+csrr[ 	]+a0,mstateen0
>  [ 	]+[0-9a-f]+:[ 	]+30c59073[ 	]+csrw[ 	]+mstateen0,a1
>  [ 	]+[0-9a-f]+:[ 	]+30d02573[ 	]+csrr[ 	]+a0,mstateen1
> diff --git a/gas/testsuite/gas/riscv/csr-version-1p12.l b/gas/testsuite/gas/riscv/csr-version-1p12.l
> index 1c0bb4ef2d8f..1655fe4ce833 100644
> --- a/gas/testsuite/gas/riscv/csr-version-1p12.l
> +++ b/gas/testsuite/gas/riscv/csr-version-1p12.l
> @@ -304,6 +304,45 @@
>  .*Warning: invalid CSR `miph', needs `smaia' extension
>  .*Warning: invalid CSR `miph', needs rv32i extension
>  .*Warning: invalid CSR `miph', needs `smaia' extension
> +.*Warning: invalid CSR `mtvt', needs `smclic' extension
> +.*Warning: invalid CSR `mtvt', needs `smclic' extension
> +.*Warning: invalid CSR `mnxti', needs `smclic' extension
> +.*Warning: invalid CSR `mnxti', needs `smclic' extension
> +.*Warning: invalid CSR `mintstatus', needs `smclic' extension
> +.*Warning: invalid CSR `mintstatus', needs `smclic' extension
> +.*Warning: read-only CSR is written `csrw mintstatus,a1'
> +.*Warning: invalid CSR `mintthresh', needs `smclic' extension
> +.*Warning: invalid CSR `mintthresh', needs `smclic' extension
> +.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
> +.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
> +.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
> +.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
> +.*Warning: invalid CSR `stvt', needs `smclic' extension
> +.*Warning: invalid CSR `stvt', needs `smclic' extension
> +.*Warning: invalid CSR `snxti', needs `smclic' extension
> +.*Warning: invalid CSR `snxti', needs `smclic' extension
> +.*Warning: invalid CSR `sintstatus', needs `smclic' extension
> +.*Warning: invalid CSR `sintstatus', needs `smclic' extension
> +.*Warning: read-only CSR is written `csrw sintstatus,a1'
> +.*Warning: invalid CSR `sintthresh', needs `smclic' extension
> +.*Warning: invalid CSR `sintthresh', needs `smclic' extension
> +.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
> +.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
> +.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
> +.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
> +.*Warning: invalid CSR `utvt', needs `smclic' extension
> +.*Warning: invalid CSR `utvt', needs `smclic' extension
> +.*Warning: invalid CSR `unxti', needs `smclic' extension
> +.*Warning: invalid CSR `unxti', needs `smclic' extension
> +.*Warning: invalid CSR `uintstatus', needs `smclic' extension
> +.*Warning: invalid CSR `uintstatus', needs `smclic' extension
> +.*Warning: read-only CSR is written `csrw uintstatus,a1'
> +.*Warning: invalid CSR `uintthresh', needs `smclic' extension
> +.*Warning: invalid CSR `uintthresh', needs `smclic' extension
> +.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
> +.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
> +.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
> +.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>  .*Warning: invalid CSR `mstateen1', needs `smstateen' extension
> diff --git a/gas/testsuite/gas/riscv/csr-version-1p9p1.d b/gas/testsuite/gas/riscv/csr-version-1p9p1.d
> index 0fe849c269c2..8688fa6ecb7e 100644
> --- a/gas/testsuite/gas/riscv/csr-version-1p9p1.d
> +++ b/gas/testsuite/gas/riscv/csr-version-1p9p1.d
> @@ -623,6 +623,42 @@ 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]+:[ 	]+30702573[ 	]+csrr[ 	]+a0,mtvt
> +[ 	]+[0-9a-f]+:[ 	]+30759073[ 	]+csrw[ 	]+mtvt,a1
> +[ 	]+[0-9a-f]+:[ 	]+34502573[ 	]+csrr[ 	]+a0,mnxti
> +[ 	]+[0-9a-f]+:[ 	]+34559073[ 	]+csrw[ 	]+mnxti,a1
> +[ 	]+[0-9a-f]+:[ 	]+f4602573[ 	]+csrr[ 	]+a0,mintstatus
> +[ 	]+[0-9a-f]+:[ 	]+f4659073[ 	]+csrw[ 	]+mintstatus,a1
> +[ 	]+[0-9a-f]+:[ 	]+34702573[ 	]+csrr[ 	]+a0,mintthresh
> +[ 	]+[0-9a-f]+:[ 	]+34759073[ 	]+csrw[ 	]+mintthresh,a1
> +[ 	]+[0-9a-f]+:[ 	]+34802573[ 	]+csrr[ 	]+a0,mscratchcsw
> +[ 	]+[0-9a-f]+:[ 	]+34859073[ 	]+csrw[ 	]+mscratchcsw,a1
> +[ 	]+[0-9a-f]+:[ 	]+34902573[ 	]+csrr[ 	]+a0,mscratchcswl
> +[ 	]+[0-9a-f]+:[ 	]+34959073[ 	]+csrw[ 	]+mscratchcswl,a1
> +[ 	]+[0-9a-f]+:[ 	]+10702573[ 	]+csrr[ 	]+a0,stvt
> +[ 	]+[0-9a-f]+:[ 	]+10759073[ 	]+csrw[ 	]+stvt,a1
> +[ 	]+[0-9a-f]+:[ 	]+14502573[ 	]+csrr[ 	]+a0,snxti
> +[ 	]+[0-9a-f]+:[ 	]+14559073[ 	]+csrw[ 	]+snxti,a1
> +[ 	]+[0-9a-f]+:[ 	]+d4602573[ 	]+csrr[ 	]+a0,sintstatus
> +[ 	]+[0-9a-f]+:[ 	]+d4659073[ 	]+csrw[ 	]+sintstatus,a1
> +[ 	]+[0-9a-f]+:[ 	]+14702573[ 	]+csrr[ 	]+a0,sintthresh
> +[ 	]+[0-9a-f]+:[ 	]+14759073[ 	]+csrw[ 	]+sintthresh,a1
> +[ 	]+[0-9a-f]+:[ 	]+14802573[ 	]+csrr[ 	]+a0,sscratchcsw
> +[ 	]+[0-9a-f]+:[ 	]+14859073[ 	]+csrw[ 	]+sscratchcsw,a1
> +[ 	]+[0-9a-f]+:[ 	]+14902573[ 	]+csrr[ 	]+a0,sscratchcswl
> +[ 	]+[0-9a-f]+:[ 	]+14959073[ 	]+csrw[ 	]+sscratchcswl,a1
> +[ 	]+[0-9a-f]+:[ 	]+00702573[ 	]+csrr[ 	]+a0,utvt
> +[ 	]+[0-9a-f]+:[ 	]+00759073[ 	]+csrw[ 	]+utvt,a1
> +[ 	]+[0-9a-f]+:[ 	]+04502573[ 	]+csrr[ 	]+a0,unxti
> +[ 	]+[0-9a-f]+:[ 	]+04559073[ 	]+csrw[ 	]+unxti,a1
> +[ 	]+[0-9a-f]+:[ 	]+c4602573[ 	]+csrr[ 	]+a0,uintstatus
> +[ 	]+[0-9a-f]+:[ 	]+c4659073[ 	]+csrw[ 	]+uintstatus,a1
> +[ 	]+[0-9a-f]+:[ 	]+04702573[ 	]+csrr[ 	]+a0,uintthresh
> +[ 	]+[0-9a-f]+:[ 	]+04759073[ 	]+csrw[ 	]+uintthresh,a1
> +[ 	]+[0-9a-f]+:[ 	]+04802573[ 	]+csrr[ 	]+a0,uscratchcsw
> +[ 	]+[0-9a-f]+:[ 	]+04859073[ 	]+csrw[ 	]+uscratchcsw,a1
> +[ 	]+[0-9a-f]+:[ 	]+04902573[ 	]+csrr[ 	]+a0,uscratchcswl
> +[ 	]+[0-9a-f]+:[ 	]+04959073[ 	]+csrw[ 	]+uscratchcswl,a1
>  [ 	]+[0-9a-f]+:[ 	]+30c02573[ 	]+csrr[ 	]+a0,mstateen0
>  [ 	]+[0-9a-f]+:[ 	]+30c59073[ 	]+csrw[ 	]+mstateen0,a1
>  [ 	]+[0-9a-f]+:[ 	]+30d02573[ 	]+csrr[ 	]+a0,mstateen1
> diff --git a/gas/testsuite/gas/riscv/csr-version-1p9p1.l b/gas/testsuite/gas/riscv/csr-version-1p9p1.l
> index c65d0b48e414..22bed0aecfd0 100644
> --- a/gas/testsuite/gas/riscv/csr-version-1p9p1.l
> +++ b/gas/testsuite/gas/riscv/csr-version-1p9p1.l
> @@ -494,6 +494,45 @@
>  .*Warning: invalid CSR `miph', needs `smaia' extension
>  .*Warning: invalid CSR `miph', needs rv32i extension
>  .*Warning: invalid CSR `miph', needs `smaia' extension
> +.*Warning: invalid CSR `mtvt', needs `smclic' extension
> +.*Warning: invalid CSR `mtvt', needs `smclic' extension
> +.*Warning: invalid CSR `mnxti', needs `smclic' extension
> +.*Warning: invalid CSR `mnxti', needs `smclic' extension
> +.*Warning: invalid CSR `mintstatus', needs `smclic' extension
> +.*Warning: invalid CSR `mintstatus', needs `smclic' extension
> +.*Warning: read-only CSR is written `csrw mintstatus,a1'
> +.*Warning: invalid CSR `mintthresh', needs `smclic' extension
> +.*Warning: invalid CSR `mintthresh', needs `smclic' extension
> +.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
> +.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
> +.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
> +.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
> +.*Warning: invalid CSR `stvt', needs `smclic' extension
> +.*Warning: invalid CSR `stvt', needs `smclic' extension
> +.*Warning: invalid CSR `snxti', needs `smclic' extension
> +.*Warning: invalid CSR `snxti', needs `smclic' extension
> +.*Warning: invalid CSR `sintstatus', needs `smclic' extension
> +.*Warning: invalid CSR `sintstatus', needs `smclic' extension
> +.*Warning: read-only CSR is written `csrw sintstatus,a1'
> +.*Warning: invalid CSR `sintthresh', needs `smclic' extension
> +.*Warning: invalid CSR `sintthresh', needs `smclic' extension
> +.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
> +.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
> +.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
> +.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
> +.*Warning: invalid CSR `utvt', needs `smclic' extension
> +.*Warning: invalid CSR `utvt', needs `smclic' extension
> +.*Warning: invalid CSR `unxti', needs `smclic' extension
> +.*Warning: invalid CSR `unxti', needs `smclic' extension
> +.*Warning: invalid CSR `uintstatus', needs `smclic' extension
> +.*Warning: invalid CSR `uintstatus', needs `smclic' extension
> +.*Warning: read-only CSR is written `csrw uintstatus,a1'
> +.*Warning: invalid CSR `uintthresh', needs `smclic' extension
> +.*Warning: invalid CSR `uintthresh', needs `smclic' extension
> +.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
> +.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
> +.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
> +.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>  .*Warning: invalid CSR `mstateen1', needs `smstateen' extension
> diff --git a/gas/testsuite/gas/riscv/csr.s b/gas/testsuite/gas/riscv/csr.s
> index c7406ce34c2e..29a0710df812 100644
> --- a/gas/testsuite/gas/riscv/csr.s
> +++ b/gas/testsuite/gas/riscv/csr.s
> @@ -350,6 +350,26 @@
>  	csr mviph
>  	csr miph
>
> +	# Smclic extension
> +	csr mtvt
> +	csr mnxti
> +	csr mintstatus
> +	csr mintthresh
> +	csr mscratchcsw
> +	csr mscratchcswl
> +	csr stvt
> +	csr snxti
> +	csr sintstatus
> +	csr sintthresh
> +	csr sscratchcsw
> +	csr sscratchcswl
> +	csr utvt
> +	csr unxti
> +	csr uintstatus
> +	csr uintthresh
> +	csr uscratchcsw
> +	csr uscratchcswl
> +
>  	# Smstateen/Ssstateen extensions
>  	csr mstateen0
>  	csr mstateen1
> diff --git a/include/opcode/riscv-opc.h b/include/opcode/riscv-opc.h
> index 06e3df0f5a63..3f072bf01b3c 100644
> --- a/include/opcode/riscv-opc.h
> +++ b/include/opcode/riscv-opc.h
> @@ -2673,6 +2673,25 @@
>  #define CSR_MVIENH   0x318
>  #define CSR_MVIPH    0x319
>  #define CSR_MIPH     0x354
> +/* Smclic extension CSR addresses (including user interrupts).  */
> +#define CSR_MTVT 0x307
> +#define CSR_MNXTI 0x345
> +#define CSR_MINTSTATUS 0xf46
> +#define CSR_MINTTHRESH 0x347
> +#define CSR_MSCRATCHCSW 0x348
> +#define CSR_MSCRATCHCSWL 0x349
> +#define CSR_STVT 0x107
> +#define CSR_SNXTI 0x145
> +#define CSR_SINTSTATUS 0xd46
> +#define CSR_SINTTHRESH 0x147
> +#define CSR_SSCRATCHCSW 0x148
> +#define CSR_SSCRATCHCSWL 0x149
> +#define CSR_UTVT 0x7
> +#define CSR_UNXTI 0x45
> +#define CSR_UINTSTATUS 0xc46
> +#define CSR_UINTTHRESH 0x47
> +#define CSR_USCRATCHCSW 0x48
> +#define CSR_USCRATCHCSWL 0x49
>  /* Smstateen extension */
>  #define CSR_MSTATEEN0 0x30c
>  #define CSR_MSTATEEN1 0x30d
> @@ -3550,6 +3569,25 @@ 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)
> +/* Smclic extension CSRs (including user interrupts).  */
> +DECLARE_CSR(mtvt, CSR_MTVT, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(mnxti, CSR_MNXTI, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(mintstatus, CSR_MINTSTATUS, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(mintthresh, CSR_MINTTHRESH, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(mscratchcsw, CSR_MSCRATCHCSW, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(mscratchcswl, CSR_MSCRATCHCSWL, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(stvt, CSR_STVT, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(snxti, CSR_SNXTI, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(sintstatus, CSR_SINTSTATUS, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(sintthresh, CSR_SINTTHRESH, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(sscratchcsw, CSR_SSCRATCHCSW, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(sscratchcswl, CSR_SSCRATCHCSWL, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(utvt, CSR_UTVT, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(unxti, CSR_UNXTI, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(uintstatus, CSR_UINTSTATUS, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(uintthresh, CSR_UINTTHRESH, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(uscratchcsw, CSR_USCRATCHCSW, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(uscratchcswl, CSR_USCRATCHCSWL, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>  /* 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)

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

* Re: [REVIEW ONLY 1/1] UNRATIFIED RISC-V: Add 'Smclic' extension and its CSRs
  2022-11-29  2:03   ` Palmer Dabbelt
@ 2022-11-29  2:16     ` Tsukasa OI
  2022-11-29  2:43       ` Palmer Dabbelt
  0 siblings, 1 reply; 7+ messages in thread
From: Tsukasa OI @ 2022-11-29  2:16 UTC (permalink / raw)
  To: Palmer Dabbelt, binutils

On 2022/11/29 11:03, Palmer Dabbelt wrote:
> On Mon, 28 Nov 2022 17:19:53 PST (-0800), binutils@sourceware.org wrote:
>> From: Tsukasa OI <research_trasio@irq.a4lg.com>
>>
>> [DO NOT MERGE]
>> Until 'Smclic' extension is frozen/ratified and final version number is
>> determined, this patch should not be merged upstream.  This commit uses
>> unratified version 0.9 as in the documentation (instead of possible 1.0
>> after ratification).
>>
>> [RFC]
>> It implements u* CSRs as supported in all privileged architectures.
>> Since user-mode interrupt is dropped, we might need to mask or remove them.
> 
> Looks like there's some issues related to these, though it's not super 
> clear what the plan is 
> <https://github.com/riscv/riscv-fast-interrupt/issues/160>.  Probably 
> best to just wait until it's frozen to sort that out?

Yes, that's probably the best idea.  This is based on a document in the
"Development" state but even "Stable" documents have a difference: the
one very likely to change before ratification and the one not so likely
to change.

For instance, I consider that "RISC-V Profiles" documentation likely to
change before ratification [including extension names that we toolchain
developers consider important].  That's why I'm not committing RISC-V
Profiles-related changes except 'Ssstateen' (this is discussed even
outside the profiles).

Additional reference:
<https://github.com/riscv/riscv-fast-interrupt/issues/200>

Tsukasa

> 
>>
>> This commit adds CSR support for the 'Smclic' extension, a part of Core-
>> Local Interrupt Controller (CLIC) extension.
>>
>> This is based on the latest Core-Local Interrupt Controller (CLIC)
>> extension draft (version 0.9-draft):
>> <https://github.com/riscv/riscv-fast-interrupt/blob/e601b94bf43af0e9842b20134814404e488511e3/clic.pdf>
>>
>> bfd/ChangeLog:
>>
>> 	* elfxx-riscv.c (riscv_implicit_subsets): Add implication from
>> 	'Smclic' to 'Zicsr'.  (riscv_supported_std_s_ext) Add 'Smclic'.
>>
>> gas/ChangeLog:
>>
>> 	* config/tc-riscv.c (enum riscv_csr_class): Add new CSR class.
>> 	(riscv_csr_address): Add new CSR class handling.
>> 	* testsuite/gas/riscv/csr.s: Add new CSR test.
>> 	* testsuite/gas/riscv/csr-dw-regnums.s: Likewise.
>> 	* testsuite/gas/riscv/csr-dw-regnums.d: Likewise.
>> 	* 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_MTVT, CSR_MNXTI, CSR_MINTSTATUS,
>> 	CSR_MINTTHRESH, CSR_MSCRATCHCSW, CSR_MSCRATCHCSWL, CSR_STVT,
>> 	CSR_SNXTI, CSR_SINTSTATUS, CSR_SINTTHRESH, CSR_SSCRATCHCSW,
>> 	CSR_SSCRATCHCSWL, CSR_UTVT, CSR_UNXTI, CSR_UINTSTATUS,
>> 	CSR_UINTTHRESH, CSR_USCRATCHCSW, CSR_USCRATCHCSWL): New.
>> ---
>>  bfd/elfxx-riscv.c                           |  2 ++
>>  gas/config/tc-riscv.c                       |  4 +++
>>  gas/testsuite/gas/riscv/csr-dw-regnums.d    | 18 ++++++++++
>>  gas/testsuite/gas/riscv/csr-dw-regnums.s    | 19 ++++++++++
>>  gas/testsuite/gas/riscv/csr-version-1p10.d  | 36 +++++++++++++++++++
>>  gas/testsuite/gas/riscv/csr-version-1p10.l  | 39 +++++++++++++++++++++
>>  gas/testsuite/gas/riscv/csr-version-1p11.d  | 36 +++++++++++++++++++
>>  gas/testsuite/gas/riscv/csr-version-1p11.l  | 39 +++++++++++++++++++++
>>  gas/testsuite/gas/riscv/csr-version-1p12.d  | 36 +++++++++++++++++++
>>  gas/testsuite/gas/riscv/csr-version-1p12.l  | 39 +++++++++++++++++++++
>>  gas/testsuite/gas/riscv/csr-version-1p9p1.d | 36 +++++++++++++++++++
>>  gas/testsuite/gas/riscv/csr-version-1p9p1.l | 39 +++++++++++++++++++++
>>  gas/testsuite/gas/riscv/csr.s               | 20 +++++++++++
>>  include/opcode/riscv-opc.h                  | 38 ++++++++++++++++++++
>>  14 files changed, 401 insertions(+)
>>
>> diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
>> index 0bcf2fdcfa34..6c60cf7c888e 100644
>> --- a/bfd/elfxx-riscv.c
>> +++ b/bfd/elfxx-riscv.c
>> @@ -1103,6 +1103,7 @@ static struct riscv_implicit_subset riscv_implicit_subsets[] =
>>    {"zks", "zksh",	check_implicit_always},
>>    {"smaia", "ssaia",		check_implicit_always},
>>    {"smstateen", "ssstateen",	check_implicit_always},
>> +  {"smclic", "zicsr",		check_implicit_always},
>>    {"smepmp", "zicsr",		check_implicit_always},
>>    {"ssaia", "zicsr",		check_implicit_always},
>>    {"sscofpmf", "zicsr",		check_implicit_always},
>> @@ -1224,6 +1225,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 },
>> +  {"smclic",		ISA_SPEC_CLASS_DRAFT,		0, 9, 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 0682eb355241..e90e0ba53987 100644
>> --- a/gas/config/tc-riscv.c
>> +++ b/gas/config/tc-riscv.c
>> @@ -74,6 +74,7 @@ enum riscv_csr_class
>>    CSR_CLASS_H_32,	/* hypervisor, rv32 only */
>>    CSR_CLASS_SMAIA,		/* Smaia */
>>    CSR_CLASS_SMAIA_32,		/* Smaia, rv32 only */
>> +  CSR_CLASS_SMCLIC,		/* Smclic only */
>>    CSR_CLASS_SMSTATEEN,		/* Smstateen only */
>>    CSR_CLASS_SMSTATEEN_32,	/* Smstateen RV32 only */
>>    CSR_CLASS_SSAIA,		/* Ssaia */
>> @@ -1049,6 +1050,9 @@ riscv_csr_address (const char *csr_name,
>>      case CSR_CLASS_SMAIA:
>>        extension = "smaia";
>>        break;
>> +    case CSR_CLASS_SMCLIC:
>> +      extension = "smclic";
>> +      break;
>>      case CSR_CLASS_SMSTATEEN:
>>      case CSR_CLASS_SMSTATEEN_32:
>>        is_rv32_only = (csr_class == CSR_CLASS_SMSTATEEN_32);
>> diff --git a/gas/testsuite/gas/riscv/csr-dw-regnums.d b/gas/testsuite/gas/riscv/csr-dw-regnums.d
>> index fd830666ab89..2b58c6a955b1 100644
>> --- a/gas/testsuite/gas/riscv/csr-dw-regnums.d
>> +++ b/gas/testsuite/gas/riscv/csr-dw-regnums.d
>> @@ -324,6 +324,24 @@ 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: r4871 \(mtvt\) at cfa\+3100
>> +  DW_CFA_offset_extended_sf: r4933 \(mnxti\) at cfa\+3348
>> +  DW_CFA_offset_extended_sf: r8006 \(mintstatus\) at cfa\+15640
>> +  DW_CFA_offset_extended_sf: r4935 \(mintthresh\) at cfa\+3356
>> +  DW_CFA_offset_extended_sf: r4936 \(mscratchcsw\) at cfa\+3360
>> +  DW_CFA_offset_extended_sf: r4937 \(mscratchcswl\) at cfa\+3364
>> +  DW_CFA_offset_extended_sf: r4359 \(stvt\) at cfa\+1052
>> +  DW_CFA_offset_extended_sf: r4421 \(snxti\) at cfa\+1300
>> +  DW_CFA_offset_extended_sf: r7494 \(sintstatus\) at cfa\+13592
>> +  DW_CFA_offset_extended_sf: r4423 \(sintthresh\) at cfa\+1308
>> +  DW_CFA_offset_extended_sf: r4424 \(sscratchcsw\) at cfa\+1312
>> +  DW_CFA_offset_extended_sf: r4425 \(sscratchcswl\) at cfa\+1316
>> +  DW_CFA_offset_extended_sf: r4103 \(utvt\) at cfa\+28
>> +  DW_CFA_offset_extended_sf: r4165 \(unxti\) at cfa\+276
>> +  DW_CFA_offset_extended_sf: r7238 \(uintstatus\) at cfa\+12568
>> +  DW_CFA_offset_extended_sf: r4167 \(uintthresh\) at cfa\+284
>> +  DW_CFA_offset_extended_sf: r4168 \(uscratchcsw\) at cfa\+288
>> +  DW_CFA_offset_extended_sf: r4169 \(uscratchcswl\) at cfa\+292
>>    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
>> diff --git a/gas/testsuite/gas/riscv/csr-dw-regnums.s b/gas/testsuite/gas/riscv/csr-dw-regnums.s
>> index b8b0f7902297..af1158eb0089 100644
>> --- a/gas/testsuite/gas/riscv/csr-dw-regnums.s
>> +++ b/gas/testsuite/gas/riscv/csr-dw-regnums.s
>> @@ -321,6 +321,25 @@ _start:
>>  	.cfi_offset mvienh, 3168
>>  	.cfi_offset mviph, 3172
>>  	.cfi_offset miph, 3408
>> +	# Smclic extension
>> +	.cfi_offset mtvt, 3100
>> +	.cfi_offset mnxti, 3348
>> +	.cfi_offset mintstatus, 15640
>> +	.cfi_offset mintthresh, 3356
>> +	.cfi_offset mscratchcsw, 3360
>> +	.cfi_offset mscratchcswl, 3364
>> +	.cfi_offset stvt, 1052
>> +	.cfi_offset snxti, 1300
>> +	.cfi_offset sintstatus, 13592
>> +	.cfi_offset sintthresh, 1308
>> +	.cfi_offset sscratchcsw, 1312
>> +	.cfi_offset sscratchcswl, 1316
>> +	.cfi_offset utvt, 28
>> +	.cfi_offset unxti, 276
>> +	.cfi_offset uintstatus, 12568
>> +	.cfi_offset uintthresh, 284
>> +	.cfi_offset uscratchcsw, 288
>> +	.cfi_offset uscratchcswl, 292
>>  	# Smstateen extension
>>  	.cfi_offset mstateen0, 3120
>>  	.cfi_offset mstateen1, 3124
>> diff --git a/gas/testsuite/gas/riscv/csr-version-1p10.d b/gas/testsuite/gas/riscv/csr-version-1p10.d
>> index ee41e1025cce..aa116a75fadd 100644
>> --- a/gas/testsuite/gas/riscv/csr-version-1p10.d
>> +++ b/gas/testsuite/gas/riscv/csr-version-1p10.d
>> @@ -623,6 +623,42 @@ 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]+:[ 	]+30702573[ 	]+csrr[ 	]+a0,mtvt
>> +[ 	]+[0-9a-f]+:[ 	]+30759073[ 	]+csrw[ 	]+mtvt,a1
>> +[ 	]+[0-9a-f]+:[ 	]+34502573[ 	]+csrr[ 	]+a0,mnxti
>> +[ 	]+[0-9a-f]+:[ 	]+34559073[ 	]+csrw[ 	]+mnxti,a1
>> +[ 	]+[0-9a-f]+:[ 	]+f4602573[ 	]+csrr[ 	]+a0,mintstatus
>> +[ 	]+[0-9a-f]+:[ 	]+f4659073[ 	]+csrw[ 	]+mintstatus,a1
>> +[ 	]+[0-9a-f]+:[ 	]+34702573[ 	]+csrr[ 	]+a0,mintthresh
>> +[ 	]+[0-9a-f]+:[ 	]+34759073[ 	]+csrw[ 	]+mintthresh,a1
>> +[ 	]+[0-9a-f]+:[ 	]+34802573[ 	]+csrr[ 	]+a0,mscratchcsw
>> +[ 	]+[0-9a-f]+:[ 	]+34859073[ 	]+csrw[ 	]+mscratchcsw,a1
>> +[ 	]+[0-9a-f]+:[ 	]+34902573[ 	]+csrr[ 	]+a0,mscratchcswl
>> +[ 	]+[0-9a-f]+:[ 	]+34959073[ 	]+csrw[ 	]+mscratchcswl,a1
>> +[ 	]+[0-9a-f]+:[ 	]+10702573[ 	]+csrr[ 	]+a0,stvt
>> +[ 	]+[0-9a-f]+:[ 	]+10759073[ 	]+csrw[ 	]+stvt,a1
>> +[ 	]+[0-9a-f]+:[ 	]+14502573[ 	]+csrr[ 	]+a0,snxti
>> +[ 	]+[0-9a-f]+:[ 	]+14559073[ 	]+csrw[ 	]+snxti,a1
>> +[ 	]+[0-9a-f]+:[ 	]+d4602573[ 	]+csrr[ 	]+a0,sintstatus
>> +[ 	]+[0-9a-f]+:[ 	]+d4659073[ 	]+csrw[ 	]+sintstatus,a1
>> +[ 	]+[0-9a-f]+:[ 	]+14702573[ 	]+csrr[ 	]+a0,sintthresh
>> +[ 	]+[0-9a-f]+:[ 	]+14759073[ 	]+csrw[ 	]+sintthresh,a1
>> +[ 	]+[0-9a-f]+:[ 	]+14802573[ 	]+csrr[ 	]+a0,sscratchcsw
>> +[ 	]+[0-9a-f]+:[ 	]+14859073[ 	]+csrw[ 	]+sscratchcsw,a1
>> +[ 	]+[0-9a-f]+:[ 	]+14902573[ 	]+csrr[ 	]+a0,sscratchcswl
>> +[ 	]+[0-9a-f]+:[ 	]+14959073[ 	]+csrw[ 	]+sscratchcswl,a1
>> +[ 	]+[0-9a-f]+:[ 	]+00702573[ 	]+csrr[ 	]+a0,utvt
>> +[ 	]+[0-9a-f]+:[ 	]+00759073[ 	]+csrw[ 	]+utvt,a1
>> +[ 	]+[0-9a-f]+:[ 	]+04502573[ 	]+csrr[ 	]+a0,unxti
>> +[ 	]+[0-9a-f]+:[ 	]+04559073[ 	]+csrw[ 	]+unxti,a1
>> +[ 	]+[0-9a-f]+:[ 	]+c4602573[ 	]+csrr[ 	]+a0,uintstatus
>> +[ 	]+[0-9a-f]+:[ 	]+c4659073[ 	]+csrw[ 	]+uintstatus,a1
>> +[ 	]+[0-9a-f]+:[ 	]+04702573[ 	]+csrr[ 	]+a0,uintthresh
>> +[ 	]+[0-9a-f]+:[ 	]+04759073[ 	]+csrw[ 	]+uintthresh,a1
>> +[ 	]+[0-9a-f]+:[ 	]+04802573[ 	]+csrr[ 	]+a0,uscratchcsw
>> +[ 	]+[0-9a-f]+:[ 	]+04859073[ 	]+csrw[ 	]+uscratchcsw,a1
>> +[ 	]+[0-9a-f]+:[ 	]+04902573[ 	]+csrr[ 	]+a0,uscratchcswl
>> +[ 	]+[0-9a-f]+:[ 	]+04959073[ 	]+csrw[ 	]+uscratchcswl,a1
>>  [ 	]+[0-9a-f]+:[ 	]+30c02573[ 	]+csrr[ 	]+a0,mstateen0
>>  [ 	]+[0-9a-f]+:[ 	]+30c59073[ 	]+csrw[ 	]+mstateen0,a1
>>  [ 	]+[0-9a-f]+:[ 	]+30d02573[ 	]+csrr[ 	]+a0,mstateen1
>> diff --git a/gas/testsuite/gas/riscv/csr-version-1p10.l b/gas/testsuite/gas/riscv/csr-version-1p10.l
>> index e677b78b8bb8..15431cef4590 100644
>> --- a/gas/testsuite/gas/riscv/csr-version-1p10.l
>> +++ b/gas/testsuite/gas/riscv/csr-version-1p10.l
>> @@ -444,6 +444,45 @@
>>  .*Warning: invalid CSR `miph', needs `smaia' extension
>>  .*Warning: invalid CSR `miph', needs rv32i extension
>>  .*Warning: invalid CSR `miph', needs `smaia' extension
>> +.*Warning: invalid CSR `mtvt', needs `smclic' extension
>> +.*Warning: invalid CSR `mtvt', needs `smclic' extension
>> +.*Warning: invalid CSR `mnxti', needs `smclic' extension
>> +.*Warning: invalid CSR `mnxti', needs `smclic' extension
>> +.*Warning: invalid CSR `mintstatus', needs `smclic' extension
>> +.*Warning: invalid CSR `mintstatus', needs `smclic' extension
>> +.*Warning: read-only CSR is written `csrw mintstatus,a1'
>> +.*Warning: invalid CSR `mintthresh', needs `smclic' extension
>> +.*Warning: invalid CSR `mintthresh', needs `smclic' extension
>> +.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
>> +.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
>> +.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
>> +.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
>> +.*Warning: invalid CSR `stvt', needs `smclic' extension
>> +.*Warning: invalid CSR `stvt', needs `smclic' extension
>> +.*Warning: invalid CSR `snxti', needs `smclic' extension
>> +.*Warning: invalid CSR `snxti', needs `smclic' extension
>> +.*Warning: invalid CSR `sintstatus', needs `smclic' extension
>> +.*Warning: invalid CSR `sintstatus', needs `smclic' extension
>> +.*Warning: read-only CSR is written `csrw sintstatus,a1'
>> +.*Warning: invalid CSR `sintthresh', needs `smclic' extension
>> +.*Warning: invalid CSR `sintthresh', needs `smclic' extension
>> +.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
>> +.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
>> +.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
>> +.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
>> +.*Warning: invalid CSR `utvt', needs `smclic' extension
>> +.*Warning: invalid CSR `utvt', needs `smclic' extension
>> +.*Warning: invalid CSR `unxti', needs `smclic' extension
>> +.*Warning: invalid CSR `unxti', needs `smclic' extension
>> +.*Warning: invalid CSR `uintstatus', needs `smclic' extension
>> +.*Warning: invalid CSR `uintstatus', needs `smclic' extension
>> +.*Warning: read-only CSR is written `csrw uintstatus,a1'
>> +.*Warning: invalid CSR `uintthresh', needs `smclic' extension
>> +.*Warning: invalid CSR `uintthresh', needs `smclic' extension
>> +.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
>> +.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
>> +.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
>> +.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
>>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>>  .*Warning: invalid CSR `mstateen1', needs `smstateen' extension
>> diff --git a/gas/testsuite/gas/riscv/csr-version-1p11.d b/gas/testsuite/gas/riscv/csr-version-1p11.d
>> index a83b1bf68f98..c7af6b7cafac 100644
>> --- a/gas/testsuite/gas/riscv/csr-version-1p11.d
>> +++ b/gas/testsuite/gas/riscv/csr-version-1p11.d
>> @@ -623,6 +623,42 @@ 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]+:[ 	]+30702573[ 	]+csrr[ 	]+a0,mtvt
>> +[ 	]+[0-9a-f]+:[ 	]+30759073[ 	]+csrw[ 	]+mtvt,a1
>> +[ 	]+[0-9a-f]+:[ 	]+34502573[ 	]+csrr[ 	]+a0,mnxti
>> +[ 	]+[0-9a-f]+:[ 	]+34559073[ 	]+csrw[ 	]+mnxti,a1
>> +[ 	]+[0-9a-f]+:[ 	]+f4602573[ 	]+csrr[ 	]+a0,mintstatus
>> +[ 	]+[0-9a-f]+:[ 	]+f4659073[ 	]+csrw[ 	]+mintstatus,a1
>> +[ 	]+[0-9a-f]+:[ 	]+34702573[ 	]+csrr[ 	]+a0,mintthresh
>> +[ 	]+[0-9a-f]+:[ 	]+34759073[ 	]+csrw[ 	]+mintthresh,a1
>> +[ 	]+[0-9a-f]+:[ 	]+34802573[ 	]+csrr[ 	]+a0,mscratchcsw
>> +[ 	]+[0-9a-f]+:[ 	]+34859073[ 	]+csrw[ 	]+mscratchcsw,a1
>> +[ 	]+[0-9a-f]+:[ 	]+34902573[ 	]+csrr[ 	]+a0,mscratchcswl
>> +[ 	]+[0-9a-f]+:[ 	]+34959073[ 	]+csrw[ 	]+mscratchcswl,a1
>> +[ 	]+[0-9a-f]+:[ 	]+10702573[ 	]+csrr[ 	]+a0,stvt
>> +[ 	]+[0-9a-f]+:[ 	]+10759073[ 	]+csrw[ 	]+stvt,a1
>> +[ 	]+[0-9a-f]+:[ 	]+14502573[ 	]+csrr[ 	]+a0,snxti
>> +[ 	]+[0-9a-f]+:[ 	]+14559073[ 	]+csrw[ 	]+snxti,a1
>> +[ 	]+[0-9a-f]+:[ 	]+d4602573[ 	]+csrr[ 	]+a0,sintstatus
>> +[ 	]+[0-9a-f]+:[ 	]+d4659073[ 	]+csrw[ 	]+sintstatus,a1
>> +[ 	]+[0-9a-f]+:[ 	]+14702573[ 	]+csrr[ 	]+a0,sintthresh
>> +[ 	]+[0-9a-f]+:[ 	]+14759073[ 	]+csrw[ 	]+sintthresh,a1
>> +[ 	]+[0-9a-f]+:[ 	]+14802573[ 	]+csrr[ 	]+a0,sscratchcsw
>> +[ 	]+[0-9a-f]+:[ 	]+14859073[ 	]+csrw[ 	]+sscratchcsw,a1
>> +[ 	]+[0-9a-f]+:[ 	]+14902573[ 	]+csrr[ 	]+a0,sscratchcswl
>> +[ 	]+[0-9a-f]+:[ 	]+14959073[ 	]+csrw[ 	]+sscratchcswl,a1
>> +[ 	]+[0-9a-f]+:[ 	]+00702573[ 	]+csrr[ 	]+a0,utvt
>> +[ 	]+[0-9a-f]+:[ 	]+00759073[ 	]+csrw[ 	]+utvt,a1
>> +[ 	]+[0-9a-f]+:[ 	]+04502573[ 	]+csrr[ 	]+a0,unxti
>> +[ 	]+[0-9a-f]+:[ 	]+04559073[ 	]+csrw[ 	]+unxti,a1
>> +[ 	]+[0-9a-f]+:[ 	]+c4602573[ 	]+csrr[ 	]+a0,uintstatus
>> +[ 	]+[0-9a-f]+:[ 	]+c4659073[ 	]+csrw[ 	]+uintstatus,a1
>> +[ 	]+[0-9a-f]+:[ 	]+04702573[ 	]+csrr[ 	]+a0,uintthresh
>> +[ 	]+[0-9a-f]+:[ 	]+04759073[ 	]+csrw[ 	]+uintthresh,a1
>> +[ 	]+[0-9a-f]+:[ 	]+04802573[ 	]+csrr[ 	]+a0,uscratchcsw
>> +[ 	]+[0-9a-f]+:[ 	]+04859073[ 	]+csrw[ 	]+uscratchcsw,a1
>> +[ 	]+[0-9a-f]+:[ 	]+04902573[ 	]+csrr[ 	]+a0,uscratchcswl
>> +[ 	]+[0-9a-f]+:[ 	]+04959073[ 	]+csrw[ 	]+uscratchcswl,a1
>>  [ 	]+[0-9a-f]+:[ 	]+30c02573[ 	]+csrr[ 	]+a0,mstateen0
>>  [ 	]+[0-9a-f]+:[ 	]+30c59073[ 	]+csrw[ 	]+mstateen0,a1
>>  [ 	]+[0-9a-f]+:[ 	]+30d02573[ 	]+csrr[ 	]+a0,mstateen1
>> diff --git a/gas/testsuite/gas/riscv/csr-version-1p11.l b/gas/testsuite/gas/riscv/csr-version-1p11.l
>> index 81ca86ca7bcc..94c3142c07ff 100644
>> --- a/gas/testsuite/gas/riscv/csr-version-1p11.l
>> +++ b/gas/testsuite/gas/riscv/csr-version-1p11.l
>> @@ -442,6 +442,45 @@
>>  .*Warning: invalid CSR `miph', needs `smaia' extension
>>  .*Warning: invalid CSR `miph', needs rv32i extension
>>  .*Warning: invalid CSR `miph', needs `smaia' extension
>> +.*Warning: invalid CSR `mtvt', needs `smclic' extension
>> +.*Warning: invalid CSR `mtvt', needs `smclic' extension
>> +.*Warning: invalid CSR `mnxti', needs `smclic' extension
>> +.*Warning: invalid CSR `mnxti', needs `smclic' extension
>> +.*Warning: invalid CSR `mintstatus', needs `smclic' extension
>> +.*Warning: invalid CSR `mintstatus', needs `smclic' extension
>> +.*Warning: read-only CSR is written `csrw mintstatus,a1'
>> +.*Warning: invalid CSR `mintthresh', needs `smclic' extension
>> +.*Warning: invalid CSR `mintthresh', needs `smclic' extension
>> +.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
>> +.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
>> +.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
>> +.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
>> +.*Warning: invalid CSR `stvt', needs `smclic' extension
>> +.*Warning: invalid CSR `stvt', needs `smclic' extension
>> +.*Warning: invalid CSR `snxti', needs `smclic' extension
>> +.*Warning: invalid CSR `snxti', needs `smclic' extension
>> +.*Warning: invalid CSR `sintstatus', needs `smclic' extension
>> +.*Warning: invalid CSR `sintstatus', needs `smclic' extension
>> +.*Warning: read-only CSR is written `csrw sintstatus,a1'
>> +.*Warning: invalid CSR `sintthresh', needs `smclic' extension
>> +.*Warning: invalid CSR `sintthresh', needs `smclic' extension
>> +.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
>> +.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
>> +.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
>> +.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
>> +.*Warning: invalid CSR `utvt', needs `smclic' extension
>> +.*Warning: invalid CSR `utvt', needs `smclic' extension
>> +.*Warning: invalid CSR `unxti', needs `smclic' extension
>> +.*Warning: invalid CSR `unxti', needs `smclic' extension
>> +.*Warning: invalid CSR `uintstatus', needs `smclic' extension
>> +.*Warning: invalid CSR `uintstatus', needs `smclic' extension
>> +.*Warning: read-only CSR is written `csrw uintstatus,a1'
>> +.*Warning: invalid CSR `uintthresh', needs `smclic' extension
>> +.*Warning: invalid CSR `uintthresh', needs `smclic' extension
>> +.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
>> +.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
>> +.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
>> +.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
>>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>>  .*Warning: invalid CSR `mstateen1', needs `smstateen' extension
>> diff --git a/gas/testsuite/gas/riscv/csr-version-1p12.d b/gas/testsuite/gas/riscv/csr-version-1p12.d
>> index 612aac280768..357f9ae1a626 100644
>> --- a/gas/testsuite/gas/riscv/csr-version-1p12.d
>> +++ b/gas/testsuite/gas/riscv/csr-version-1p12.d
>> @@ -623,6 +623,42 @@ 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]+:[ 	]+30702573[ 	]+csrr[ 	]+a0,mtvt
>> +[ 	]+[0-9a-f]+:[ 	]+30759073[ 	]+csrw[ 	]+mtvt,a1
>> +[ 	]+[0-9a-f]+:[ 	]+34502573[ 	]+csrr[ 	]+a0,mnxti
>> +[ 	]+[0-9a-f]+:[ 	]+34559073[ 	]+csrw[ 	]+mnxti,a1
>> +[ 	]+[0-9a-f]+:[ 	]+f4602573[ 	]+csrr[ 	]+a0,mintstatus
>> +[ 	]+[0-9a-f]+:[ 	]+f4659073[ 	]+csrw[ 	]+mintstatus,a1
>> +[ 	]+[0-9a-f]+:[ 	]+34702573[ 	]+csrr[ 	]+a0,mintthresh
>> +[ 	]+[0-9a-f]+:[ 	]+34759073[ 	]+csrw[ 	]+mintthresh,a1
>> +[ 	]+[0-9a-f]+:[ 	]+34802573[ 	]+csrr[ 	]+a0,mscratchcsw
>> +[ 	]+[0-9a-f]+:[ 	]+34859073[ 	]+csrw[ 	]+mscratchcsw,a1
>> +[ 	]+[0-9a-f]+:[ 	]+34902573[ 	]+csrr[ 	]+a0,mscratchcswl
>> +[ 	]+[0-9a-f]+:[ 	]+34959073[ 	]+csrw[ 	]+mscratchcswl,a1
>> +[ 	]+[0-9a-f]+:[ 	]+10702573[ 	]+csrr[ 	]+a0,stvt
>> +[ 	]+[0-9a-f]+:[ 	]+10759073[ 	]+csrw[ 	]+stvt,a1
>> +[ 	]+[0-9a-f]+:[ 	]+14502573[ 	]+csrr[ 	]+a0,snxti
>> +[ 	]+[0-9a-f]+:[ 	]+14559073[ 	]+csrw[ 	]+snxti,a1
>> +[ 	]+[0-9a-f]+:[ 	]+d4602573[ 	]+csrr[ 	]+a0,sintstatus
>> +[ 	]+[0-9a-f]+:[ 	]+d4659073[ 	]+csrw[ 	]+sintstatus,a1
>> +[ 	]+[0-9a-f]+:[ 	]+14702573[ 	]+csrr[ 	]+a0,sintthresh
>> +[ 	]+[0-9a-f]+:[ 	]+14759073[ 	]+csrw[ 	]+sintthresh,a1
>> +[ 	]+[0-9a-f]+:[ 	]+14802573[ 	]+csrr[ 	]+a0,sscratchcsw
>> +[ 	]+[0-9a-f]+:[ 	]+14859073[ 	]+csrw[ 	]+sscratchcsw,a1
>> +[ 	]+[0-9a-f]+:[ 	]+14902573[ 	]+csrr[ 	]+a0,sscratchcswl
>> +[ 	]+[0-9a-f]+:[ 	]+14959073[ 	]+csrw[ 	]+sscratchcswl,a1
>> +[ 	]+[0-9a-f]+:[ 	]+00702573[ 	]+csrr[ 	]+a0,utvt
>> +[ 	]+[0-9a-f]+:[ 	]+00759073[ 	]+csrw[ 	]+utvt,a1
>> +[ 	]+[0-9a-f]+:[ 	]+04502573[ 	]+csrr[ 	]+a0,unxti
>> +[ 	]+[0-9a-f]+:[ 	]+04559073[ 	]+csrw[ 	]+unxti,a1
>> +[ 	]+[0-9a-f]+:[ 	]+c4602573[ 	]+csrr[ 	]+a0,uintstatus
>> +[ 	]+[0-9a-f]+:[ 	]+c4659073[ 	]+csrw[ 	]+uintstatus,a1
>> +[ 	]+[0-9a-f]+:[ 	]+04702573[ 	]+csrr[ 	]+a0,uintthresh
>> +[ 	]+[0-9a-f]+:[ 	]+04759073[ 	]+csrw[ 	]+uintthresh,a1
>> +[ 	]+[0-9a-f]+:[ 	]+04802573[ 	]+csrr[ 	]+a0,uscratchcsw
>> +[ 	]+[0-9a-f]+:[ 	]+04859073[ 	]+csrw[ 	]+uscratchcsw,a1
>> +[ 	]+[0-9a-f]+:[ 	]+04902573[ 	]+csrr[ 	]+a0,uscratchcswl
>> +[ 	]+[0-9a-f]+:[ 	]+04959073[ 	]+csrw[ 	]+uscratchcswl,a1
>>  [ 	]+[0-9a-f]+:[ 	]+30c02573[ 	]+csrr[ 	]+a0,mstateen0
>>  [ 	]+[0-9a-f]+:[ 	]+30c59073[ 	]+csrw[ 	]+mstateen0,a1
>>  [ 	]+[0-9a-f]+:[ 	]+30d02573[ 	]+csrr[ 	]+a0,mstateen1
>> diff --git a/gas/testsuite/gas/riscv/csr-version-1p12.l b/gas/testsuite/gas/riscv/csr-version-1p12.l
>> index 1c0bb4ef2d8f..1655fe4ce833 100644
>> --- a/gas/testsuite/gas/riscv/csr-version-1p12.l
>> +++ b/gas/testsuite/gas/riscv/csr-version-1p12.l
>> @@ -304,6 +304,45 @@
>>  .*Warning: invalid CSR `miph', needs `smaia' extension
>>  .*Warning: invalid CSR `miph', needs rv32i extension
>>  .*Warning: invalid CSR `miph', needs `smaia' extension
>> +.*Warning: invalid CSR `mtvt', needs `smclic' extension
>> +.*Warning: invalid CSR `mtvt', needs `smclic' extension
>> +.*Warning: invalid CSR `mnxti', needs `smclic' extension
>> +.*Warning: invalid CSR `mnxti', needs `smclic' extension
>> +.*Warning: invalid CSR `mintstatus', needs `smclic' extension
>> +.*Warning: invalid CSR `mintstatus', needs `smclic' extension
>> +.*Warning: read-only CSR is written `csrw mintstatus,a1'
>> +.*Warning: invalid CSR `mintthresh', needs `smclic' extension
>> +.*Warning: invalid CSR `mintthresh', needs `smclic' extension
>> +.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
>> +.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
>> +.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
>> +.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
>> +.*Warning: invalid CSR `stvt', needs `smclic' extension
>> +.*Warning: invalid CSR `stvt', needs `smclic' extension
>> +.*Warning: invalid CSR `snxti', needs `smclic' extension
>> +.*Warning: invalid CSR `snxti', needs `smclic' extension
>> +.*Warning: invalid CSR `sintstatus', needs `smclic' extension
>> +.*Warning: invalid CSR `sintstatus', needs `smclic' extension
>> +.*Warning: read-only CSR is written `csrw sintstatus,a1'
>> +.*Warning: invalid CSR `sintthresh', needs `smclic' extension
>> +.*Warning: invalid CSR `sintthresh', needs `smclic' extension
>> +.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
>> +.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
>> +.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
>> +.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
>> +.*Warning: invalid CSR `utvt', needs `smclic' extension
>> +.*Warning: invalid CSR `utvt', needs `smclic' extension
>> +.*Warning: invalid CSR `unxti', needs `smclic' extension
>> +.*Warning: invalid CSR `unxti', needs `smclic' extension
>> +.*Warning: invalid CSR `uintstatus', needs `smclic' extension
>> +.*Warning: invalid CSR `uintstatus', needs `smclic' extension
>> +.*Warning: read-only CSR is written `csrw uintstatus,a1'
>> +.*Warning: invalid CSR `uintthresh', needs `smclic' extension
>> +.*Warning: invalid CSR `uintthresh', needs `smclic' extension
>> +.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
>> +.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
>> +.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
>> +.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
>>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>>  .*Warning: invalid CSR `mstateen1', needs `smstateen' extension
>> diff --git a/gas/testsuite/gas/riscv/csr-version-1p9p1.d b/gas/testsuite/gas/riscv/csr-version-1p9p1.d
>> index 0fe849c269c2..8688fa6ecb7e 100644
>> --- a/gas/testsuite/gas/riscv/csr-version-1p9p1.d
>> +++ b/gas/testsuite/gas/riscv/csr-version-1p9p1.d
>> @@ -623,6 +623,42 @@ 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]+:[ 	]+30702573[ 	]+csrr[ 	]+a0,mtvt
>> +[ 	]+[0-9a-f]+:[ 	]+30759073[ 	]+csrw[ 	]+mtvt,a1
>> +[ 	]+[0-9a-f]+:[ 	]+34502573[ 	]+csrr[ 	]+a0,mnxti
>> +[ 	]+[0-9a-f]+:[ 	]+34559073[ 	]+csrw[ 	]+mnxti,a1
>> +[ 	]+[0-9a-f]+:[ 	]+f4602573[ 	]+csrr[ 	]+a0,mintstatus
>> +[ 	]+[0-9a-f]+:[ 	]+f4659073[ 	]+csrw[ 	]+mintstatus,a1
>> +[ 	]+[0-9a-f]+:[ 	]+34702573[ 	]+csrr[ 	]+a0,mintthresh
>> +[ 	]+[0-9a-f]+:[ 	]+34759073[ 	]+csrw[ 	]+mintthresh,a1
>> +[ 	]+[0-9a-f]+:[ 	]+34802573[ 	]+csrr[ 	]+a0,mscratchcsw
>> +[ 	]+[0-9a-f]+:[ 	]+34859073[ 	]+csrw[ 	]+mscratchcsw,a1
>> +[ 	]+[0-9a-f]+:[ 	]+34902573[ 	]+csrr[ 	]+a0,mscratchcswl
>> +[ 	]+[0-9a-f]+:[ 	]+34959073[ 	]+csrw[ 	]+mscratchcswl,a1
>> +[ 	]+[0-9a-f]+:[ 	]+10702573[ 	]+csrr[ 	]+a0,stvt
>> +[ 	]+[0-9a-f]+:[ 	]+10759073[ 	]+csrw[ 	]+stvt,a1
>> +[ 	]+[0-9a-f]+:[ 	]+14502573[ 	]+csrr[ 	]+a0,snxti
>> +[ 	]+[0-9a-f]+:[ 	]+14559073[ 	]+csrw[ 	]+snxti,a1
>> +[ 	]+[0-9a-f]+:[ 	]+d4602573[ 	]+csrr[ 	]+a0,sintstatus
>> +[ 	]+[0-9a-f]+:[ 	]+d4659073[ 	]+csrw[ 	]+sintstatus,a1
>> +[ 	]+[0-9a-f]+:[ 	]+14702573[ 	]+csrr[ 	]+a0,sintthresh
>> +[ 	]+[0-9a-f]+:[ 	]+14759073[ 	]+csrw[ 	]+sintthresh,a1
>> +[ 	]+[0-9a-f]+:[ 	]+14802573[ 	]+csrr[ 	]+a0,sscratchcsw
>> +[ 	]+[0-9a-f]+:[ 	]+14859073[ 	]+csrw[ 	]+sscratchcsw,a1
>> +[ 	]+[0-9a-f]+:[ 	]+14902573[ 	]+csrr[ 	]+a0,sscratchcswl
>> +[ 	]+[0-9a-f]+:[ 	]+14959073[ 	]+csrw[ 	]+sscratchcswl,a1
>> +[ 	]+[0-9a-f]+:[ 	]+00702573[ 	]+csrr[ 	]+a0,utvt
>> +[ 	]+[0-9a-f]+:[ 	]+00759073[ 	]+csrw[ 	]+utvt,a1
>> +[ 	]+[0-9a-f]+:[ 	]+04502573[ 	]+csrr[ 	]+a0,unxti
>> +[ 	]+[0-9a-f]+:[ 	]+04559073[ 	]+csrw[ 	]+unxti,a1
>> +[ 	]+[0-9a-f]+:[ 	]+c4602573[ 	]+csrr[ 	]+a0,uintstatus
>> +[ 	]+[0-9a-f]+:[ 	]+c4659073[ 	]+csrw[ 	]+uintstatus,a1
>> +[ 	]+[0-9a-f]+:[ 	]+04702573[ 	]+csrr[ 	]+a0,uintthresh
>> +[ 	]+[0-9a-f]+:[ 	]+04759073[ 	]+csrw[ 	]+uintthresh,a1
>> +[ 	]+[0-9a-f]+:[ 	]+04802573[ 	]+csrr[ 	]+a0,uscratchcsw
>> +[ 	]+[0-9a-f]+:[ 	]+04859073[ 	]+csrw[ 	]+uscratchcsw,a1
>> +[ 	]+[0-9a-f]+:[ 	]+04902573[ 	]+csrr[ 	]+a0,uscratchcswl
>> +[ 	]+[0-9a-f]+:[ 	]+04959073[ 	]+csrw[ 	]+uscratchcswl,a1
>>  [ 	]+[0-9a-f]+:[ 	]+30c02573[ 	]+csrr[ 	]+a0,mstateen0
>>  [ 	]+[0-9a-f]+:[ 	]+30c59073[ 	]+csrw[ 	]+mstateen0,a1
>>  [ 	]+[0-9a-f]+:[ 	]+30d02573[ 	]+csrr[ 	]+a0,mstateen1
>> diff --git a/gas/testsuite/gas/riscv/csr-version-1p9p1.l b/gas/testsuite/gas/riscv/csr-version-1p9p1.l
>> index c65d0b48e414..22bed0aecfd0 100644
>> --- a/gas/testsuite/gas/riscv/csr-version-1p9p1.l
>> +++ b/gas/testsuite/gas/riscv/csr-version-1p9p1.l
>> @@ -494,6 +494,45 @@
>>  .*Warning: invalid CSR `miph', needs `smaia' extension
>>  .*Warning: invalid CSR `miph', needs rv32i extension
>>  .*Warning: invalid CSR `miph', needs `smaia' extension
>> +.*Warning: invalid CSR `mtvt', needs `smclic' extension
>> +.*Warning: invalid CSR `mtvt', needs `smclic' extension
>> +.*Warning: invalid CSR `mnxti', needs `smclic' extension
>> +.*Warning: invalid CSR `mnxti', needs `smclic' extension
>> +.*Warning: invalid CSR `mintstatus', needs `smclic' extension
>> +.*Warning: invalid CSR `mintstatus', needs `smclic' extension
>> +.*Warning: read-only CSR is written `csrw mintstatus,a1'
>> +.*Warning: invalid CSR `mintthresh', needs `smclic' extension
>> +.*Warning: invalid CSR `mintthresh', needs `smclic' extension
>> +.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
>> +.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
>> +.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
>> +.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
>> +.*Warning: invalid CSR `stvt', needs `smclic' extension
>> +.*Warning: invalid CSR `stvt', needs `smclic' extension
>> +.*Warning: invalid CSR `snxti', needs `smclic' extension
>> +.*Warning: invalid CSR `snxti', needs `smclic' extension
>> +.*Warning: invalid CSR `sintstatus', needs `smclic' extension
>> +.*Warning: invalid CSR `sintstatus', needs `smclic' extension
>> +.*Warning: read-only CSR is written `csrw sintstatus,a1'
>> +.*Warning: invalid CSR `sintthresh', needs `smclic' extension
>> +.*Warning: invalid CSR `sintthresh', needs `smclic' extension
>> +.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
>> +.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
>> +.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
>> +.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
>> +.*Warning: invalid CSR `utvt', needs `smclic' extension
>> +.*Warning: invalid CSR `utvt', needs `smclic' extension
>> +.*Warning: invalid CSR `unxti', needs `smclic' extension
>> +.*Warning: invalid CSR `unxti', needs `smclic' extension
>> +.*Warning: invalid CSR `uintstatus', needs `smclic' extension
>> +.*Warning: invalid CSR `uintstatus', needs `smclic' extension
>> +.*Warning: read-only CSR is written `csrw uintstatus,a1'
>> +.*Warning: invalid CSR `uintthresh', needs `smclic' extension
>> +.*Warning: invalid CSR `uintthresh', needs `smclic' extension
>> +.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
>> +.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
>> +.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
>> +.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
>>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>>  .*Warning: invalid CSR `mstateen1', needs `smstateen' extension
>> diff --git a/gas/testsuite/gas/riscv/csr.s b/gas/testsuite/gas/riscv/csr.s
>> index c7406ce34c2e..29a0710df812 100644
>> --- a/gas/testsuite/gas/riscv/csr.s
>> +++ b/gas/testsuite/gas/riscv/csr.s
>> @@ -350,6 +350,26 @@
>>  	csr mviph
>>  	csr miph
>>
>> +	# Smclic extension
>> +	csr mtvt
>> +	csr mnxti
>> +	csr mintstatus
>> +	csr mintthresh
>> +	csr mscratchcsw
>> +	csr mscratchcswl
>> +	csr stvt
>> +	csr snxti
>> +	csr sintstatus
>> +	csr sintthresh
>> +	csr sscratchcsw
>> +	csr sscratchcswl
>> +	csr utvt
>> +	csr unxti
>> +	csr uintstatus
>> +	csr uintthresh
>> +	csr uscratchcsw
>> +	csr uscratchcswl
>> +
>>  	# Smstateen/Ssstateen extensions
>>  	csr mstateen0
>>  	csr mstateen1
>> diff --git a/include/opcode/riscv-opc.h b/include/opcode/riscv-opc.h
>> index 06e3df0f5a63..3f072bf01b3c 100644
>> --- a/include/opcode/riscv-opc.h
>> +++ b/include/opcode/riscv-opc.h
>> @@ -2673,6 +2673,25 @@
>>  #define CSR_MVIENH   0x318
>>  #define CSR_MVIPH    0x319
>>  #define CSR_MIPH     0x354
>> +/* Smclic extension CSR addresses (including user interrupts).  */
>> +#define CSR_MTVT 0x307
>> +#define CSR_MNXTI 0x345
>> +#define CSR_MINTSTATUS 0xf46
>> +#define CSR_MINTTHRESH 0x347
>> +#define CSR_MSCRATCHCSW 0x348
>> +#define CSR_MSCRATCHCSWL 0x349
>> +#define CSR_STVT 0x107
>> +#define CSR_SNXTI 0x145
>> +#define CSR_SINTSTATUS 0xd46
>> +#define CSR_SINTTHRESH 0x147
>> +#define CSR_SSCRATCHCSW 0x148
>> +#define CSR_SSCRATCHCSWL 0x149
>> +#define CSR_UTVT 0x7
>> +#define CSR_UNXTI 0x45
>> +#define CSR_UINTSTATUS 0xc46
>> +#define CSR_UINTTHRESH 0x47
>> +#define CSR_USCRATCHCSW 0x48
>> +#define CSR_USCRATCHCSWL 0x49
>>  /* Smstateen extension */
>>  #define CSR_MSTATEEN0 0x30c
>>  #define CSR_MSTATEEN1 0x30d
>> @@ -3550,6 +3569,25 @@ 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)
>> +/* Smclic extension CSRs (including user interrupts).  */
>> +DECLARE_CSR(mtvt, CSR_MTVT, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>> +DECLARE_CSR(mnxti, CSR_MNXTI, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>> +DECLARE_CSR(mintstatus, CSR_MINTSTATUS, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>> +DECLARE_CSR(mintthresh, CSR_MINTTHRESH, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>> +DECLARE_CSR(mscratchcsw, CSR_MSCRATCHCSW, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>> +DECLARE_CSR(mscratchcswl, CSR_MSCRATCHCSWL, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>> +DECLARE_CSR(stvt, CSR_STVT, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>> +DECLARE_CSR(snxti, CSR_SNXTI, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>> +DECLARE_CSR(sintstatus, CSR_SINTSTATUS, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>> +DECLARE_CSR(sintthresh, CSR_SINTTHRESH, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>> +DECLARE_CSR(sscratchcsw, CSR_SSCRATCHCSW, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>> +DECLARE_CSR(sscratchcswl, CSR_SSCRATCHCSWL, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>> +DECLARE_CSR(utvt, CSR_UTVT, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>> +DECLARE_CSR(unxti, CSR_UNXTI, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>> +DECLARE_CSR(uintstatus, CSR_UINTSTATUS, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>> +DECLARE_CSR(uintthresh, CSR_UINTTHRESH, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>> +DECLARE_CSR(uscratchcsw, CSR_USCRATCHCSW, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>> +DECLARE_CSR(uscratchcswl, CSR_USCRATCHCSWL, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>>  /* 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)
> 

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

* Re: [REVIEW ONLY 1/1] UNRATIFIED RISC-V: Add 'Smclic' extension and its CSRs
  2022-11-29  2:16     ` Tsukasa OI
@ 2022-11-29  2:43       ` Palmer Dabbelt
  0 siblings, 0 replies; 7+ messages in thread
From: Palmer Dabbelt @ 2022-11-29  2:43 UTC (permalink / raw)
  To: research_trasio; +Cc: binutils

On Mon, 28 Nov 2022 18:16:21 PST (-0800), research_trasio@irq.a4lg.com wrote:
> On 2022/11/29 11:03, Palmer Dabbelt wrote:
>> On Mon, 28 Nov 2022 17:19:53 PST (-0800), binutils@sourceware.org wrote:
>>> From: Tsukasa OI <research_trasio@irq.a4lg.com>
>>>
>>> [DO NOT MERGE]
>>> Until 'Smclic' extension is frozen/ratified and final version number is
>>> determined, this patch should not be merged upstream.  This commit uses
>>> unratified version 0.9 as in the documentation (instead of possible 1.0
>>> after ratification).
>>>
>>> [RFC]
>>> It implements u* CSRs as supported in all privileged architectures.
>>> Since user-mode interrupt is dropped, we might need to mask or remove them.
>>
>> Looks like there's some issues related to these, though it's not super
>> clear what the plan is
>> <https://github.com/riscv/riscv-fast-interrupt/issues/160>.  Probably
>> best to just wait until it's frozen to sort that out?
>
> Yes, that's probably the best idea.  This is based on a document in the
> "Development" state but even "Stable" documents have a difference: the
> one very likely to change before ratification and the one not so likely
> to change.
>
> For instance, I consider that "RISC-V Profiles" documentation likely to
> change before ratification [including extension names that we toolchain
> developers consider important].  That's why I'm not committing RISC-V
> Profiles-related changes except 'Ssstateen' (this is discussed even
> outside the profiles).

I agree that "frozen" is kind of arbitrary, but it's what we all agreed 
to and IMO it's best to stick with it.  There's no real hard guarantee 
of compatibility in RISC-V land, even ratified stuff changes.  We've got 
to draw the line somewhere.

> Additional reference:
> <https://github.com/riscv/riscv-fast-interrupt/issues/200>
>
> Tsukasa
>
>>
>>>
>>> This commit adds CSR support for the 'Smclic' extension, a part of Core-
>>> Local Interrupt Controller (CLIC) extension.
>>>
>>> This is based on the latest Core-Local Interrupt Controller (CLIC)
>>> extension draft (version 0.9-draft):
>>> <https://github.com/riscv/riscv-fast-interrupt/blob/e601b94bf43af0e9842b20134814404e488511e3/clic.pdf>
>>>
>>> bfd/ChangeLog:
>>>
>>> 	* elfxx-riscv.c (riscv_implicit_subsets): Add implication from
>>> 	'Smclic' to 'Zicsr'.  (riscv_supported_std_s_ext) Add 'Smclic'.
>>>
>>> gas/ChangeLog:
>>>
>>> 	* config/tc-riscv.c (enum riscv_csr_class): Add new CSR class.
>>> 	(riscv_csr_address): Add new CSR class handling.
>>> 	* testsuite/gas/riscv/csr.s: Add new CSR test.
>>> 	* testsuite/gas/riscv/csr-dw-regnums.s: Likewise.
>>> 	* testsuite/gas/riscv/csr-dw-regnums.d: Likewise.
>>> 	* 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_MTVT, CSR_MNXTI, CSR_MINTSTATUS,
>>> 	CSR_MINTTHRESH, CSR_MSCRATCHCSW, CSR_MSCRATCHCSWL, CSR_STVT,
>>> 	CSR_SNXTI, CSR_SINTSTATUS, CSR_SINTTHRESH, CSR_SSCRATCHCSW,
>>> 	CSR_SSCRATCHCSWL, CSR_UTVT, CSR_UNXTI, CSR_UINTSTATUS,
>>> 	CSR_UINTTHRESH, CSR_USCRATCHCSW, CSR_USCRATCHCSWL): New.
>>> ---
>>>  bfd/elfxx-riscv.c                           |  2 ++
>>>  gas/config/tc-riscv.c                       |  4 +++
>>>  gas/testsuite/gas/riscv/csr-dw-regnums.d    | 18 ++++++++++
>>>  gas/testsuite/gas/riscv/csr-dw-regnums.s    | 19 ++++++++++
>>>  gas/testsuite/gas/riscv/csr-version-1p10.d  | 36 +++++++++++++++++++
>>>  gas/testsuite/gas/riscv/csr-version-1p10.l  | 39 +++++++++++++++++++++
>>>  gas/testsuite/gas/riscv/csr-version-1p11.d  | 36 +++++++++++++++++++
>>>  gas/testsuite/gas/riscv/csr-version-1p11.l  | 39 +++++++++++++++++++++
>>>  gas/testsuite/gas/riscv/csr-version-1p12.d  | 36 +++++++++++++++++++
>>>  gas/testsuite/gas/riscv/csr-version-1p12.l  | 39 +++++++++++++++++++++
>>>  gas/testsuite/gas/riscv/csr-version-1p9p1.d | 36 +++++++++++++++++++
>>>  gas/testsuite/gas/riscv/csr-version-1p9p1.l | 39 +++++++++++++++++++++
>>>  gas/testsuite/gas/riscv/csr.s               | 20 +++++++++++
>>>  include/opcode/riscv-opc.h                  | 38 ++++++++++++++++++++
>>>  14 files changed, 401 insertions(+)
>>>
>>> diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
>>> index 0bcf2fdcfa34..6c60cf7c888e 100644
>>> --- a/bfd/elfxx-riscv.c
>>> +++ b/bfd/elfxx-riscv.c
>>> @@ -1103,6 +1103,7 @@ static struct riscv_implicit_subset riscv_implicit_subsets[] =
>>>    {"zks", "zksh",	check_implicit_always},
>>>    {"smaia", "ssaia",		check_implicit_always},
>>>    {"smstateen", "ssstateen",	check_implicit_always},
>>> +  {"smclic", "zicsr",		check_implicit_always},
>>>    {"smepmp", "zicsr",		check_implicit_always},
>>>    {"ssaia", "zicsr",		check_implicit_always},
>>>    {"sscofpmf", "zicsr",		check_implicit_always},
>>> @@ -1224,6 +1225,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 },
>>> +  {"smclic",		ISA_SPEC_CLASS_DRAFT,		0, 9, 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 0682eb355241..e90e0ba53987 100644
>>> --- a/gas/config/tc-riscv.c
>>> +++ b/gas/config/tc-riscv.c
>>> @@ -74,6 +74,7 @@ enum riscv_csr_class
>>>    CSR_CLASS_H_32,	/* hypervisor, rv32 only */
>>>    CSR_CLASS_SMAIA,		/* Smaia */
>>>    CSR_CLASS_SMAIA_32,		/* Smaia, rv32 only */
>>> +  CSR_CLASS_SMCLIC,		/* Smclic only */
>>>    CSR_CLASS_SMSTATEEN,		/* Smstateen only */
>>>    CSR_CLASS_SMSTATEEN_32,	/* Smstateen RV32 only */
>>>    CSR_CLASS_SSAIA,		/* Ssaia */
>>> @@ -1049,6 +1050,9 @@ riscv_csr_address (const char *csr_name,
>>>      case CSR_CLASS_SMAIA:
>>>        extension = "smaia";
>>>        break;
>>> +    case CSR_CLASS_SMCLIC:
>>> +      extension = "smclic";
>>> +      break;
>>>      case CSR_CLASS_SMSTATEEN:
>>>      case CSR_CLASS_SMSTATEEN_32:
>>>        is_rv32_only = (csr_class == CSR_CLASS_SMSTATEEN_32);
>>> diff --git a/gas/testsuite/gas/riscv/csr-dw-regnums.d b/gas/testsuite/gas/riscv/csr-dw-regnums.d
>>> index fd830666ab89..2b58c6a955b1 100644
>>> --- a/gas/testsuite/gas/riscv/csr-dw-regnums.d
>>> +++ b/gas/testsuite/gas/riscv/csr-dw-regnums.d
>>> @@ -324,6 +324,24 @@ 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: r4871 \(mtvt\) at cfa\+3100
>>> +  DW_CFA_offset_extended_sf: r4933 \(mnxti\) at cfa\+3348
>>> +  DW_CFA_offset_extended_sf: r8006 \(mintstatus\) at cfa\+15640
>>> +  DW_CFA_offset_extended_sf: r4935 \(mintthresh\) at cfa\+3356
>>> +  DW_CFA_offset_extended_sf: r4936 \(mscratchcsw\) at cfa\+3360
>>> +  DW_CFA_offset_extended_sf: r4937 \(mscratchcswl\) at cfa\+3364
>>> +  DW_CFA_offset_extended_sf: r4359 \(stvt\) at cfa\+1052
>>> +  DW_CFA_offset_extended_sf: r4421 \(snxti\) at cfa\+1300
>>> +  DW_CFA_offset_extended_sf: r7494 \(sintstatus\) at cfa\+13592
>>> +  DW_CFA_offset_extended_sf: r4423 \(sintthresh\) at cfa\+1308
>>> +  DW_CFA_offset_extended_sf: r4424 \(sscratchcsw\) at cfa\+1312
>>> +  DW_CFA_offset_extended_sf: r4425 \(sscratchcswl\) at cfa\+1316
>>> +  DW_CFA_offset_extended_sf: r4103 \(utvt\) at cfa\+28
>>> +  DW_CFA_offset_extended_sf: r4165 \(unxti\) at cfa\+276
>>> +  DW_CFA_offset_extended_sf: r7238 \(uintstatus\) at cfa\+12568
>>> +  DW_CFA_offset_extended_sf: r4167 \(uintthresh\) at cfa\+284
>>> +  DW_CFA_offset_extended_sf: r4168 \(uscratchcsw\) at cfa\+288
>>> +  DW_CFA_offset_extended_sf: r4169 \(uscratchcswl\) at cfa\+292
>>>    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
>>> diff --git a/gas/testsuite/gas/riscv/csr-dw-regnums.s b/gas/testsuite/gas/riscv/csr-dw-regnums.s
>>> index b8b0f7902297..af1158eb0089 100644
>>> --- a/gas/testsuite/gas/riscv/csr-dw-regnums.s
>>> +++ b/gas/testsuite/gas/riscv/csr-dw-regnums.s
>>> @@ -321,6 +321,25 @@ _start:
>>>  	.cfi_offset mvienh, 3168
>>>  	.cfi_offset mviph, 3172
>>>  	.cfi_offset miph, 3408
>>> +	# Smclic extension
>>> +	.cfi_offset mtvt, 3100
>>> +	.cfi_offset mnxti, 3348
>>> +	.cfi_offset mintstatus, 15640
>>> +	.cfi_offset mintthresh, 3356
>>> +	.cfi_offset mscratchcsw, 3360
>>> +	.cfi_offset mscratchcswl, 3364
>>> +	.cfi_offset stvt, 1052
>>> +	.cfi_offset snxti, 1300
>>> +	.cfi_offset sintstatus, 13592
>>> +	.cfi_offset sintthresh, 1308
>>> +	.cfi_offset sscratchcsw, 1312
>>> +	.cfi_offset sscratchcswl, 1316
>>> +	.cfi_offset utvt, 28
>>> +	.cfi_offset unxti, 276
>>> +	.cfi_offset uintstatus, 12568
>>> +	.cfi_offset uintthresh, 284
>>> +	.cfi_offset uscratchcsw, 288
>>> +	.cfi_offset uscratchcswl, 292
>>>  	# Smstateen extension
>>>  	.cfi_offset mstateen0, 3120
>>>  	.cfi_offset mstateen1, 3124
>>> diff --git a/gas/testsuite/gas/riscv/csr-version-1p10.d b/gas/testsuite/gas/riscv/csr-version-1p10.d
>>> index ee41e1025cce..aa116a75fadd 100644
>>> --- a/gas/testsuite/gas/riscv/csr-version-1p10.d
>>> +++ b/gas/testsuite/gas/riscv/csr-version-1p10.d
>>> @@ -623,6 +623,42 @@ 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]+:[ 	]+30702573[ 	]+csrr[ 	]+a0,mtvt
>>> +[ 	]+[0-9a-f]+:[ 	]+30759073[ 	]+csrw[ 	]+mtvt,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+34502573[ 	]+csrr[ 	]+a0,mnxti
>>> +[ 	]+[0-9a-f]+:[ 	]+34559073[ 	]+csrw[ 	]+mnxti,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+f4602573[ 	]+csrr[ 	]+a0,mintstatus
>>> +[ 	]+[0-9a-f]+:[ 	]+f4659073[ 	]+csrw[ 	]+mintstatus,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+34702573[ 	]+csrr[ 	]+a0,mintthresh
>>> +[ 	]+[0-9a-f]+:[ 	]+34759073[ 	]+csrw[ 	]+mintthresh,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+34802573[ 	]+csrr[ 	]+a0,mscratchcsw
>>> +[ 	]+[0-9a-f]+:[ 	]+34859073[ 	]+csrw[ 	]+mscratchcsw,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+34902573[ 	]+csrr[ 	]+a0,mscratchcswl
>>> +[ 	]+[0-9a-f]+:[ 	]+34959073[ 	]+csrw[ 	]+mscratchcswl,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+10702573[ 	]+csrr[ 	]+a0,stvt
>>> +[ 	]+[0-9a-f]+:[ 	]+10759073[ 	]+csrw[ 	]+stvt,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+14502573[ 	]+csrr[ 	]+a0,snxti
>>> +[ 	]+[0-9a-f]+:[ 	]+14559073[ 	]+csrw[ 	]+snxti,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+d4602573[ 	]+csrr[ 	]+a0,sintstatus
>>> +[ 	]+[0-9a-f]+:[ 	]+d4659073[ 	]+csrw[ 	]+sintstatus,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+14702573[ 	]+csrr[ 	]+a0,sintthresh
>>> +[ 	]+[0-9a-f]+:[ 	]+14759073[ 	]+csrw[ 	]+sintthresh,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+14802573[ 	]+csrr[ 	]+a0,sscratchcsw
>>> +[ 	]+[0-9a-f]+:[ 	]+14859073[ 	]+csrw[ 	]+sscratchcsw,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+14902573[ 	]+csrr[ 	]+a0,sscratchcswl
>>> +[ 	]+[0-9a-f]+:[ 	]+14959073[ 	]+csrw[ 	]+sscratchcswl,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+00702573[ 	]+csrr[ 	]+a0,utvt
>>> +[ 	]+[0-9a-f]+:[ 	]+00759073[ 	]+csrw[ 	]+utvt,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+04502573[ 	]+csrr[ 	]+a0,unxti
>>> +[ 	]+[0-9a-f]+:[ 	]+04559073[ 	]+csrw[ 	]+unxti,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+c4602573[ 	]+csrr[ 	]+a0,uintstatus
>>> +[ 	]+[0-9a-f]+:[ 	]+c4659073[ 	]+csrw[ 	]+uintstatus,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+04702573[ 	]+csrr[ 	]+a0,uintthresh
>>> +[ 	]+[0-9a-f]+:[ 	]+04759073[ 	]+csrw[ 	]+uintthresh,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+04802573[ 	]+csrr[ 	]+a0,uscratchcsw
>>> +[ 	]+[0-9a-f]+:[ 	]+04859073[ 	]+csrw[ 	]+uscratchcsw,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+04902573[ 	]+csrr[ 	]+a0,uscratchcswl
>>> +[ 	]+[0-9a-f]+:[ 	]+04959073[ 	]+csrw[ 	]+uscratchcswl,a1
>>>  [ 	]+[0-9a-f]+:[ 	]+30c02573[ 	]+csrr[ 	]+a0,mstateen0
>>>  [ 	]+[0-9a-f]+:[ 	]+30c59073[ 	]+csrw[ 	]+mstateen0,a1
>>>  [ 	]+[0-9a-f]+:[ 	]+30d02573[ 	]+csrr[ 	]+a0,mstateen1
>>> diff --git a/gas/testsuite/gas/riscv/csr-version-1p10.l b/gas/testsuite/gas/riscv/csr-version-1p10.l
>>> index e677b78b8bb8..15431cef4590 100644
>>> --- a/gas/testsuite/gas/riscv/csr-version-1p10.l
>>> +++ b/gas/testsuite/gas/riscv/csr-version-1p10.l
>>> @@ -444,6 +444,45 @@
>>>  .*Warning: invalid CSR `miph', needs `smaia' extension
>>>  .*Warning: invalid CSR `miph', needs rv32i extension
>>>  .*Warning: invalid CSR `miph', needs `smaia' extension
>>> +.*Warning: invalid CSR `mtvt', needs `smclic' extension
>>> +.*Warning: invalid CSR `mtvt', needs `smclic' extension
>>> +.*Warning: invalid CSR `mnxti', needs `smclic' extension
>>> +.*Warning: invalid CSR `mnxti', needs `smclic' extension
>>> +.*Warning: invalid CSR `mintstatus', needs `smclic' extension
>>> +.*Warning: invalid CSR `mintstatus', needs `smclic' extension
>>> +.*Warning: read-only CSR is written `csrw mintstatus,a1'
>>> +.*Warning: invalid CSR `mintthresh', needs `smclic' extension
>>> +.*Warning: invalid CSR `mintthresh', needs `smclic' extension
>>> +.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
>>> +.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
>>> +.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
>>> +.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
>>> +.*Warning: invalid CSR `stvt', needs `smclic' extension
>>> +.*Warning: invalid CSR `stvt', needs `smclic' extension
>>> +.*Warning: invalid CSR `snxti', needs `smclic' extension
>>> +.*Warning: invalid CSR `snxti', needs `smclic' extension
>>> +.*Warning: invalid CSR `sintstatus', needs `smclic' extension
>>> +.*Warning: invalid CSR `sintstatus', needs `smclic' extension
>>> +.*Warning: read-only CSR is written `csrw sintstatus,a1'
>>> +.*Warning: invalid CSR `sintthresh', needs `smclic' extension
>>> +.*Warning: invalid CSR `sintthresh', needs `smclic' extension
>>> +.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
>>> +.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
>>> +.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
>>> +.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
>>> +.*Warning: invalid CSR `utvt', needs `smclic' extension
>>> +.*Warning: invalid CSR `utvt', needs `smclic' extension
>>> +.*Warning: invalid CSR `unxti', needs `smclic' extension
>>> +.*Warning: invalid CSR `unxti', needs `smclic' extension
>>> +.*Warning: invalid CSR `uintstatus', needs `smclic' extension
>>> +.*Warning: invalid CSR `uintstatus', needs `smclic' extension
>>> +.*Warning: read-only CSR is written `csrw uintstatus,a1'
>>> +.*Warning: invalid CSR `uintthresh', needs `smclic' extension
>>> +.*Warning: invalid CSR `uintthresh', needs `smclic' extension
>>> +.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
>>> +.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
>>> +.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
>>> +.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
>>>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>>>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>>>  .*Warning: invalid CSR `mstateen1', needs `smstateen' extension
>>> diff --git a/gas/testsuite/gas/riscv/csr-version-1p11.d b/gas/testsuite/gas/riscv/csr-version-1p11.d
>>> index a83b1bf68f98..c7af6b7cafac 100644
>>> --- a/gas/testsuite/gas/riscv/csr-version-1p11.d
>>> +++ b/gas/testsuite/gas/riscv/csr-version-1p11.d
>>> @@ -623,6 +623,42 @@ 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]+:[ 	]+30702573[ 	]+csrr[ 	]+a0,mtvt
>>> +[ 	]+[0-9a-f]+:[ 	]+30759073[ 	]+csrw[ 	]+mtvt,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+34502573[ 	]+csrr[ 	]+a0,mnxti
>>> +[ 	]+[0-9a-f]+:[ 	]+34559073[ 	]+csrw[ 	]+mnxti,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+f4602573[ 	]+csrr[ 	]+a0,mintstatus
>>> +[ 	]+[0-9a-f]+:[ 	]+f4659073[ 	]+csrw[ 	]+mintstatus,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+34702573[ 	]+csrr[ 	]+a0,mintthresh
>>> +[ 	]+[0-9a-f]+:[ 	]+34759073[ 	]+csrw[ 	]+mintthresh,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+34802573[ 	]+csrr[ 	]+a0,mscratchcsw
>>> +[ 	]+[0-9a-f]+:[ 	]+34859073[ 	]+csrw[ 	]+mscratchcsw,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+34902573[ 	]+csrr[ 	]+a0,mscratchcswl
>>> +[ 	]+[0-9a-f]+:[ 	]+34959073[ 	]+csrw[ 	]+mscratchcswl,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+10702573[ 	]+csrr[ 	]+a0,stvt
>>> +[ 	]+[0-9a-f]+:[ 	]+10759073[ 	]+csrw[ 	]+stvt,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+14502573[ 	]+csrr[ 	]+a0,snxti
>>> +[ 	]+[0-9a-f]+:[ 	]+14559073[ 	]+csrw[ 	]+snxti,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+d4602573[ 	]+csrr[ 	]+a0,sintstatus
>>> +[ 	]+[0-9a-f]+:[ 	]+d4659073[ 	]+csrw[ 	]+sintstatus,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+14702573[ 	]+csrr[ 	]+a0,sintthresh
>>> +[ 	]+[0-9a-f]+:[ 	]+14759073[ 	]+csrw[ 	]+sintthresh,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+14802573[ 	]+csrr[ 	]+a0,sscratchcsw
>>> +[ 	]+[0-9a-f]+:[ 	]+14859073[ 	]+csrw[ 	]+sscratchcsw,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+14902573[ 	]+csrr[ 	]+a0,sscratchcswl
>>> +[ 	]+[0-9a-f]+:[ 	]+14959073[ 	]+csrw[ 	]+sscratchcswl,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+00702573[ 	]+csrr[ 	]+a0,utvt
>>> +[ 	]+[0-9a-f]+:[ 	]+00759073[ 	]+csrw[ 	]+utvt,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+04502573[ 	]+csrr[ 	]+a0,unxti
>>> +[ 	]+[0-9a-f]+:[ 	]+04559073[ 	]+csrw[ 	]+unxti,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+c4602573[ 	]+csrr[ 	]+a0,uintstatus
>>> +[ 	]+[0-9a-f]+:[ 	]+c4659073[ 	]+csrw[ 	]+uintstatus,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+04702573[ 	]+csrr[ 	]+a0,uintthresh
>>> +[ 	]+[0-9a-f]+:[ 	]+04759073[ 	]+csrw[ 	]+uintthresh,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+04802573[ 	]+csrr[ 	]+a0,uscratchcsw
>>> +[ 	]+[0-9a-f]+:[ 	]+04859073[ 	]+csrw[ 	]+uscratchcsw,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+04902573[ 	]+csrr[ 	]+a0,uscratchcswl
>>> +[ 	]+[0-9a-f]+:[ 	]+04959073[ 	]+csrw[ 	]+uscratchcswl,a1
>>>  [ 	]+[0-9a-f]+:[ 	]+30c02573[ 	]+csrr[ 	]+a0,mstateen0
>>>  [ 	]+[0-9a-f]+:[ 	]+30c59073[ 	]+csrw[ 	]+mstateen0,a1
>>>  [ 	]+[0-9a-f]+:[ 	]+30d02573[ 	]+csrr[ 	]+a0,mstateen1
>>> diff --git a/gas/testsuite/gas/riscv/csr-version-1p11.l b/gas/testsuite/gas/riscv/csr-version-1p11.l
>>> index 81ca86ca7bcc..94c3142c07ff 100644
>>> --- a/gas/testsuite/gas/riscv/csr-version-1p11.l
>>> +++ b/gas/testsuite/gas/riscv/csr-version-1p11.l
>>> @@ -442,6 +442,45 @@
>>>  .*Warning: invalid CSR `miph', needs `smaia' extension
>>>  .*Warning: invalid CSR `miph', needs rv32i extension
>>>  .*Warning: invalid CSR `miph', needs `smaia' extension
>>> +.*Warning: invalid CSR `mtvt', needs `smclic' extension
>>> +.*Warning: invalid CSR `mtvt', needs `smclic' extension
>>> +.*Warning: invalid CSR `mnxti', needs `smclic' extension
>>> +.*Warning: invalid CSR `mnxti', needs `smclic' extension
>>> +.*Warning: invalid CSR `mintstatus', needs `smclic' extension
>>> +.*Warning: invalid CSR `mintstatus', needs `smclic' extension
>>> +.*Warning: read-only CSR is written `csrw mintstatus,a1'
>>> +.*Warning: invalid CSR `mintthresh', needs `smclic' extension
>>> +.*Warning: invalid CSR `mintthresh', needs `smclic' extension
>>> +.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
>>> +.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
>>> +.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
>>> +.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
>>> +.*Warning: invalid CSR `stvt', needs `smclic' extension
>>> +.*Warning: invalid CSR `stvt', needs `smclic' extension
>>> +.*Warning: invalid CSR `snxti', needs `smclic' extension
>>> +.*Warning: invalid CSR `snxti', needs `smclic' extension
>>> +.*Warning: invalid CSR `sintstatus', needs `smclic' extension
>>> +.*Warning: invalid CSR `sintstatus', needs `smclic' extension
>>> +.*Warning: read-only CSR is written `csrw sintstatus,a1'
>>> +.*Warning: invalid CSR `sintthresh', needs `smclic' extension
>>> +.*Warning: invalid CSR `sintthresh', needs `smclic' extension
>>> +.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
>>> +.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
>>> +.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
>>> +.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
>>> +.*Warning: invalid CSR `utvt', needs `smclic' extension
>>> +.*Warning: invalid CSR `utvt', needs `smclic' extension
>>> +.*Warning: invalid CSR `unxti', needs `smclic' extension
>>> +.*Warning: invalid CSR `unxti', needs `smclic' extension
>>> +.*Warning: invalid CSR `uintstatus', needs `smclic' extension
>>> +.*Warning: invalid CSR `uintstatus', needs `smclic' extension
>>> +.*Warning: read-only CSR is written `csrw uintstatus,a1'
>>> +.*Warning: invalid CSR `uintthresh', needs `smclic' extension
>>> +.*Warning: invalid CSR `uintthresh', needs `smclic' extension
>>> +.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
>>> +.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
>>> +.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
>>> +.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
>>>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>>>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>>>  .*Warning: invalid CSR `mstateen1', needs `smstateen' extension
>>> diff --git a/gas/testsuite/gas/riscv/csr-version-1p12.d b/gas/testsuite/gas/riscv/csr-version-1p12.d
>>> index 612aac280768..357f9ae1a626 100644
>>> --- a/gas/testsuite/gas/riscv/csr-version-1p12.d
>>> +++ b/gas/testsuite/gas/riscv/csr-version-1p12.d
>>> @@ -623,6 +623,42 @@ 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]+:[ 	]+30702573[ 	]+csrr[ 	]+a0,mtvt
>>> +[ 	]+[0-9a-f]+:[ 	]+30759073[ 	]+csrw[ 	]+mtvt,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+34502573[ 	]+csrr[ 	]+a0,mnxti
>>> +[ 	]+[0-9a-f]+:[ 	]+34559073[ 	]+csrw[ 	]+mnxti,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+f4602573[ 	]+csrr[ 	]+a0,mintstatus
>>> +[ 	]+[0-9a-f]+:[ 	]+f4659073[ 	]+csrw[ 	]+mintstatus,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+34702573[ 	]+csrr[ 	]+a0,mintthresh
>>> +[ 	]+[0-9a-f]+:[ 	]+34759073[ 	]+csrw[ 	]+mintthresh,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+34802573[ 	]+csrr[ 	]+a0,mscratchcsw
>>> +[ 	]+[0-9a-f]+:[ 	]+34859073[ 	]+csrw[ 	]+mscratchcsw,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+34902573[ 	]+csrr[ 	]+a0,mscratchcswl
>>> +[ 	]+[0-9a-f]+:[ 	]+34959073[ 	]+csrw[ 	]+mscratchcswl,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+10702573[ 	]+csrr[ 	]+a0,stvt
>>> +[ 	]+[0-9a-f]+:[ 	]+10759073[ 	]+csrw[ 	]+stvt,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+14502573[ 	]+csrr[ 	]+a0,snxti
>>> +[ 	]+[0-9a-f]+:[ 	]+14559073[ 	]+csrw[ 	]+snxti,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+d4602573[ 	]+csrr[ 	]+a0,sintstatus
>>> +[ 	]+[0-9a-f]+:[ 	]+d4659073[ 	]+csrw[ 	]+sintstatus,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+14702573[ 	]+csrr[ 	]+a0,sintthresh
>>> +[ 	]+[0-9a-f]+:[ 	]+14759073[ 	]+csrw[ 	]+sintthresh,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+14802573[ 	]+csrr[ 	]+a0,sscratchcsw
>>> +[ 	]+[0-9a-f]+:[ 	]+14859073[ 	]+csrw[ 	]+sscratchcsw,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+14902573[ 	]+csrr[ 	]+a0,sscratchcswl
>>> +[ 	]+[0-9a-f]+:[ 	]+14959073[ 	]+csrw[ 	]+sscratchcswl,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+00702573[ 	]+csrr[ 	]+a0,utvt
>>> +[ 	]+[0-9a-f]+:[ 	]+00759073[ 	]+csrw[ 	]+utvt,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+04502573[ 	]+csrr[ 	]+a0,unxti
>>> +[ 	]+[0-9a-f]+:[ 	]+04559073[ 	]+csrw[ 	]+unxti,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+c4602573[ 	]+csrr[ 	]+a0,uintstatus
>>> +[ 	]+[0-9a-f]+:[ 	]+c4659073[ 	]+csrw[ 	]+uintstatus,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+04702573[ 	]+csrr[ 	]+a0,uintthresh
>>> +[ 	]+[0-9a-f]+:[ 	]+04759073[ 	]+csrw[ 	]+uintthresh,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+04802573[ 	]+csrr[ 	]+a0,uscratchcsw
>>> +[ 	]+[0-9a-f]+:[ 	]+04859073[ 	]+csrw[ 	]+uscratchcsw,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+04902573[ 	]+csrr[ 	]+a0,uscratchcswl
>>> +[ 	]+[0-9a-f]+:[ 	]+04959073[ 	]+csrw[ 	]+uscratchcswl,a1
>>>  [ 	]+[0-9a-f]+:[ 	]+30c02573[ 	]+csrr[ 	]+a0,mstateen0
>>>  [ 	]+[0-9a-f]+:[ 	]+30c59073[ 	]+csrw[ 	]+mstateen0,a1
>>>  [ 	]+[0-9a-f]+:[ 	]+30d02573[ 	]+csrr[ 	]+a0,mstateen1
>>> diff --git a/gas/testsuite/gas/riscv/csr-version-1p12.l b/gas/testsuite/gas/riscv/csr-version-1p12.l
>>> index 1c0bb4ef2d8f..1655fe4ce833 100644
>>> --- a/gas/testsuite/gas/riscv/csr-version-1p12.l
>>> +++ b/gas/testsuite/gas/riscv/csr-version-1p12.l
>>> @@ -304,6 +304,45 @@
>>>  .*Warning: invalid CSR `miph', needs `smaia' extension
>>>  .*Warning: invalid CSR `miph', needs rv32i extension
>>>  .*Warning: invalid CSR `miph', needs `smaia' extension
>>> +.*Warning: invalid CSR `mtvt', needs `smclic' extension
>>> +.*Warning: invalid CSR `mtvt', needs `smclic' extension
>>> +.*Warning: invalid CSR `mnxti', needs `smclic' extension
>>> +.*Warning: invalid CSR `mnxti', needs `smclic' extension
>>> +.*Warning: invalid CSR `mintstatus', needs `smclic' extension
>>> +.*Warning: invalid CSR `mintstatus', needs `smclic' extension
>>> +.*Warning: read-only CSR is written `csrw mintstatus,a1'
>>> +.*Warning: invalid CSR `mintthresh', needs `smclic' extension
>>> +.*Warning: invalid CSR `mintthresh', needs `smclic' extension
>>> +.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
>>> +.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
>>> +.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
>>> +.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
>>> +.*Warning: invalid CSR `stvt', needs `smclic' extension
>>> +.*Warning: invalid CSR `stvt', needs `smclic' extension
>>> +.*Warning: invalid CSR `snxti', needs `smclic' extension
>>> +.*Warning: invalid CSR `snxti', needs `smclic' extension
>>> +.*Warning: invalid CSR `sintstatus', needs `smclic' extension
>>> +.*Warning: invalid CSR `sintstatus', needs `smclic' extension
>>> +.*Warning: read-only CSR is written `csrw sintstatus,a1'
>>> +.*Warning: invalid CSR `sintthresh', needs `smclic' extension
>>> +.*Warning: invalid CSR `sintthresh', needs `smclic' extension
>>> +.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
>>> +.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
>>> +.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
>>> +.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
>>> +.*Warning: invalid CSR `utvt', needs `smclic' extension
>>> +.*Warning: invalid CSR `utvt', needs `smclic' extension
>>> +.*Warning: invalid CSR `unxti', needs `smclic' extension
>>> +.*Warning: invalid CSR `unxti', needs `smclic' extension
>>> +.*Warning: invalid CSR `uintstatus', needs `smclic' extension
>>> +.*Warning: invalid CSR `uintstatus', needs `smclic' extension
>>> +.*Warning: read-only CSR is written `csrw uintstatus,a1'
>>> +.*Warning: invalid CSR `uintthresh', needs `smclic' extension
>>> +.*Warning: invalid CSR `uintthresh', needs `smclic' extension
>>> +.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
>>> +.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
>>> +.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
>>> +.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
>>>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>>>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>>>  .*Warning: invalid CSR `mstateen1', needs `smstateen' extension
>>> diff --git a/gas/testsuite/gas/riscv/csr-version-1p9p1.d b/gas/testsuite/gas/riscv/csr-version-1p9p1.d
>>> index 0fe849c269c2..8688fa6ecb7e 100644
>>> --- a/gas/testsuite/gas/riscv/csr-version-1p9p1.d
>>> +++ b/gas/testsuite/gas/riscv/csr-version-1p9p1.d
>>> @@ -623,6 +623,42 @@ 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]+:[ 	]+30702573[ 	]+csrr[ 	]+a0,mtvt
>>> +[ 	]+[0-9a-f]+:[ 	]+30759073[ 	]+csrw[ 	]+mtvt,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+34502573[ 	]+csrr[ 	]+a0,mnxti
>>> +[ 	]+[0-9a-f]+:[ 	]+34559073[ 	]+csrw[ 	]+mnxti,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+f4602573[ 	]+csrr[ 	]+a0,mintstatus
>>> +[ 	]+[0-9a-f]+:[ 	]+f4659073[ 	]+csrw[ 	]+mintstatus,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+34702573[ 	]+csrr[ 	]+a0,mintthresh
>>> +[ 	]+[0-9a-f]+:[ 	]+34759073[ 	]+csrw[ 	]+mintthresh,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+34802573[ 	]+csrr[ 	]+a0,mscratchcsw
>>> +[ 	]+[0-9a-f]+:[ 	]+34859073[ 	]+csrw[ 	]+mscratchcsw,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+34902573[ 	]+csrr[ 	]+a0,mscratchcswl
>>> +[ 	]+[0-9a-f]+:[ 	]+34959073[ 	]+csrw[ 	]+mscratchcswl,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+10702573[ 	]+csrr[ 	]+a0,stvt
>>> +[ 	]+[0-9a-f]+:[ 	]+10759073[ 	]+csrw[ 	]+stvt,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+14502573[ 	]+csrr[ 	]+a0,snxti
>>> +[ 	]+[0-9a-f]+:[ 	]+14559073[ 	]+csrw[ 	]+snxti,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+d4602573[ 	]+csrr[ 	]+a0,sintstatus
>>> +[ 	]+[0-9a-f]+:[ 	]+d4659073[ 	]+csrw[ 	]+sintstatus,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+14702573[ 	]+csrr[ 	]+a0,sintthresh
>>> +[ 	]+[0-9a-f]+:[ 	]+14759073[ 	]+csrw[ 	]+sintthresh,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+14802573[ 	]+csrr[ 	]+a0,sscratchcsw
>>> +[ 	]+[0-9a-f]+:[ 	]+14859073[ 	]+csrw[ 	]+sscratchcsw,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+14902573[ 	]+csrr[ 	]+a0,sscratchcswl
>>> +[ 	]+[0-9a-f]+:[ 	]+14959073[ 	]+csrw[ 	]+sscratchcswl,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+00702573[ 	]+csrr[ 	]+a0,utvt
>>> +[ 	]+[0-9a-f]+:[ 	]+00759073[ 	]+csrw[ 	]+utvt,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+04502573[ 	]+csrr[ 	]+a0,unxti
>>> +[ 	]+[0-9a-f]+:[ 	]+04559073[ 	]+csrw[ 	]+unxti,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+c4602573[ 	]+csrr[ 	]+a0,uintstatus
>>> +[ 	]+[0-9a-f]+:[ 	]+c4659073[ 	]+csrw[ 	]+uintstatus,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+04702573[ 	]+csrr[ 	]+a0,uintthresh
>>> +[ 	]+[0-9a-f]+:[ 	]+04759073[ 	]+csrw[ 	]+uintthresh,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+04802573[ 	]+csrr[ 	]+a0,uscratchcsw
>>> +[ 	]+[0-9a-f]+:[ 	]+04859073[ 	]+csrw[ 	]+uscratchcsw,a1
>>> +[ 	]+[0-9a-f]+:[ 	]+04902573[ 	]+csrr[ 	]+a0,uscratchcswl
>>> +[ 	]+[0-9a-f]+:[ 	]+04959073[ 	]+csrw[ 	]+uscratchcswl,a1
>>>  [ 	]+[0-9a-f]+:[ 	]+30c02573[ 	]+csrr[ 	]+a0,mstateen0
>>>  [ 	]+[0-9a-f]+:[ 	]+30c59073[ 	]+csrw[ 	]+mstateen0,a1
>>>  [ 	]+[0-9a-f]+:[ 	]+30d02573[ 	]+csrr[ 	]+a0,mstateen1
>>> diff --git a/gas/testsuite/gas/riscv/csr-version-1p9p1.l b/gas/testsuite/gas/riscv/csr-version-1p9p1.l
>>> index c65d0b48e414..22bed0aecfd0 100644
>>> --- a/gas/testsuite/gas/riscv/csr-version-1p9p1.l
>>> +++ b/gas/testsuite/gas/riscv/csr-version-1p9p1.l
>>> @@ -494,6 +494,45 @@
>>>  .*Warning: invalid CSR `miph', needs `smaia' extension
>>>  .*Warning: invalid CSR `miph', needs rv32i extension
>>>  .*Warning: invalid CSR `miph', needs `smaia' extension
>>> +.*Warning: invalid CSR `mtvt', needs `smclic' extension
>>> +.*Warning: invalid CSR `mtvt', needs `smclic' extension
>>> +.*Warning: invalid CSR `mnxti', needs `smclic' extension
>>> +.*Warning: invalid CSR `mnxti', needs `smclic' extension
>>> +.*Warning: invalid CSR `mintstatus', needs `smclic' extension
>>> +.*Warning: invalid CSR `mintstatus', needs `smclic' extension
>>> +.*Warning: read-only CSR is written `csrw mintstatus,a1'
>>> +.*Warning: invalid CSR `mintthresh', needs `smclic' extension
>>> +.*Warning: invalid CSR `mintthresh', needs `smclic' extension
>>> +.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
>>> +.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
>>> +.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
>>> +.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
>>> +.*Warning: invalid CSR `stvt', needs `smclic' extension
>>> +.*Warning: invalid CSR `stvt', needs `smclic' extension
>>> +.*Warning: invalid CSR `snxti', needs `smclic' extension
>>> +.*Warning: invalid CSR `snxti', needs `smclic' extension
>>> +.*Warning: invalid CSR `sintstatus', needs `smclic' extension
>>> +.*Warning: invalid CSR `sintstatus', needs `smclic' extension
>>> +.*Warning: read-only CSR is written `csrw sintstatus,a1'
>>> +.*Warning: invalid CSR `sintthresh', needs `smclic' extension
>>> +.*Warning: invalid CSR `sintthresh', needs `smclic' extension
>>> +.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
>>> +.*Warning: invalid CSR `sscratchcsw', needs `smclic' extension
>>> +.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
>>> +.*Warning: invalid CSR `sscratchcswl', needs `smclic' extension
>>> +.*Warning: invalid CSR `utvt', needs `smclic' extension
>>> +.*Warning: invalid CSR `utvt', needs `smclic' extension
>>> +.*Warning: invalid CSR `unxti', needs `smclic' extension
>>> +.*Warning: invalid CSR `unxti', needs `smclic' extension
>>> +.*Warning: invalid CSR `uintstatus', needs `smclic' extension
>>> +.*Warning: invalid CSR `uintstatus', needs `smclic' extension
>>> +.*Warning: read-only CSR is written `csrw uintstatus,a1'
>>> +.*Warning: invalid CSR `uintthresh', needs `smclic' extension
>>> +.*Warning: invalid CSR `uintthresh', needs `smclic' extension
>>> +.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
>>> +.*Warning: invalid CSR `uscratchcsw', needs `smclic' extension
>>> +.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
>>> +.*Warning: invalid CSR `uscratchcswl', needs `smclic' extension
>>>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>>>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>>>  .*Warning: invalid CSR `mstateen1', needs `smstateen' extension
>>> diff --git a/gas/testsuite/gas/riscv/csr.s b/gas/testsuite/gas/riscv/csr.s
>>> index c7406ce34c2e..29a0710df812 100644
>>> --- a/gas/testsuite/gas/riscv/csr.s
>>> +++ b/gas/testsuite/gas/riscv/csr.s
>>> @@ -350,6 +350,26 @@
>>>  	csr mviph
>>>  	csr miph
>>>
>>> +	# Smclic extension
>>> +	csr mtvt
>>> +	csr mnxti
>>> +	csr mintstatus
>>> +	csr mintthresh
>>> +	csr mscratchcsw
>>> +	csr mscratchcswl
>>> +	csr stvt
>>> +	csr snxti
>>> +	csr sintstatus
>>> +	csr sintthresh
>>> +	csr sscratchcsw
>>> +	csr sscratchcswl
>>> +	csr utvt
>>> +	csr unxti
>>> +	csr uintstatus
>>> +	csr uintthresh
>>> +	csr uscratchcsw
>>> +	csr uscratchcswl
>>> +
>>>  	# Smstateen/Ssstateen extensions
>>>  	csr mstateen0
>>>  	csr mstateen1
>>> diff --git a/include/opcode/riscv-opc.h b/include/opcode/riscv-opc.h
>>> index 06e3df0f5a63..3f072bf01b3c 100644
>>> --- a/include/opcode/riscv-opc.h
>>> +++ b/include/opcode/riscv-opc.h
>>> @@ -2673,6 +2673,25 @@
>>>  #define CSR_MVIENH   0x318
>>>  #define CSR_MVIPH    0x319
>>>  #define CSR_MIPH     0x354
>>> +/* Smclic extension CSR addresses (including user interrupts).  */
>>> +#define CSR_MTVT 0x307
>>> +#define CSR_MNXTI 0x345
>>> +#define CSR_MINTSTATUS 0xf46
>>> +#define CSR_MINTTHRESH 0x347
>>> +#define CSR_MSCRATCHCSW 0x348
>>> +#define CSR_MSCRATCHCSWL 0x349
>>> +#define CSR_STVT 0x107
>>> +#define CSR_SNXTI 0x145
>>> +#define CSR_SINTSTATUS 0xd46
>>> +#define CSR_SINTTHRESH 0x147
>>> +#define CSR_SSCRATCHCSW 0x148
>>> +#define CSR_SSCRATCHCSWL 0x149
>>> +#define CSR_UTVT 0x7
>>> +#define CSR_UNXTI 0x45
>>> +#define CSR_UINTSTATUS 0xc46
>>> +#define CSR_UINTTHRESH 0x47
>>> +#define CSR_USCRATCHCSW 0x48
>>> +#define CSR_USCRATCHCSWL 0x49
>>>  /* Smstateen extension */
>>>  #define CSR_MSTATEEN0 0x30c
>>>  #define CSR_MSTATEEN1 0x30d
>>> @@ -3550,6 +3569,25 @@ 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)
>>> +/* Smclic extension CSRs (including user interrupts).  */
>>> +DECLARE_CSR(mtvt, CSR_MTVT, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>>> +DECLARE_CSR(mnxti, CSR_MNXTI, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>>> +DECLARE_CSR(mintstatus, CSR_MINTSTATUS, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>>> +DECLARE_CSR(mintthresh, CSR_MINTTHRESH, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>>> +DECLARE_CSR(mscratchcsw, CSR_MSCRATCHCSW, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>>> +DECLARE_CSR(mscratchcswl, CSR_MSCRATCHCSWL, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>>> +DECLARE_CSR(stvt, CSR_STVT, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>>> +DECLARE_CSR(snxti, CSR_SNXTI, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>>> +DECLARE_CSR(sintstatus, CSR_SINTSTATUS, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>>> +DECLARE_CSR(sintthresh, CSR_SINTTHRESH, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>>> +DECLARE_CSR(sscratchcsw, CSR_SSCRATCHCSW, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>>> +DECLARE_CSR(sscratchcswl, CSR_SSCRATCHCSWL, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>>> +DECLARE_CSR(utvt, CSR_UTVT, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>>> +DECLARE_CSR(unxti, CSR_UNXTI, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>>> +DECLARE_CSR(uintstatus, CSR_UINTSTATUS, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>>> +DECLARE_CSR(uintthresh, CSR_UINTTHRESH, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>>> +DECLARE_CSR(uscratchcsw, CSR_USCRATCHCSW, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>>> +DECLARE_CSR(uscratchcswl, CSR_USCRATCHCSWL, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>>>  /* 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)
>>

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

* [REVIEW ONLY v2 0/1] UNRATIFIED RISC-V: Add support for Core-Local Interrupt Controller (CLIC) extensions and their CSRs
  2022-11-29  1:19 [REVIEW ONLY 0/1] UNRATIFIED RISC-V: Add 'Smclic' extension and its CSRs Tsukasa OI
  2022-11-29  1:19 ` [REVIEW ONLY 1/1] " Tsukasa OI
@ 2023-09-12  1:39 ` Tsukasa OI
  2023-09-12  1:39   ` [REVIEW ONLY v2 1/1] UNRATIFIED RISC-V: Add CLIC extensions with CSRs Tsukasa OI
  1 sibling, 1 reply; 7+ messages in thread
From: Tsukasa OI @ 2023-09-12  1:39 UTC (permalink / raw)
  To: Tsukasa OI; +Cc: binutils

*** WAIT FOR SPECIFICATION FREEZE ***
This is an implementation for unratified and not frozen RISC-V extension
and not intended to be merged for now.
The only intent to submit this patchset is to test new instructions for
your (possibly virtual) environment and early review for fast adoption
after ratification.

It's long since I submitted the previous version and it's a good time to
submit new REVIEW ONLY one, knowing if it's unratified.


Changes: v1 -> v2
*   Rebased against the latest master.
*   Added support for 'Smclicconfig', 'Smclicshv' and 'Ssclic' extensions
    (following the latest CLIC specification).
*   Added diagnostics-only support for the 'Suclic' extension (likewise).


This patchset adds following unratified extensions to GNU Binutils from the
Core-Local Interrupt Controller (CLIC) RISC-V Privileged Architecture
Extensions:

1.  'Smclic'
2.  'Smclicconfig'
3.  'Smclicshv'
4.  'Ssclic'
5.  'Suclic'
    (because 'N' extension support is now dropped by GNU Binutils,
     this extension is only supported to generate correct diagnostics
     that's why this extension is *not* in riscv_supported_std_s_ext).

that add 18 CSRs in total.

These extensions are software side of Core-Local Interrupt Controller (CLIC)
which provides lower latency local interrupts.


This is based on the specification document, version 0.9-draft:
<https://github.com/riscv/riscv-fast-interrupt/blob/894a16ce89dcf2c084dd951866448c2e756d3efa/clic.pdf>


Although that 18 CSRs are assigned with actual numbers (this is why I'm not
attaching "CSR instantiation" script in this patchset), it may be changed
before ratification.  Be careful.

Thanks,
Tsukasa




Tsukasa OI (1):
  UNRATIFIED RISC-V: Add CLIC extensions with CSRs

 bfd/elfxx-riscv.c                           | 10 ++-
 gas/config/tc-riscv.c                       | 12 ++++
 gas/testsuite/gas/riscv/csr-dw-regnums.d    | 17 +++++
 gas/testsuite/gas/riscv/csr-dw-regnums.s    | 18 +++++
 gas/testsuite/gas/riscv/csr-version-1p10.d  | 34 ++++++++++
 gas/testsuite/gas/riscv/csr-version-1p10.l  | 74 +++++++++++++++++++++
 gas/testsuite/gas/riscv/csr-version-1p11.d  | 34 ++++++++++
 gas/testsuite/gas/riscv/csr-version-1p11.l  | 74 +++++++++++++++++++++
 gas/testsuite/gas/riscv/csr-version-1p12.d  | 34 ++++++++++
 gas/testsuite/gas/riscv/csr-version-1p12.l  | 74 +++++++++++++++++++++
 gas/testsuite/gas/riscv/csr-version-1p9p1.d | 34 ++++++++++
 gas/testsuite/gas/riscv/csr-version-1p9p1.l | 74 +++++++++++++++++++++
 gas/testsuite/gas/riscv/csr.s               | 19 ++++++
 include/opcode/riscv-opc.h                  | 36 ++++++++++
 14 files changed, 543 insertions(+), 1 deletion(-)


base-commit: 318d3bda5cad124bd11eebb0349d0f183ba625b1
-- 
2.42.0


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

* [REVIEW ONLY v2 1/1] UNRATIFIED RISC-V: Add CLIC extensions with CSRs
  2023-09-12  1:39 ` [REVIEW ONLY v2 0/1] UNRATIFIED RISC-V: Add support for Core-Local Interrupt Controller (CLIC) extensions and their CSRs Tsukasa OI
@ 2023-09-12  1:39   ` Tsukasa OI
  0 siblings, 0 replies; 7+ messages in thread
From: Tsukasa OI @ 2023-09-12  1:39 UTC (permalink / raw)
  To: Tsukasa OI; +Cc: binutils

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

[DO NOT MERGE]
Until CLIC is frozen/ratified and final version number is determined,
this patch should not be merged upstream.  This commit uses unratified
version 0.9 as in the documentation (instead of possible 1.0 after
ratification).

This commit adds CSR and extension name support for Core-Local Interrupt
Controller (CLIC) extensions.  It adds following extensions:

1.  'Smclic'
    M-mode (and base) software-visible component of CLIC.
2.  'Ssclic'
    S-mode software-visible component of CLIC.
    Requires 'Smclic'.
3.  'Suclic' (partial support only)
    U-mode software-visible component of CLIC.
    Requires 'Smclic' and an extension which GNU Binutils does not
    currently support, 'N' (user-level interrupts).  So it is partially
    supported for disassembling and generating warnings on GAS.
4.  'Smclicshv'
    CLIC selective hardware vectoring extension.
    The current documentation does not say that this extension depends on
    'Smclic' but added to the implication list.
5.  'Smclicconfig'
    CLIC configuration extension.
    The current documentation does not say that this extension depends on
    'Smclic' but added to the implication list.

This is based on the latest Core-Local Interrupt Controller (CLIC)
extension draft (version 0.9-draft):
<https://github.com/riscv/riscv-fast-interrupt/blob/34ecab7bb960a544f7042219a2f71abb9cb1885f/clic.pdf>

bfd/ChangeLog:

	* elfxx-riscv.c (riscv_implicit_subsets): Add CLIC-related
	implications.  (riscv_supported_std_s_ext) Add CLIC-related
	extensions.

gas/ChangeLog:

	* config/tc-riscv.c (enum riscv_csr_class): Add new CSR classes.
	(riscv_csr_address): Add new CSR class handling.
	* testsuite/gas/riscv/csr.s: Add new CSR test.
	* testsuite/gas/riscv/csr-dw-regnums.s: Likewise.
	* testsuite/gas/riscv/csr-dw-regnums.d: Likewise.
	* 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_MTVT, CSR_MNXTI, CSR_MINTSTATUS,
	CSR_MINTTHRESH, CSR_MSCRATCHCSW, CSR_MSCRATCHCSWL, CSR_STVT,
	CSR_SNXTI, CSR_SINTSTATUS, CSR_SINTTHRESH, CSR_SSCRATCHCSW,
	CSR_SSCRATCHCSWL, CSR_UTVT, CSR_UNXTI, CSR_UINTSTATUS,
	CSR_UINTTHRESH, CSR_USCRATCHCSWL): New.
---
 bfd/elfxx-riscv.c                           | 10 ++-
 gas/config/tc-riscv.c                       | 12 ++++
 gas/testsuite/gas/riscv/csr-dw-regnums.d    | 17 +++++
 gas/testsuite/gas/riscv/csr-dw-regnums.s    | 18 +++++
 gas/testsuite/gas/riscv/csr-version-1p10.d  | 34 ++++++++++
 gas/testsuite/gas/riscv/csr-version-1p10.l  | 74 +++++++++++++++++++++
 gas/testsuite/gas/riscv/csr-version-1p11.d  | 34 ++++++++++
 gas/testsuite/gas/riscv/csr-version-1p11.l  | 74 +++++++++++++++++++++
 gas/testsuite/gas/riscv/csr-version-1p12.d  | 34 ++++++++++
 gas/testsuite/gas/riscv/csr-version-1p12.l  | 74 +++++++++++++++++++++
 gas/testsuite/gas/riscv/csr-version-1p9p1.d | 34 ++++++++++
 gas/testsuite/gas/riscv/csr-version-1p9p1.l | 74 +++++++++++++++++++++
 gas/testsuite/gas/riscv/csr.s               | 19 ++++++
 include/opcode/riscv-opc.h                  | 36 ++++++++++
 14 files changed, 543 insertions(+), 1 deletion(-)

diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
index 6ed657171f0f..cd5033d0798a 100644
--- a/bfd/elfxx-riscv.c
+++ b/bfd/elfxx-riscv.c
@@ -1182,10 +1182,14 @@ static struct riscv_implicit_subset riscv_implicit_subsets[] =
   {"zcf", "zca",	check_implicit_always},
   {"zcd", "zca",	check_implicit_always},
   {"zcb", "zca",	check_implicit_always},
+  {"ssclic", "smclic",		check_implicit_always},
   {"smaia", "ssaia",		check_implicit_always},
+  {"smclicconfig", "smclic",	check_implicit_always},
+  {"smclicshv", "smclic",	check_implicit_always},
+  {"smclic", "zicsr",		check_implicit_always},
   {"smcntrpmf", "zicsr",	check_implicit_always},
-  {"smstateen", "ssstateen",	check_implicit_always},
   {"smepmp", "zicsr",		check_implicit_always},
+  {"smstateen", "ssstateen",	check_implicit_always},
   {"ssaia", "zicsr",		check_implicit_always},
   {"sscofpmf", "zicsr",		check_implicit_always},
   {"ssstateen", "zicsr",	check_implicit_always},
@@ -1330,10 +1334,14 @@ 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 },
+  {"smclic",		ISA_SPEC_CLASS_DRAFT,		0, 9, 0 },
+  {"smclicconfig",	ISA_SPEC_CLASS_DRAFT,		0, 9, 0 },
+  {"smclicshv",		ISA_SPEC_CLASS_DRAFT,		0, 9, 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 },
+  {"ssclic",		ISA_SPEC_CLASS_DRAFT,		0, 9, 0 },
   {"sscofpmf",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
   {"ssstateen",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
   {"sstc",		ISA_SPEC_CLASS_DRAFT,		1, 0, 0 },
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index cf6e0d8b0150..e0b6e0f06c0c 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -74,6 +74,7 @@ enum riscv_csr_class
   CSR_CLASS_H_32,	/* hypervisor, rv32 only */
   CSR_CLASS_SMAIA,		/* Smaia */
   CSR_CLASS_SMAIA_32,		/* Smaia, rv32 only */
+  CSR_CLASS_SMCLIC,		/* Smclic only */
   CSR_CLASS_SMCNTRPMF,		/* Smcntrpmf */
   CSR_CLASS_SMCNTRPMF_32,	/* Smcntrpmf, rv32 only */
   CSR_CLASS_SMSTATEEN,		/* Smstateen only */
@@ -82,6 +83,7 @@ enum riscv_csr_class
   CSR_CLASS_SSAIA_AND_H,	/* Ssaia with H */
   CSR_CLASS_SSAIA_32,		/* Ssaia, rv32 only */
   CSR_CLASS_SSAIA_AND_H_32,	/* Ssaia with H, rv32 only */
+  CSR_CLASS_SSCLIC,		/* Ssclic only */
   CSR_CLASS_SSSTATEEN,		/* S[ms]stateen only */
   CSR_CLASS_SSSTATEEN_AND_H,	/* S[ms]stateen only (with H) */
   CSR_CLASS_SSSTATEEN_AND_H_32,	/* S[ms]stateen RV32 only (with H) */
@@ -91,6 +93,7 @@ enum riscv_csr_class
   CSR_CLASS_SSTC_AND_H,		/* Sstc only (with H) */
   CSR_CLASS_SSTC_32,		/* Sstc RV32 only */
   CSR_CLASS_SSTC_AND_H_32,	/* Sstc RV32 only (with H) */
+  CSR_CLASS_SUCLIC,		/* Suclic only (not really supported yet) */
 };
 
 /* This structure holds all restricted conditions for a CSR.  */
@@ -1054,6 +1057,9 @@ riscv_csr_address (const char *csr_name,
     case CSR_CLASS_SMAIA:
       extension = "smaia";
       break;
+    case CSR_CLASS_SMCLIC:
+      extension = "smclic";
+      break;
     case CSR_CLASS_SMCNTRPMF_32:
       is_rv32_only = true;
       /* Fall through.  */
@@ -1086,6 +1092,9 @@ riscv_csr_address (const char *csr_name,
     case CSR_CLASS_SSSTATEEN:
       extension = "ssstateen";
       break;
+    case CSR_CLASS_SSCLIC:
+      extension = "ssclic";
+      break;
     case CSR_CLASS_SSCOFPMF_32:
       is_rv32_only = true;
       /* Fall through.  */
@@ -1102,6 +1111,9 @@ riscv_csr_address (const char *csr_name,
 		      || csr_class == CSR_CLASS_SSTC_AND_H_32);
       extension = "sstc";
       break;
+    case CSR_CLASS_SUCLIC:
+      extension = "suclic";
+      break;
     case CSR_CLASS_DEBUG:
       break;
     default:
diff --git a/gas/testsuite/gas/riscv/csr-dw-regnums.d b/gas/testsuite/gas/riscv/csr-dw-regnums.d
index cabb7c719181..0d18c1eee1d5 100644
--- a/gas/testsuite/gas/riscv/csr-dw-regnums.d
+++ b/gas/testsuite/gas/riscv/csr-dw-regnums.d
@@ -324,6 +324,23 @@ 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: r4871 \(mtvt\) at cfa\+3100
+  DW_CFA_offset_extended_sf: r4933 \(mnxti\) at cfa\+3348
+  DW_CFA_offset_extended_sf: r8113 \(mintstatus\) at cfa\+16068
+  DW_CFA_offset_extended_sf: r4935 \(mintthresh\) at cfa\+3356
+  DW_CFA_offset_extended_sf: r4936 \(mscratchcsw\) at cfa\+3360
+  DW_CFA_offset_extended_sf: r4937 \(mscratchcswl\) at cfa\+3364
+  DW_CFA_offset_extended_sf: r4359 \(stvt\) at cfa\+1052
+  DW_CFA_offset_extended_sf: r4421 \(snxti\) at cfa\+1300
+  DW_CFA_offset_extended_sf: r7601 \(sintstatus\) at cfa\+14020
+  DW_CFA_offset_extended_sf: r4423 \(sintthresh\) at cfa\+1308
+  DW_CFA_offset_extended_sf: r4424 \(sscratchcsw\) at cfa\+1312
+  DW_CFA_offset_extended_sf: r4425 \(sscratchcswl\) at cfa\+1316
+  DW_CFA_offset_extended_sf: r4103 \(utvt\) at cfa\+28
+  DW_CFA_offset_extended_sf: r4165 \(unxti\) at cfa\+276
+  DW_CFA_offset_extended_sf: r7345 \(uintstatus\) at cfa\+12996
+  DW_CFA_offset_extended_sf: r4167 \(uintthresh\) at cfa\+284
+  DW_CFA_offset_extended_sf: r4169 \(uscratchcswl\) at cfa\+292
   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
diff --git a/gas/testsuite/gas/riscv/csr-dw-regnums.s b/gas/testsuite/gas/riscv/csr-dw-regnums.s
index 428d07707790..37b48fa973ad 100644
--- a/gas/testsuite/gas/riscv/csr-dw-regnums.s
+++ b/gas/testsuite/gas/riscv/csr-dw-regnums.s
@@ -321,6 +321,24 @@ _start:
 	.cfi_offset mvienh, 3168
 	.cfi_offset mviph, 3172
 	.cfi_offset miph, 3408
+	# Smclic/Ssclic/Suclic extensions
+	.cfi_offset mtvt, 3100
+	.cfi_offset mnxti, 3348
+	.cfi_offset mintstatus, 16068
+	.cfi_offset mintthresh, 3356
+	.cfi_offset mscratchcsw, 3360
+	.cfi_offset mscratchcswl, 3364
+	.cfi_offset stvt, 1052
+	.cfi_offset snxti, 1300
+	.cfi_offset sintstatus, 14020
+	.cfi_offset sintthresh, 1308
+	.cfi_offset sscratchcsw, 1312
+	.cfi_offset sscratchcswl, 1316
+	.cfi_offset utvt, 28
+	.cfi_offset unxti, 276
+	.cfi_offset uintstatus, 12996
+	.cfi_offset uintthresh, 284
+	.cfi_offset uscratchcswl, 292
 	# Smcntrpmf extension
 	.cfi_offset mcyclecfg, 3204
 	.cfi_offset minstretcfg, 3208
diff --git a/gas/testsuite/gas/riscv/csr-version-1p10.d b/gas/testsuite/gas/riscv/csr-version-1p10.d
index dbdc077adac8..1168851b2097 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p10.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p10.d
@@ -623,6 +623,40 @@ 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]+:[ 	]+30702573[ 	]+csrr[ 	]+a0,mtvt
+[ 	]+[0-9a-f]+:[ 	]+30759073[ 	]+csrw[ 	]+mtvt,a1
+[ 	]+[0-9a-f]+:[ 	]+34502573[ 	]+csrr[ 	]+a0,mnxti
+[ 	]+[0-9a-f]+:[ 	]+34559073[ 	]+csrw[ 	]+mnxti,a1
+[ 	]+[0-9a-f]+:[ 	]+fb102573[ 	]+csrr[ 	]+a0,mintstatus
+[ 	]+[0-9a-f]+:[ 	]+fb159073[ 	]+csrw[ 	]+mintstatus,a1
+[ 	]+[0-9a-f]+:[ 	]+34702573[ 	]+csrr[ 	]+a0,mintthresh
+[ 	]+[0-9a-f]+:[ 	]+34759073[ 	]+csrw[ 	]+mintthresh,a1
+[ 	]+[0-9a-f]+:[ 	]+34802573[ 	]+csrr[ 	]+a0,mscratchcsw
+[ 	]+[0-9a-f]+:[ 	]+34859073[ 	]+csrw[ 	]+mscratchcsw,a1
+[ 	]+[0-9a-f]+:[ 	]+34902573[ 	]+csrr[ 	]+a0,mscratchcswl
+[ 	]+[0-9a-f]+:[ 	]+34959073[ 	]+csrw[ 	]+mscratchcswl,a1
+[ 	]+[0-9a-f]+:[ 	]+10702573[ 	]+csrr[ 	]+a0,stvt
+[ 	]+[0-9a-f]+:[ 	]+10759073[ 	]+csrw[ 	]+stvt,a1
+[ 	]+[0-9a-f]+:[ 	]+14502573[ 	]+csrr[ 	]+a0,snxti
+[ 	]+[0-9a-f]+:[ 	]+14559073[ 	]+csrw[ 	]+snxti,a1
+[ 	]+[0-9a-f]+:[ 	]+db102573[ 	]+csrr[ 	]+a0,sintstatus
+[ 	]+[0-9a-f]+:[ 	]+db159073[ 	]+csrw[ 	]+sintstatus,a1
+[ 	]+[0-9a-f]+:[ 	]+14702573[ 	]+csrr[ 	]+a0,sintthresh
+[ 	]+[0-9a-f]+:[ 	]+14759073[ 	]+csrw[ 	]+sintthresh,a1
+[ 	]+[0-9a-f]+:[ 	]+14802573[ 	]+csrr[ 	]+a0,sscratchcsw
+[ 	]+[0-9a-f]+:[ 	]+14859073[ 	]+csrw[ 	]+sscratchcsw,a1
+[ 	]+[0-9a-f]+:[ 	]+14902573[ 	]+csrr[ 	]+a0,sscratchcswl
+[ 	]+[0-9a-f]+:[ 	]+14959073[ 	]+csrw[ 	]+sscratchcswl,a1
+[ 	]+[0-9a-f]+:[ 	]+00702573[ 	]+csrr[ 	]+a0,utvt
+[ 	]+[0-9a-f]+:[ 	]+00759073[ 	]+csrw[ 	]+utvt,a1
+[ 	]+[0-9a-f]+:[ 	]+04502573[ 	]+csrr[ 	]+a0,unxti
+[ 	]+[0-9a-f]+:[ 	]+04559073[ 	]+csrw[ 	]+unxti,a1
+[ 	]+[0-9a-f]+:[ 	]+cb102573[ 	]+csrr[ 	]+a0,uintstatus
+[ 	]+[0-9a-f]+:[ 	]+cb159073[ 	]+csrw[ 	]+uintstatus,a1
+[ 	]+[0-9a-f]+:[ 	]+04702573[ 	]+csrr[ 	]+a0,uintthresh
+[ 	]+[0-9a-f]+:[ 	]+04759073[ 	]+csrw[ 	]+uintthresh,a1
+[ 	]+[0-9a-f]+:[ 	]+04902573[ 	]+csrr[ 	]+a0,uscratchcswl
+[ 	]+[0-9a-f]+:[ 	]+04959073[ 	]+csrw[ 	]+uscratchcswl,a1
 [ 	]+[0-9a-f]+:[ 	]+32102573[ 	]+csrr[ 	]+a0,mcyclecfg
 [ 	]+[0-9a-f]+:[ 	]+32159073[ 	]+csrw[ 	]+mcyclecfg,a1
 [ 	]+[0-9a-f]+:[ 	]+32202573[ 	]+csrr[ 	]+a0,minstretcfg
diff --git a/gas/testsuite/gas/riscv/csr-version-1p10.l b/gas/testsuite/gas/riscv/csr-version-1p10.l
index 054179a416db..80e79300f3f2 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p10.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p10.l
@@ -889,6 +889,80 @@
 .*Info: macro .*
 .*Warning: invalid CSR `miph', needs `smaia' extension
 .*Info: macro .*
+.*Warning: invalid CSR `mtvt', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mtvt', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mnxti', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mnxti', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mintstatus', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mintstatus', needs `smclic' extension
+.*Info: macro .*
+.*Warning: read-only CSR is written `csrw mintstatus,a1'
+.*Info: macro .*
+.*Warning: invalid CSR `mintthresh', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mintthresh', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `stvt', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `stvt', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `snxti', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `snxti', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sintstatus', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sintstatus', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: read-only CSR is written `csrw sintstatus,a1'
+.*Info: macro .*
+.*Warning: invalid CSR `sintthresh', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sintthresh', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sscratchcsw', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sscratchcsw', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sscratchcswl', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sscratchcswl', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `utvt', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `utvt', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `unxti', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `unxti', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `uintstatus', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `uintstatus', needs `suclic' extension
+.*Info: macro .*
+.*Warning: read-only CSR is written `csrw uintstatus,a1'
+.*Info: macro .*
+.*Warning: invalid CSR `uintthresh', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `uintthresh', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `uscratchcswl', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `uscratchcswl', needs `suclic' extension
+.*Info: macro .*
 .*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
 .*Info: macro .*
 .*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
diff --git a/gas/testsuite/gas/riscv/csr-version-1p11.d b/gas/testsuite/gas/riscv/csr-version-1p11.d
index 7ba88b6d1d53..78f12e17961e 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p11.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p11.d
@@ -623,6 +623,40 @@ 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]+:[ 	]+30702573[ 	]+csrr[ 	]+a0,mtvt
+[ 	]+[0-9a-f]+:[ 	]+30759073[ 	]+csrw[ 	]+mtvt,a1
+[ 	]+[0-9a-f]+:[ 	]+34502573[ 	]+csrr[ 	]+a0,mnxti
+[ 	]+[0-9a-f]+:[ 	]+34559073[ 	]+csrw[ 	]+mnxti,a1
+[ 	]+[0-9a-f]+:[ 	]+fb102573[ 	]+csrr[ 	]+a0,mintstatus
+[ 	]+[0-9a-f]+:[ 	]+fb159073[ 	]+csrw[ 	]+mintstatus,a1
+[ 	]+[0-9a-f]+:[ 	]+34702573[ 	]+csrr[ 	]+a0,mintthresh
+[ 	]+[0-9a-f]+:[ 	]+34759073[ 	]+csrw[ 	]+mintthresh,a1
+[ 	]+[0-9a-f]+:[ 	]+34802573[ 	]+csrr[ 	]+a0,mscratchcsw
+[ 	]+[0-9a-f]+:[ 	]+34859073[ 	]+csrw[ 	]+mscratchcsw,a1
+[ 	]+[0-9a-f]+:[ 	]+34902573[ 	]+csrr[ 	]+a0,mscratchcswl
+[ 	]+[0-9a-f]+:[ 	]+34959073[ 	]+csrw[ 	]+mscratchcswl,a1
+[ 	]+[0-9a-f]+:[ 	]+10702573[ 	]+csrr[ 	]+a0,stvt
+[ 	]+[0-9a-f]+:[ 	]+10759073[ 	]+csrw[ 	]+stvt,a1
+[ 	]+[0-9a-f]+:[ 	]+14502573[ 	]+csrr[ 	]+a0,snxti
+[ 	]+[0-9a-f]+:[ 	]+14559073[ 	]+csrw[ 	]+snxti,a1
+[ 	]+[0-9a-f]+:[ 	]+db102573[ 	]+csrr[ 	]+a0,sintstatus
+[ 	]+[0-9a-f]+:[ 	]+db159073[ 	]+csrw[ 	]+sintstatus,a1
+[ 	]+[0-9a-f]+:[ 	]+14702573[ 	]+csrr[ 	]+a0,sintthresh
+[ 	]+[0-9a-f]+:[ 	]+14759073[ 	]+csrw[ 	]+sintthresh,a1
+[ 	]+[0-9a-f]+:[ 	]+14802573[ 	]+csrr[ 	]+a0,sscratchcsw
+[ 	]+[0-9a-f]+:[ 	]+14859073[ 	]+csrw[ 	]+sscratchcsw,a1
+[ 	]+[0-9a-f]+:[ 	]+14902573[ 	]+csrr[ 	]+a0,sscratchcswl
+[ 	]+[0-9a-f]+:[ 	]+14959073[ 	]+csrw[ 	]+sscratchcswl,a1
+[ 	]+[0-9a-f]+:[ 	]+00702573[ 	]+csrr[ 	]+a0,utvt
+[ 	]+[0-9a-f]+:[ 	]+00759073[ 	]+csrw[ 	]+utvt,a1
+[ 	]+[0-9a-f]+:[ 	]+04502573[ 	]+csrr[ 	]+a0,unxti
+[ 	]+[0-9a-f]+:[ 	]+04559073[ 	]+csrw[ 	]+unxti,a1
+[ 	]+[0-9a-f]+:[ 	]+cb102573[ 	]+csrr[ 	]+a0,uintstatus
+[ 	]+[0-9a-f]+:[ 	]+cb159073[ 	]+csrw[ 	]+uintstatus,a1
+[ 	]+[0-9a-f]+:[ 	]+04702573[ 	]+csrr[ 	]+a0,uintthresh
+[ 	]+[0-9a-f]+:[ 	]+04759073[ 	]+csrw[ 	]+uintthresh,a1
+[ 	]+[0-9a-f]+:[ 	]+04902573[ 	]+csrr[ 	]+a0,uscratchcswl
+[ 	]+[0-9a-f]+:[ 	]+04959073[ 	]+csrw[ 	]+uscratchcswl,a1
 [ 	]+[0-9a-f]+:[ 	]+32102573[ 	]+csrr[ 	]+a0,mcyclecfg
 [ 	]+[0-9a-f]+:[ 	]+32159073[ 	]+csrw[ 	]+mcyclecfg,a1
 [ 	]+[0-9a-f]+:[ 	]+32202573[ 	]+csrr[ 	]+a0,minstretcfg
diff --git a/gas/testsuite/gas/riscv/csr-version-1p11.l b/gas/testsuite/gas/riscv/csr-version-1p11.l
index cc365f1df415..9c6c2523d9fc 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p11.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p11.l
@@ -885,6 +885,80 @@
 .*Info: macro .*
 .*Warning: invalid CSR `miph', needs `smaia' extension
 .*Info: macro .*
+.*Warning: invalid CSR `mtvt', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mtvt', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mnxti', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mnxti', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mintstatus', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mintstatus', needs `smclic' extension
+.*Info: macro .*
+.*Warning: read-only CSR is written `csrw mintstatus,a1'
+.*Info: macro .*
+.*Warning: invalid CSR `mintthresh', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mintthresh', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `stvt', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `stvt', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `snxti', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `snxti', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sintstatus', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sintstatus', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: read-only CSR is written `csrw sintstatus,a1'
+.*Info: macro .*
+.*Warning: invalid CSR `sintthresh', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sintthresh', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sscratchcsw', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sscratchcsw', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sscratchcswl', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sscratchcswl', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `utvt', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `utvt', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `unxti', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `unxti', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `uintstatus', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `uintstatus', needs `suclic' extension
+.*Info: macro .*
+.*Warning: read-only CSR is written `csrw uintstatus,a1'
+.*Info: macro .*
+.*Warning: invalid CSR `uintthresh', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `uintthresh', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `uscratchcswl', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `uscratchcswl', needs `suclic' extension
+.*Info: macro .*
 .*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
 .*Info: macro .*
 .*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
diff --git a/gas/testsuite/gas/riscv/csr-version-1p12.d b/gas/testsuite/gas/riscv/csr-version-1p12.d
index 677820b95265..8fe27e77e121 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p12.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p12.d
@@ -623,6 +623,40 @@ 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]+:[ 	]+30702573[ 	]+csrr[ 	]+a0,mtvt
+[ 	]+[0-9a-f]+:[ 	]+30759073[ 	]+csrw[ 	]+mtvt,a1
+[ 	]+[0-9a-f]+:[ 	]+34502573[ 	]+csrr[ 	]+a0,mnxti
+[ 	]+[0-9a-f]+:[ 	]+34559073[ 	]+csrw[ 	]+mnxti,a1
+[ 	]+[0-9a-f]+:[ 	]+fb102573[ 	]+csrr[ 	]+a0,mintstatus
+[ 	]+[0-9a-f]+:[ 	]+fb159073[ 	]+csrw[ 	]+mintstatus,a1
+[ 	]+[0-9a-f]+:[ 	]+34702573[ 	]+csrr[ 	]+a0,mintthresh
+[ 	]+[0-9a-f]+:[ 	]+34759073[ 	]+csrw[ 	]+mintthresh,a1
+[ 	]+[0-9a-f]+:[ 	]+34802573[ 	]+csrr[ 	]+a0,mscratchcsw
+[ 	]+[0-9a-f]+:[ 	]+34859073[ 	]+csrw[ 	]+mscratchcsw,a1
+[ 	]+[0-9a-f]+:[ 	]+34902573[ 	]+csrr[ 	]+a0,mscratchcswl
+[ 	]+[0-9a-f]+:[ 	]+34959073[ 	]+csrw[ 	]+mscratchcswl,a1
+[ 	]+[0-9a-f]+:[ 	]+10702573[ 	]+csrr[ 	]+a0,stvt
+[ 	]+[0-9a-f]+:[ 	]+10759073[ 	]+csrw[ 	]+stvt,a1
+[ 	]+[0-9a-f]+:[ 	]+14502573[ 	]+csrr[ 	]+a0,snxti
+[ 	]+[0-9a-f]+:[ 	]+14559073[ 	]+csrw[ 	]+snxti,a1
+[ 	]+[0-9a-f]+:[ 	]+db102573[ 	]+csrr[ 	]+a0,sintstatus
+[ 	]+[0-9a-f]+:[ 	]+db159073[ 	]+csrw[ 	]+sintstatus,a1
+[ 	]+[0-9a-f]+:[ 	]+14702573[ 	]+csrr[ 	]+a0,sintthresh
+[ 	]+[0-9a-f]+:[ 	]+14759073[ 	]+csrw[ 	]+sintthresh,a1
+[ 	]+[0-9a-f]+:[ 	]+14802573[ 	]+csrr[ 	]+a0,sscratchcsw
+[ 	]+[0-9a-f]+:[ 	]+14859073[ 	]+csrw[ 	]+sscratchcsw,a1
+[ 	]+[0-9a-f]+:[ 	]+14902573[ 	]+csrr[ 	]+a0,sscratchcswl
+[ 	]+[0-9a-f]+:[ 	]+14959073[ 	]+csrw[ 	]+sscratchcswl,a1
+[ 	]+[0-9a-f]+:[ 	]+00702573[ 	]+csrr[ 	]+a0,utvt
+[ 	]+[0-9a-f]+:[ 	]+00759073[ 	]+csrw[ 	]+utvt,a1
+[ 	]+[0-9a-f]+:[ 	]+04502573[ 	]+csrr[ 	]+a0,unxti
+[ 	]+[0-9a-f]+:[ 	]+04559073[ 	]+csrw[ 	]+unxti,a1
+[ 	]+[0-9a-f]+:[ 	]+cb102573[ 	]+csrr[ 	]+a0,uintstatus
+[ 	]+[0-9a-f]+:[ 	]+cb159073[ 	]+csrw[ 	]+uintstatus,a1
+[ 	]+[0-9a-f]+:[ 	]+04702573[ 	]+csrr[ 	]+a0,uintthresh
+[ 	]+[0-9a-f]+:[ 	]+04759073[ 	]+csrw[ 	]+uintthresh,a1
+[ 	]+[0-9a-f]+:[ 	]+04902573[ 	]+csrr[ 	]+a0,uscratchcswl
+[ 	]+[0-9a-f]+:[ 	]+04959073[ 	]+csrw[ 	]+uscratchcswl,a1
 [ 	]+[0-9a-f]+:[ 	]+32102573[ 	]+csrr[ 	]+a0,mcyclecfg
 [ 	]+[0-9a-f]+:[ 	]+32159073[ 	]+csrw[ 	]+mcyclecfg,a1
 [ 	]+[0-9a-f]+:[ 	]+32202573[ 	]+csrr[ 	]+a0,minstretcfg
diff --git a/gas/testsuite/gas/riscv/csr-version-1p12.l b/gas/testsuite/gas/riscv/csr-version-1p12.l
index 7a7f5f717c52..491cf0dac408 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p12.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p12.l
@@ -609,6 +609,80 @@
 .*Info: macro .*
 .*Warning: invalid CSR `miph', needs `smaia' extension
 .*Info: macro .*
+.*Warning: invalid CSR `mtvt', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mtvt', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mnxti', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mnxti', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mintstatus', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mintstatus', needs `smclic' extension
+.*Info: macro .*
+.*Warning: read-only CSR is written `csrw mintstatus,a1'
+.*Info: macro .*
+.*Warning: invalid CSR `mintthresh', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mintthresh', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `stvt', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `stvt', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `snxti', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `snxti', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sintstatus', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sintstatus', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: read-only CSR is written `csrw sintstatus,a1'
+.*Info: macro .*
+.*Warning: invalid CSR `sintthresh', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sintthresh', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sscratchcsw', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sscratchcsw', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sscratchcswl', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sscratchcswl', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `utvt', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `utvt', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `unxti', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `unxti', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `uintstatus', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `uintstatus', needs `suclic' extension
+.*Info: macro .*
+.*Warning: read-only CSR is written `csrw uintstatus,a1'
+.*Info: macro .*
+.*Warning: invalid CSR `uintthresh', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `uintthresh', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `uscratchcswl', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `uscratchcswl', needs `suclic' extension
+.*Info: macro .*
 .*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
 .*Info: macro .*
 .*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
diff --git a/gas/testsuite/gas/riscv/csr-version-1p9p1.d b/gas/testsuite/gas/riscv/csr-version-1p9p1.d
index f4d2b04ca6a4..3f792b3ae001 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p9p1.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p9p1.d
@@ -623,6 +623,40 @@ 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]+:[ 	]+30702573[ 	]+csrr[ 	]+a0,mtvt
+[ 	]+[0-9a-f]+:[ 	]+30759073[ 	]+csrw[ 	]+mtvt,a1
+[ 	]+[0-9a-f]+:[ 	]+34502573[ 	]+csrr[ 	]+a0,mnxti
+[ 	]+[0-9a-f]+:[ 	]+34559073[ 	]+csrw[ 	]+mnxti,a1
+[ 	]+[0-9a-f]+:[ 	]+fb102573[ 	]+csrr[ 	]+a0,mintstatus
+[ 	]+[0-9a-f]+:[ 	]+fb159073[ 	]+csrw[ 	]+mintstatus,a1
+[ 	]+[0-9a-f]+:[ 	]+34702573[ 	]+csrr[ 	]+a0,mintthresh
+[ 	]+[0-9a-f]+:[ 	]+34759073[ 	]+csrw[ 	]+mintthresh,a1
+[ 	]+[0-9a-f]+:[ 	]+34802573[ 	]+csrr[ 	]+a0,mscratchcsw
+[ 	]+[0-9a-f]+:[ 	]+34859073[ 	]+csrw[ 	]+mscratchcsw,a1
+[ 	]+[0-9a-f]+:[ 	]+34902573[ 	]+csrr[ 	]+a0,mscratchcswl
+[ 	]+[0-9a-f]+:[ 	]+34959073[ 	]+csrw[ 	]+mscratchcswl,a1
+[ 	]+[0-9a-f]+:[ 	]+10702573[ 	]+csrr[ 	]+a0,stvt
+[ 	]+[0-9a-f]+:[ 	]+10759073[ 	]+csrw[ 	]+stvt,a1
+[ 	]+[0-9a-f]+:[ 	]+14502573[ 	]+csrr[ 	]+a0,snxti
+[ 	]+[0-9a-f]+:[ 	]+14559073[ 	]+csrw[ 	]+snxti,a1
+[ 	]+[0-9a-f]+:[ 	]+db102573[ 	]+csrr[ 	]+a0,sintstatus
+[ 	]+[0-9a-f]+:[ 	]+db159073[ 	]+csrw[ 	]+sintstatus,a1
+[ 	]+[0-9a-f]+:[ 	]+14702573[ 	]+csrr[ 	]+a0,sintthresh
+[ 	]+[0-9a-f]+:[ 	]+14759073[ 	]+csrw[ 	]+sintthresh,a1
+[ 	]+[0-9a-f]+:[ 	]+14802573[ 	]+csrr[ 	]+a0,sscratchcsw
+[ 	]+[0-9a-f]+:[ 	]+14859073[ 	]+csrw[ 	]+sscratchcsw,a1
+[ 	]+[0-9a-f]+:[ 	]+14902573[ 	]+csrr[ 	]+a0,sscratchcswl
+[ 	]+[0-9a-f]+:[ 	]+14959073[ 	]+csrw[ 	]+sscratchcswl,a1
+[ 	]+[0-9a-f]+:[ 	]+00702573[ 	]+csrr[ 	]+a0,utvt
+[ 	]+[0-9a-f]+:[ 	]+00759073[ 	]+csrw[ 	]+utvt,a1
+[ 	]+[0-9a-f]+:[ 	]+04502573[ 	]+csrr[ 	]+a0,unxti
+[ 	]+[0-9a-f]+:[ 	]+04559073[ 	]+csrw[ 	]+unxti,a1
+[ 	]+[0-9a-f]+:[ 	]+cb102573[ 	]+csrr[ 	]+a0,uintstatus
+[ 	]+[0-9a-f]+:[ 	]+cb159073[ 	]+csrw[ 	]+uintstatus,a1
+[ 	]+[0-9a-f]+:[ 	]+04702573[ 	]+csrr[ 	]+a0,uintthresh
+[ 	]+[0-9a-f]+:[ 	]+04759073[ 	]+csrw[ 	]+uintthresh,a1
+[ 	]+[0-9a-f]+:[ 	]+04902573[ 	]+csrr[ 	]+a0,uscratchcswl
+[ 	]+[0-9a-f]+:[ 	]+04959073[ 	]+csrw[ 	]+uscratchcswl,a1
 [ 	]+[0-9a-f]+:[ 	]+32102573[ 	]+csrr[ 	]+a0,mscounteren
 [ 	]+[0-9a-f]+:[ 	]+32159073[ 	]+csrw[ 	]+mscounteren,a1
 [ 	]+[0-9a-f]+:[ 	]+32202573[ 	]+csrr[ 	]+a0,mhcounteren
diff --git a/gas/testsuite/gas/riscv/csr-version-1p9p1.l b/gas/testsuite/gas/riscv/csr-version-1p9p1.l
index 7fcd73ab7ddd..223bc42784b4 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p9p1.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p9p1.l
@@ -989,6 +989,80 @@
 .*Info: macro .*
 .*Warning: invalid CSR `miph', needs `smaia' extension
 .*Info: macro .*
+.*Warning: invalid CSR `mtvt', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mtvt', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mnxti', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mnxti', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mintstatus', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mintstatus', needs `smclic' extension
+.*Info: macro .*
+.*Warning: read-only CSR is written `csrw mintstatus,a1'
+.*Info: macro .*
+.*Warning: invalid CSR `mintthresh', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mintthresh', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mscratchcsw', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mscratchcswl', needs `smclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `stvt', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `stvt', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `snxti', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `snxti', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sintstatus', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sintstatus', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: read-only CSR is written `csrw sintstatus,a1'
+.*Info: macro .*
+.*Warning: invalid CSR `sintthresh', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sintthresh', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sscratchcsw', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sscratchcsw', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sscratchcswl', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `sscratchcswl', needs `ssclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `utvt', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `utvt', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `unxti', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `unxti', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `uintstatus', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `uintstatus', needs `suclic' extension
+.*Info: macro .*
+.*Warning: read-only CSR is written `csrw uintstatus,a1'
+.*Info: macro .*
+.*Warning: invalid CSR `uintthresh', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `uintthresh', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `uscratchcswl', needs `suclic' extension
+.*Info: macro .*
+.*Warning: invalid CSR `uscratchcswl', needs `suclic' extension
+.*Info: macro .*
 .*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
 .*Info: macro .*
 .*Warning: invalid CSR `mcyclecfg' for the privileged spec `1.9.1'
diff --git a/gas/testsuite/gas/riscv/csr.s b/gas/testsuite/gas/riscv/csr.s
index 3d8da5488a04..14673ce16a96 100644
--- a/gas/testsuite/gas/riscv/csr.s
+++ b/gas/testsuite/gas/riscv/csr.s
@@ -350,6 +350,25 @@
 	csr mviph
 	csr miph
 
+	# Smclic/Ssclic/Suclic extensions
+	csr mtvt
+	csr mnxti
+	csr mintstatus
+	csr mintthresh
+	csr mscratchcsw
+	csr mscratchcswl
+	csr stvt
+	csr snxti
+	csr sintstatus
+	csr sintthresh
+	csr sscratchcsw
+	csr sscratchcswl
+	csr utvt
+	csr unxti
+	csr uintstatus
+	csr uintthresh
+	csr uscratchcswl
+
 	# Smcntrpmf extension
 	csr mcyclecfg
 	csr minstretcfg
diff --git a/include/opcode/riscv-opc.h b/include/opcode/riscv-opc.h
index 2a26c45f0c24..8b3a42529f2a 100644
--- a/include/opcode/riscv-opc.h
+++ b/include/opcode/riscv-opc.h
@@ -2878,6 +2878,24 @@
 #define CSR_MVIENH   0x318
 #define CSR_MVIPH    0x319
 #define CSR_MIPH     0x354
+/* Smclic/Ssclic/Suclic extension CSR addresses (including non-ratified user interrupts).  */
+#define CSR_MTVT 0x307
+#define CSR_MNXTI 0x345
+#define CSR_MINTSTATUS 0xfb1
+#define CSR_MINTTHRESH 0x347
+#define CSR_MSCRATCHCSW 0x348
+#define CSR_MSCRATCHCSWL 0x349
+#define CSR_STVT 0x107
+#define CSR_SNXTI 0x145
+#define CSR_SINTSTATUS 0xdb1
+#define CSR_SINTTHRESH 0x147
+#define CSR_SSCRATCHCSW 0x148
+#define CSR_SSCRATCHCSWL 0x149
+#define CSR_UTVT 0x7
+#define CSR_UNXTI 0x45
+#define CSR_UINTSTATUS 0xcb1
+#define CSR_UINTTHRESH 0x47
+#define CSR_USCRATCHCSWL 0x49
 /* Smcntrpmf extension.  */
 #define CSR_MCYCLECFG    0x321
 #define CSR_MINSTRETCFG  0x322
@@ -3869,6 +3887,24 @@ 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)
+/* Smclic/Ssclic/Suclic extensions (including non-ratified user interrupts).  */
+DECLARE_CSR(mtvt, CSR_MTVT, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(mnxti, CSR_MNXTI, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(mintstatus, CSR_MINTSTATUS, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(mintthresh, CSR_MINTTHRESH, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(mscratchcsw, CSR_MSCRATCHCSW, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(mscratchcswl, CSR_MSCRATCHCSWL, CSR_CLASS_SMCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(stvt, CSR_STVT, CSR_CLASS_SSCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(snxti, CSR_SNXTI, CSR_CLASS_SSCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(sintstatus, CSR_SINTSTATUS, CSR_CLASS_SSCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(sintthresh, CSR_SINTTHRESH, CSR_CLASS_SSCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(sscratchcsw, CSR_SSCRATCHCSW, CSR_CLASS_SSCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(sscratchcswl, CSR_SSCRATCHCSWL, CSR_CLASS_SSCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(utvt, CSR_UTVT, CSR_CLASS_SUCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(unxti, CSR_UNXTI, CSR_CLASS_SUCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(uintstatus, CSR_UINTSTATUS, CSR_CLASS_SUCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(uintthresh, CSR_UINTTHRESH, CSR_CLASS_SUCLIC, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(uscratchcswl, CSR_USCRATCHCSWL, CSR_CLASS_SUCLIC, 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)
-- 
2.42.0


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

end of thread, other threads:[~2023-09-12  1:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-29  1:19 [REVIEW ONLY 0/1] UNRATIFIED RISC-V: Add 'Smclic' extension and its CSRs Tsukasa OI
2022-11-29  1:19 ` [REVIEW ONLY 1/1] " Tsukasa OI
2022-11-29  2:03   ` Palmer Dabbelt
2022-11-29  2:16     ` Tsukasa OI
2022-11-29  2:43       ` Palmer Dabbelt
2023-09-12  1:39 ` [REVIEW ONLY v2 0/1] UNRATIFIED RISC-V: Add support for Core-Local Interrupt Controller (CLIC) extensions and their CSRs Tsukasa OI
2023-09-12  1:39   ` [REVIEW ONLY v2 1/1] UNRATIFIED RISC-V: Add CLIC extensions with CSRs Tsukasa OI

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