public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nelson Chu <nelson@rivosinc.com>
To: Tsukasa OI <research_trasio@irq.a4lg.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>,
	Andrew Waterman <andrew@sifive.com>,
	 Jim Wilson <jim.wilson.gcc@gmail.com>,
	Kito Cheng <kito.cheng@sifive.com>,
	 binutils@sourceware.org
Subject: Re: [PATCH 2/2] RISC-V: Add indirect CSR Access Extensions and its CSRs
Date: Thu, 24 Aug 2023 09:28:10 +0800	[thread overview]
Message-ID: <CAPpQWtBBdphQi_=O-BZMkx7wGvvm-8Vdaps2KxW1xG1yp-0tYA@mail.gmail.com> (raw)
In-Reply-To: <16eb8bc43544bb51c0b5a2a24d73ded82f85b486.1692602822.git.research_trasio@irq.a4lg.com>

[-- Attachment #1: Type: text/plain, Size: 62538 bytes --]

On Mon, Aug 21, 2023 at 3:27 PM Tsukasa OI <research_trasio@irq.a4lg.com>
wrote:

> From: Tsukasa OI <research_trasio@irq.a4lg.com>
>
> This commit adds indirect CSR access extensions (Smcsrind / Sscsrind) and
> their CSRs based on the latest documentation (version 1.0.0-rc2).
> <
> https://github.com/riscv/riscv-indirect-csr-access/releases/tag/v1.0.0-rc2
> >
>
> Because six CSRs are duplicates of 'Smaia' / 'Ssaia' extensions, it adds
> complex CSR handling for those.
>
> bfd/ChangeLog:
>
>         * elfxx-riscv.c (riscv_implicit_subsets): Add implications
>         'Smcsrind' / 'Sscsrind' -> 'Zicsr'.
>         (riscv_supported_std_s_ext): Add 'Smcsrind' and 'Sscsrind'
>         extensions to the valid 'S' extension list.
>
> gas/ChangeLog:
>
>         * config/tc-riscv.c (enum riscv_csr_class): Add CSR classes for
>         the 'S[ms]csrind' extensions. (riscv_csr_address): Add handling for
>         new CSR classes.
>         * testsuite/gas/riscv/csr-dw-regnums.s: Add new CSRs.
>         * testsuite/gas/riscv/csr-dw-regnums.d: Likewise.
>         * testsuite/gas/riscv/csr.s: Add new CSRs.
>         * testsuite/gas/riscv/csr-version-1p9p1.d: Likewise.
>         * testsuite/gas/riscv/csr-version-1p10.d: Likewise.
>         * testsuite/gas/riscv/csr-version-1p11.d: Likewise.
>         * testsuite/gas/riscv/csr-version-1p12.d: Likewise.
>         * testsuite/gas/riscv/csr-version-1p9p1.l: Likewise but also change
>         the expected error message to reflect 'S[ms]csrind' extensions.
>         * testsuite/gas/riscv/csr-version-1p10.l: Ditto.
>         * testsuite/gas/riscv/csr-version-1p11.l: Ditto.
>         * testsuite/gas/riscv/csr-version-1p12.l: Ditto.
>
> include/ChangeLog:
>
>         * opcode/riscv-opc.h: Recategory miselect, mireg, siselect, sireg,
>         vsiselect and vsireg CSRs. (CSR_MIREG2, CSR_MIREG3, CSR_MIREG4,
>         CSR_MIREG5, CSR_MIREG6, CSR_SIREG2, CSR_SIREG3, CSR_SIREG4,
>         CSR_SIREG5, CSR_SIREG6, CSR_VSIREG2, CSR_VSIREG3, CSR_VSIREG3,
>         CSR_VSIREG5, CSR_VSIREG6): Add new.
> ---
>  bfd/elfxx-riscv.c                           |   4 +
>  gas/config/tc-riscv.c                       |  30 ++++++
>  gas/testsuite/gas/riscv/csr-dw-regnums.d    |  15 +++
>  gas/testsuite/gas/riscv/csr-dw-regnums.s    |  17 ++++
>  gas/testsuite/gas/riscv/csr-version-1p10.d  |  30 ++++++
>  gas/testsuite/gas/riscv/csr-version-1p10.l  | 104 +++++++++++++++++---
>  gas/testsuite/gas/riscv/csr-version-1p11.d  |  30 ++++++
>  gas/testsuite/gas/riscv/csr-version-1p11.l  | 104 +++++++++++++++++---
>  gas/testsuite/gas/riscv/csr-version-1p12.d  |  30 ++++++
>  gas/testsuite/gas/riscv/csr-version-1p12.l  | 104 +++++++++++++++++---
>  gas/testsuite/gas/riscv/csr-version-1p9p1.d |  30 ++++++
>  gas/testsuite/gas/riscv/csr-version-1p9p1.l | 104 +++++++++++++++++---
>  gas/testsuite/gas/riscv/csr.s               |  19 ++++
>  include/opcode/riscv-opc.h                  |  46 +++++++--
>  14 files changed, 613 insertions(+), 54 deletions(-)
>
> diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
> index cb65024beaff..fa22f5db0c70 100644
> --- a/bfd/elfxx-riscv.c
> +++ b/bfd/elfxx-riscv.c
> @@ -1183,10 +1183,12 @@ static struct riscv_implicit_subset
> riscv_implicit_subsets[] =
>    {"zcd", "zca",       check_implicit_always},
>    {"zcb", "zca",       check_implicit_always},
>    {"smaia", "ssaia",           check_implicit_always},
> +  {"smcsrind", "zicsr",                check_implicit_always},
>    {"smstateen", "ssstateen",   check_implicit_always},
>    {"smepmp", "zicsr",          check_implicit_always},
>    {"ssaia", "zicsr",           check_implicit_always},
>    {"sscofpmf", "zicsr",                check_implicit_always},
> +  {"sscsrind", "zicsr",                check_implicit_always},
>    {"ssstateen", "zicsr",       check_implicit_always},
>    {"sstc", "zicsr",            check_implicit_always},
>    {NULL, NULL, NULL}
> @@ -1328,10 +1330,12 @@ 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 },
> +  {"smcsrind",         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 },
>    {"sscofpmf",         ISA_SPEC_CLASS_DRAFT,           1, 0, 0 },
> +  {"sscsrind",         ISA_SPEC_CLASS_DRAFT,           1, 0, 0 },
>    {"ssstateen",                ISA_SPEC_CLASS_DRAFT,           1, 0, 0 },
>    {"sstc",             ISA_SPEC_CLASS_DRAFT,           1, 0, 0 },
>    {"svinval",          ISA_SPEC_CLASS_DRAFT,           1, 0, 0 },
> diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
> index f587ea416f59..0a2d43c65ee8 100644
> --- a/gas/config/tc-riscv.c
> +++ b/gas/config/tc-riscv.c
> @@ -74,12 +74,18 @@ enum riscv_csr_class
>    CSR_CLASS_H_32,      /* hypervisor, rv32 only */
>    CSR_CLASS_SMAIA,             /* Smaia */
>    CSR_CLASS_SMAIA_32,          /* Smaia, rv32 only */
> +  CSR_CLASS_SMAIA_OR_SMCSRIND, /* Smaia or Smcsrind */
> +  CSR_CLASS_SMCSRIND,          /* Smcsrind */
>    CSR_CLASS_SMSTATEEN,         /* Smstateen only */
>    CSR_CLASS_SMSTATEEN_32,      /* Smstateen RV32 only */
>    CSR_CLASS_SSAIA,             /* Ssaia */
>    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_SSAIA_OR_SSCSRIND,         /* Ssaia or Sscsrind */
> +  CSR_CLASS_SSAIA_OR_SSCSRIND_AND_H,   /* Ssaia or Sscsrind (with H) */
> +  CSR_CLASS_SSCSRIND,          /* Sscsrind */
> +  CSR_CLASS_SSCSRIND_AND_H,    /* Sscsrind (with H) */
>    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)
> */
> @@ -1054,6 +1060,15 @@ riscv_csr_address (const char *csr_name,
>      case CSR_CLASS_SMAIA:
>        extension = "smaia";
>        break;
> +    case CSR_CLASS_SMAIA_OR_SMCSRIND:
> +      is_csr_req_complex = true;
> +      extension = _ ("smaia' or `smcsrind");
> +      csr_ok = (riscv_subset_supports (&riscv_rps_as, "smaia")
> +               || riscv_subset_supports (&riscv_rps_as, "smcsrind"));
> +      break;
> +    case CSR_CLASS_SMCSRIND:
> +      extension = "smcsrind";
> +      break;
>

First of all, can you merge the previous patch into this one?  Otherwise
it's hard to understand what is_csr_req_complex and csr_ok mean when
reviewing the patches which support new features ;)

Besides, we probably don't need is_csr_req_complex and is_h_required, you
can apply csr_ok for all CSR_CLASS_XXX classes.  Just like what we did for
INSN_CLASS_XXX in riscv_multi_subset_supports_ext and
riscv_multi_subset_supports.

@@ -1106,8 +1108,10 @@ riscv_csr_address (const char *csr_name,
       if (is_h_required && !riscv_subset_supports (&riscv_rps_as, "h"))
        as_warn (_("invalid CSR `%s', needs `h' extension"), csr_name);

-      if (extension != NULL
-         && !riscv_subset_supports (&riscv_rps_as, extension))
+      if (is_csr_req_complex
+             ? !csr_ok
+             : (extension != NULL
+                && !riscv_subset_supports (&riscv_rps_as, extension)))
        as_warn (_("invalid CSR `%s', needs `%s' extension"),
                 csr_name, extension);
     }

Seems only keep the following check should be enough,
if (!csr_ok) // or if (error)
  as_warn (_("invalid CSR `%s', needs `%s' extension"), csr_name,
extension);

Then ...


>      case CSR_CLASS_SMSTATEEN_32:
>        is_rv32_only = true;
>

Keep this one, since we need different warning reports.


>        /* Fall through.  */
> @@ -1085,6 +1100,21 @@ riscv_csr_address (const char *csr_name,
>      case CSR_CLASS_SSCOFPMF:
>        extension = "sscofpmf";
>        break;
> +    case CSR_CLASS_SSAIA_OR_SSCSRIND_AND_H:
> +      is_h_required = true;


msg = _("ssaia' and `h', or `sscsrind and `h");
csr_ok = h && (ssaia || sscsrind);


> +      /* Fall through.  */
> +    case CSR_CLASS_SSAIA_OR_SSCSRIND:
> +      is_csr_req_complex = true;
> +      extension = _ ("ssaia' or `sscsrind");
> +      csr_ok = (riscv_subset_supports (&riscv_rps_as, "ssaia")
> +               || riscv_subset_supports (&riscv_rps_as, "sscsrind"));
>

msg = _("ssaia' or `sscsrind");
csr_ok = (ssaia || sscsrind);

For CSR_CLASS_DEBUG, just set csr_ok = true, or do nothing if default is
true.


> +      break;
> +    case CSR_CLASS_SSCSRIND_AND_H:
> +      is_h_required = true;
> +      /* Fall through.  */
> +    case CSR_CLASS_SSCSRIND:
> +      extension = "sscsrind";
> +      break;
>

Likewise.

Thanks
Nelson


>      case CSR_CLASS_SSTC:
>      case CSR_CLASS_SSTC_AND_H:
>      case CSR_CLASS_SSTC_32:
> diff --git a/gas/testsuite/gas/riscv/csr-dw-regnums.d
> b/gas/testsuite/gas/riscv/csr-dw-regnums.d
> index fd830666ab89..d9c8909a4d7c 100644
> --- a/gas/testsuite/gas/riscv/csr-dw-regnums.d
> +++ b/gas/testsuite/gas/riscv/csr-dw-regnums.d
> @@ -324,6 +324,11 @@ 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: r4946 \(mireg2\) at cfa\+3400
> +  DW_CFA_offset_extended_sf: r4947 \(mireg3\) at cfa\+3404
> +  DW_CFA_offset_extended_sf: r4949 \(mireg4\) at cfa\+3412
> +  DW_CFA_offset_extended_sf: r4950 \(mireg5\) at cfa\+3416
> +  DW_CFA_offset_extended_sf: r4951 \(mireg6\) at cfa\+3420
>    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
> @@ -395,6 +400,16 @@ Contents of the .* section:
>    DW_CFA_offset_extended_sf: r5949 \(mhpmevent29h\) at cfa\+7412
>    DW_CFA_offset_extended_sf: r5950 \(mhpmevent30h\) at cfa\+7416
>    DW_CFA_offset_extended_sf: r5951 \(mhpmevent31h\) at cfa\+7420
> +  DW_CFA_offset_extended_sf: r4434 \(sireg2\) at cfa\+1352
> +  DW_CFA_offset_extended_sf: r4435 \(sireg3\) at cfa\+1356
> +  DW_CFA_offset_extended_sf: r4437 \(sireg4\) at cfa\+1364
> +  DW_CFA_offset_extended_sf: r4438 \(sireg5\) at cfa\+1368
> +  DW_CFA_offset_extended_sf: r4439 \(sireg6\) at cfa\+1372
> +  DW_CFA_offset_extended_sf: r4690 \(vsireg2\) at cfa\+2376
> +  DW_CFA_offset_extended_sf: r4691 \(vsireg3\) at cfa\+2380
> +  DW_CFA_offset_extended_sf: r4693 \(vsireg4\) at cfa\+2388
> +  DW_CFA_offset_extended_sf: r4694 \(vsireg5\) at cfa\+2392
> +  DW_CFA_offset_extended_sf: r4695 \(vsireg6\) at cfa\+2396
>    DW_CFA_offset_extended_sf: r4429 \(stimecmp\) at cfa\+1332
>    DW_CFA_offset_extended_sf: r4445 \(stimecmph\) at cfa\+1396
>    DW_CFA_offset_extended_sf: r4685 \(vstimecmp\) at cfa\+2356
> diff --git a/gas/testsuite/gas/riscv/csr-dw-regnums.s
> b/gas/testsuite/gas/riscv/csr-dw-regnums.s
> index b8b0f7902297..e3c04ba2d4d8 100644
> --- a/gas/testsuite/gas/riscv/csr-dw-regnums.s
> +++ b/gas/testsuite/gas/riscv/csr-dw-regnums.s
> @@ -321,6 +321,12 @@ _start:
>         .cfi_offset mvienh, 3168
>         .cfi_offset mviph, 3172
>         .cfi_offset miph, 3408
> +       # Smcsrind extension (except miselect/mireg in Smaia)
> +       .cfi_offset mireg2, 3400
> +       .cfi_offset mireg3, 3404
> +       .cfi_offset mireg4, 3412
> +       .cfi_offset mireg5, 3416
> +       .cfi_offset mireg6, 3420
>         # Smstateen extension
>         .cfi_offset mstateen0, 3120
>         .cfi_offset mstateen1, 3124
> @@ -395,6 +401,17 @@ _start:
>         .cfi_offset mhpmevent29h, 7412
>         .cfi_offset mhpmevent30h, 7416
>         .cfi_offset mhpmevent31h, 7420
> +       # Sscsrind extension (except {v,}si{select,reg} in Ssaia)
> +       .cfi_offset sireg2, 1352
> +       .cfi_offset sireg3, 1356
> +       .cfi_offset sireg4, 1364
> +       .cfi_offset sireg5, 1368
> +       .cfi_offset sireg6, 1372
> +       .cfi_offset vsireg2, 2376
> +       .cfi_offset vsireg3, 2380
> +       .cfi_offset vsireg4, 2388
> +       .cfi_offset vsireg5, 2392
> +       .cfi_offset vsireg6, 2396
>         # Sstc extension
>         .cfi_offset stimecmp, 1332
>         .cfi_offset stimecmph, 1396
> diff --git a/gas/testsuite/gas/riscv/csr-version-1p10.d
> b/gas/testsuite/gas/riscv/csr-version-1p10.d
> index ee41e1025cce..f6838ff864f1 100644
> --- a/gas/testsuite/gas/riscv/csr-version-1p10.d
> +++ b/gas/testsuite/gas/riscv/csr-version-1p10.d
> @@ -623,6 +623,16 @@ 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]+:[   ]+35202573[     ]+csrr[         ]+a0,mireg2
> +[      ]+[0-9a-f]+:[   ]+35259073[     ]+csrw[         ]+mireg2,a1
> +[      ]+[0-9a-f]+:[   ]+35302573[     ]+csrr[         ]+a0,mireg3
> +[      ]+[0-9a-f]+:[   ]+35359073[     ]+csrw[         ]+mireg3,a1
> +[      ]+[0-9a-f]+:[   ]+35502573[     ]+csrr[         ]+a0,mireg4
> +[      ]+[0-9a-f]+:[   ]+35559073[     ]+csrw[         ]+mireg4,a1
> +[      ]+[0-9a-f]+:[   ]+35602573[     ]+csrr[         ]+a0,mireg5
> +[      ]+[0-9a-f]+:[   ]+35659073[     ]+csrw[         ]+mireg5,a1
> +[      ]+[0-9a-f]+:[   ]+35702573[     ]+csrr[         ]+a0,mireg6
> +[      ]+[0-9a-f]+:[   ]+35759073[     ]+csrw[         ]+mireg6,a1
>  [      ]+[0-9a-f]+:[   ]+30c02573[     ]+csrr[         ]+a0,mstateen0
>  [      ]+[0-9a-f]+:[   ]+30c59073[     ]+csrw[         ]+mstateen0,a1
>  [      ]+[0-9a-f]+:[   ]+30d02573[     ]+csrr[         ]+a0,mstateen1
> @@ -765,6 +775,26 @@ Disassembly of section .text:
>  [      ]+[0-9a-f]+:[   ]+73e59073[     ]+csrw[         ]+mhpmevent30h,a1
>  [      ]+[0-9a-f]+:[   ]+73f02573[     ]+csrr[         ]+a0,mhpmevent31h
>  [      ]+[0-9a-f]+:[   ]+73f59073[     ]+csrw[         ]+mhpmevent31h,a1
> +[      ]+[0-9a-f]+:[   ]+15202573[     ]+csrr[         ]+a0,sireg2
> +[      ]+[0-9a-f]+:[   ]+15259073[     ]+csrw[         ]+sireg2,a1
> +[      ]+[0-9a-f]+:[   ]+15302573[     ]+csrr[         ]+a0,sireg3
> +[      ]+[0-9a-f]+:[   ]+15359073[     ]+csrw[         ]+sireg3,a1
> +[      ]+[0-9a-f]+:[   ]+15502573[     ]+csrr[         ]+a0,sireg4
> +[      ]+[0-9a-f]+:[   ]+15559073[     ]+csrw[         ]+sireg4,a1
> +[      ]+[0-9a-f]+:[   ]+15602573[     ]+csrr[         ]+a0,sireg5
> +[      ]+[0-9a-f]+:[   ]+15659073[     ]+csrw[         ]+sireg5,a1
> +[      ]+[0-9a-f]+:[   ]+15702573[     ]+csrr[         ]+a0,sireg6
> +[      ]+[0-9a-f]+:[   ]+15759073[     ]+csrw[         ]+sireg6,a1
> +[      ]+[0-9a-f]+:[   ]+25202573[     ]+csrr[         ]+a0,vsireg2
> +[      ]+[0-9a-f]+:[   ]+25259073[     ]+csrw[         ]+vsireg2,a1
> +[      ]+[0-9a-f]+:[   ]+25302573[     ]+csrr[         ]+a0,vsireg3
> +[      ]+[0-9a-f]+:[   ]+25359073[     ]+csrw[         ]+vsireg3,a1
> +[      ]+[0-9a-f]+:[   ]+25502573[     ]+csrr[         ]+a0,vsireg4
> +[      ]+[0-9a-f]+:[   ]+25559073[     ]+csrw[         ]+vsireg4,a1
> +[      ]+[0-9a-f]+:[   ]+25602573[     ]+csrr[         ]+a0,vsireg5
> +[      ]+[0-9a-f]+:[   ]+25659073[     ]+csrw[         ]+vsireg5,a1
> +[      ]+[0-9a-f]+:[   ]+25702573[     ]+csrr[         ]+a0,vsireg6
> +[      ]+[0-9a-f]+:[   ]+25759073[     ]+csrw[         ]+vsireg6,a1
>  [      ]+[0-9a-f]+:[   ]+14d02573[     ]+csrr[         ]+a0,stimecmp
>  [      ]+[0-9a-f]+:[   ]+14d59073[     ]+csrw[         ]+stimecmp,a1
>  [      ]+[0-9a-f]+:[   ]+15d02573[     ]+csrr[         ]+a0,stimecmph
> diff --git a/gas/testsuite/gas/riscv/csr-version-1p10.l
> b/gas/testsuite/gas/riscv/csr-version-1p10.l
> index 27bdc80c0d54..0821f82e382c 100644
> --- a/gas/testsuite/gas/riscv/csr-version-1p10.l
> +++ b/gas/testsuite/gas/riscv/csr-version-1p10.l
> @@ -823,13 +823,13 @@
>  .*Info: macro .*
>  .*Warning: invalid CSR `vsatp', needs `h' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `miselect', needs `smaia' extension
> +.*Warning: invalid CSR `miselect', needs `smaia' or `smcsrind' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `miselect', needs `smaia' extension
> +.*Warning: invalid CSR `miselect', needs `smaia' or `smcsrind' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `mireg', needs `smaia' extension
> +.*Warning: invalid CSR `mireg', needs `smaia' or `smcsrind' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `mireg', needs `smaia' extension
> +.*Warning: invalid CSR `mireg', needs `smaia' or `smcsrind' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `mtopei', needs `smaia' extension
>  .*Info: macro .*
> @@ -889,6 +889,26 @@
>  .*Info: macro .*
>  .*Warning: invalid CSR `miph', needs `smaia' extension
>  .*Info: macro .*
> +.*Warning: invalid CSR `mireg2', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg2', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg3', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg3', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg4', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg4', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg5', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg5', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg6', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg6', needs `smcsrind' extension
> +.*Info: macro .*
>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
> @@ -1033,13 +1053,13 @@
>  .*Info: macro .*
>  .*Warning: invalid CSR `hstateen3h', needs `ssstateen' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `siselect', needs `ssaia' extension
> +.*Warning: invalid CSR `siselect', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `siselect', needs `ssaia' extension
> +.*Warning: invalid CSR `siselect', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `sireg', needs `ssaia' extension
> +.*Warning: invalid CSR `sireg', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `sireg', needs `ssaia' extension
> +.*Warning: invalid CSR `sireg', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `stopei', needs `ssaia' extension
>  .*Info: macro .*
> @@ -1101,19 +1121,19 @@
>  .*Info: macro .*
>  .*Warning: invalid CSR `vsiselect', needs `h' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `vsiselect', needs `ssaia' extension
> +.*Warning: invalid CSR `vsiselect', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `vsiselect', needs `h' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `vsiselect', needs `ssaia' extension
> +.*Warning: invalid CSR `vsiselect', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `vsireg', needs `h' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `vsireg', needs `ssaia' extension
> +.*Warning: invalid CSR `vsireg', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `vsireg', needs `h' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `vsireg', needs `ssaia' extension
> +.*Warning: invalid CSR `vsireg', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `vstopei', needs `h' extension
>  .*Info: macro .*
> @@ -1455,6 +1475,66 @@
>  .*Info: macro .*
>  .*Warning: invalid CSR `mhpmevent31h', needs `sscofpmf' extension
>  .*Info: macro .*
> +.*Warning: invalid CSR `sireg2', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg2', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg3', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg3', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg4', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg4', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg5', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg5', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg6', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg6', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg2', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg2', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg2', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg2', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg3', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg3', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg3', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg3', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg4', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg4', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg4', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg4', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg5', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg5', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg5', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg5', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg6', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg6', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg6', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg6', needs `sscsrind' extension
> +.*Info: macro .*
>  .*Warning: invalid CSR `stimecmp', needs `sstc' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `stimecmp', needs `sstc' extension
> diff --git a/gas/testsuite/gas/riscv/csr-version-1p11.d
> b/gas/testsuite/gas/riscv/csr-version-1p11.d
> index a83b1bf68f98..100042f8350c 100644
> --- a/gas/testsuite/gas/riscv/csr-version-1p11.d
> +++ b/gas/testsuite/gas/riscv/csr-version-1p11.d
> @@ -623,6 +623,16 @@ 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]+:[   ]+35202573[     ]+csrr[         ]+a0,mireg2
> +[      ]+[0-9a-f]+:[   ]+35259073[     ]+csrw[         ]+mireg2,a1
> +[      ]+[0-9a-f]+:[   ]+35302573[     ]+csrr[         ]+a0,mireg3
> +[      ]+[0-9a-f]+:[   ]+35359073[     ]+csrw[         ]+mireg3,a1
> +[      ]+[0-9a-f]+:[   ]+35502573[     ]+csrr[         ]+a0,mireg4
> +[      ]+[0-9a-f]+:[   ]+35559073[     ]+csrw[         ]+mireg4,a1
> +[      ]+[0-9a-f]+:[   ]+35602573[     ]+csrr[         ]+a0,mireg5
> +[      ]+[0-9a-f]+:[   ]+35659073[     ]+csrw[         ]+mireg5,a1
> +[      ]+[0-9a-f]+:[   ]+35702573[     ]+csrr[         ]+a0,mireg6
> +[      ]+[0-9a-f]+:[   ]+35759073[     ]+csrw[         ]+mireg6,a1
>  [      ]+[0-9a-f]+:[   ]+30c02573[     ]+csrr[         ]+a0,mstateen0
>  [      ]+[0-9a-f]+:[   ]+30c59073[     ]+csrw[         ]+mstateen0,a1
>  [      ]+[0-9a-f]+:[   ]+30d02573[     ]+csrr[         ]+a0,mstateen1
> @@ -765,6 +775,26 @@ Disassembly of section .text:
>  [      ]+[0-9a-f]+:[   ]+73e59073[     ]+csrw[         ]+mhpmevent30h,a1
>  [      ]+[0-9a-f]+:[   ]+73f02573[     ]+csrr[         ]+a0,mhpmevent31h
>  [      ]+[0-9a-f]+:[   ]+73f59073[     ]+csrw[         ]+mhpmevent31h,a1
> +[      ]+[0-9a-f]+:[   ]+15202573[     ]+csrr[         ]+a0,sireg2
> +[      ]+[0-9a-f]+:[   ]+15259073[     ]+csrw[         ]+sireg2,a1
> +[      ]+[0-9a-f]+:[   ]+15302573[     ]+csrr[         ]+a0,sireg3
> +[      ]+[0-9a-f]+:[   ]+15359073[     ]+csrw[         ]+sireg3,a1
> +[      ]+[0-9a-f]+:[   ]+15502573[     ]+csrr[         ]+a0,sireg4
> +[      ]+[0-9a-f]+:[   ]+15559073[     ]+csrw[         ]+sireg4,a1
> +[      ]+[0-9a-f]+:[   ]+15602573[     ]+csrr[         ]+a0,sireg5
> +[      ]+[0-9a-f]+:[   ]+15659073[     ]+csrw[         ]+sireg5,a1
> +[      ]+[0-9a-f]+:[   ]+15702573[     ]+csrr[         ]+a0,sireg6
> +[      ]+[0-9a-f]+:[   ]+15759073[     ]+csrw[         ]+sireg6,a1
> +[      ]+[0-9a-f]+:[   ]+25202573[     ]+csrr[         ]+a0,vsireg2
> +[      ]+[0-9a-f]+:[   ]+25259073[     ]+csrw[         ]+vsireg2,a1
> +[      ]+[0-9a-f]+:[   ]+25302573[     ]+csrr[         ]+a0,vsireg3
> +[      ]+[0-9a-f]+:[   ]+25359073[     ]+csrw[         ]+vsireg3,a1
> +[      ]+[0-9a-f]+:[   ]+25502573[     ]+csrr[         ]+a0,vsireg4
> +[      ]+[0-9a-f]+:[   ]+25559073[     ]+csrw[         ]+vsireg4,a1
> +[      ]+[0-9a-f]+:[   ]+25602573[     ]+csrr[         ]+a0,vsireg5
> +[      ]+[0-9a-f]+:[   ]+25659073[     ]+csrw[         ]+vsireg5,a1
> +[      ]+[0-9a-f]+:[   ]+25702573[     ]+csrr[         ]+a0,vsireg6
> +[      ]+[0-9a-f]+:[   ]+25759073[     ]+csrw[         ]+vsireg6,a1
>  [      ]+[0-9a-f]+:[   ]+14d02573[     ]+csrr[         ]+a0,stimecmp
>  [      ]+[0-9a-f]+:[   ]+14d59073[     ]+csrw[         ]+stimecmp,a1
>  [      ]+[0-9a-f]+:[   ]+15d02573[     ]+csrr[         ]+a0,stimecmph
> diff --git a/gas/testsuite/gas/riscv/csr-version-1p11.l
> b/gas/testsuite/gas/riscv/csr-version-1p11.l
> index ba497228d7fd..407818e65129 100644
> --- a/gas/testsuite/gas/riscv/csr-version-1p11.l
> +++ b/gas/testsuite/gas/riscv/csr-version-1p11.l
> @@ -819,13 +819,13 @@
>  .*Info: macro .*
>  .*Warning: invalid CSR `vsatp', needs `h' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `miselect', needs `smaia' extension
> +.*Warning: invalid CSR `miselect', needs `smaia' or `smcsrind' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `miselect', needs `smaia' extension
> +.*Warning: invalid CSR `miselect', needs `smaia' or `smcsrind' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `mireg', needs `smaia' extension
> +.*Warning: invalid CSR `mireg', needs `smaia' or `smcsrind' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `mireg', needs `smaia' extension
> +.*Warning: invalid CSR `mireg', needs `smaia' or `smcsrind' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `mtopei', needs `smaia' extension
>  .*Info: macro .*
> @@ -885,6 +885,26 @@
>  .*Info: macro .*
>  .*Warning: invalid CSR `miph', needs `smaia' extension
>  .*Info: macro .*
> +.*Warning: invalid CSR `mireg2', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg2', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg3', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg3', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg4', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg4', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg5', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg5', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg6', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg6', needs `smcsrind' extension
> +.*Info: macro .*
>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
> @@ -1029,13 +1049,13 @@
>  .*Info: macro .*
>  .*Warning: invalid CSR `hstateen3h', needs `ssstateen' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `siselect', needs `ssaia' extension
> +.*Warning: invalid CSR `siselect', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `siselect', needs `ssaia' extension
> +.*Warning: invalid CSR `siselect', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `sireg', needs `ssaia' extension
> +.*Warning: invalid CSR `sireg', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `sireg', needs `ssaia' extension
> +.*Warning: invalid CSR `sireg', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `stopei', needs `ssaia' extension
>  .*Info: macro .*
> @@ -1097,19 +1117,19 @@
>  .*Info: macro .*
>  .*Warning: invalid CSR `vsiselect', needs `h' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `vsiselect', needs `ssaia' extension
> +.*Warning: invalid CSR `vsiselect', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `vsiselect', needs `h' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `vsiselect', needs `ssaia' extension
> +.*Warning: invalid CSR `vsiselect', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `vsireg', needs `h' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `vsireg', needs `ssaia' extension
> +.*Warning: invalid CSR `vsireg', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `vsireg', needs `h' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `vsireg', needs `ssaia' extension
> +.*Warning: invalid CSR `vsireg', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `vstopei', needs `h' extension
>  .*Info: macro .*
> @@ -1451,6 +1471,66 @@
>  .*Info: macro .*
>  .*Warning: invalid CSR `mhpmevent31h', needs `sscofpmf' extension
>  .*Info: macro .*
> +.*Warning: invalid CSR `sireg2', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg2', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg3', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg3', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg4', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg4', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg5', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg5', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg6', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg6', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg2', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg2', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg2', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg2', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg3', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg3', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg3', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg3', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg4', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg4', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg4', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg4', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg5', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg5', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg5', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg5', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg6', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg6', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg6', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg6', needs `sscsrind' extension
> +.*Info: macro .*
>  .*Warning: invalid CSR `stimecmp', needs `sstc' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `stimecmp', needs `sstc' extension
> diff --git a/gas/testsuite/gas/riscv/csr-version-1p12.d
> b/gas/testsuite/gas/riscv/csr-version-1p12.d
> index 612aac280768..a7ea226f1a85 100644
> --- a/gas/testsuite/gas/riscv/csr-version-1p12.d
> +++ b/gas/testsuite/gas/riscv/csr-version-1p12.d
> @@ -623,6 +623,16 @@ 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]+:[   ]+35202573[     ]+csrr[         ]+a0,mireg2
> +[      ]+[0-9a-f]+:[   ]+35259073[     ]+csrw[         ]+mireg2,a1
> +[      ]+[0-9a-f]+:[   ]+35302573[     ]+csrr[         ]+a0,mireg3
> +[      ]+[0-9a-f]+:[   ]+35359073[     ]+csrw[         ]+mireg3,a1
> +[      ]+[0-9a-f]+:[   ]+35502573[     ]+csrr[         ]+a0,mireg4
> +[      ]+[0-9a-f]+:[   ]+35559073[     ]+csrw[         ]+mireg4,a1
> +[      ]+[0-9a-f]+:[   ]+35602573[     ]+csrr[         ]+a0,mireg5
> +[      ]+[0-9a-f]+:[   ]+35659073[     ]+csrw[         ]+mireg5,a1
> +[      ]+[0-9a-f]+:[   ]+35702573[     ]+csrr[         ]+a0,mireg6
> +[      ]+[0-9a-f]+:[   ]+35759073[     ]+csrw[         ]+mireg6,a1
>  [      ]+[0-9a-f]+:[   ]+30c02573[     ]+csrr[         ]+a0,mstateen0
>  [      ]+[0-9a-f]+:[   ]+30c59073[     ]+csrw[         ]+mstateen0,a1
>  [      ]+[0-9a-f]+:[   ]+30d02573[     ]+csrr[         ]+a0,mstateen1
> @@ -765,6 +775,26 @@ Disassembly of section .text:
>  [      ]+[0-9a-f]+:[   ]+73e59073[     ]+csrw[         ]+mhpmevent30h,a1
>  [      ]+[0-9a-f]+:[   ]+73f02573[     ]+csrr[         ]+a0,mhpmevent31h
>  [      ]+[0-9a-f]+:[   ]+73f59073[     ]+csrw[         ]+mhpmevent31h,a1
> +[      ]+[0-9a-f]+:[   ]+15202573[     ]+csrr[         ]+a0,sireg2
> +[      ]+[0-9a-f]+:[   ]+15259073[     ]+csrw[         ]+sireg2,a1
> +[      ]+[0-9a-f]+:[   ]+15302573[     ]+csrr[         ]+a0,sireg3
> +[      ]+[0-9a-f]+:[   ]+15359073[     ]+csrw[         ]+sireg3,a1
> +[      ]+[0-9a-f]+:[   ]+15502573[     ]+csrr[         ]+a0,sireg4
> +[      ]+[0-9a-f]+:[   ]+15559073[     ]+csrw[         ]+sireg4,a1
> +[      ]+[0-9a-f]+:[   ]+15602573[     ]+csrr[         ]+a0,sireg5
> +[      ]+[0-9a-f]+:[   ]+15659073[     ]+csrw[         ]+sireg5,a1
> +[      ]+[0-9a-f]+:[   ]+15702573[     ]+csrr[         ]+a0,sireg6
> +[      ]+[0-9a-f]+:[   ]+15759073[     ]+csrw[         ]+sireg6,a1
> +[      ]+[0-9a-f]+:[   ]+25202573[     ]+csrr[         ]+a0,vsireg2
> +[      ]+[0-9a-f]+:[   ]+25259073[     ]+csrw[         ]+vsireg2,a1
> +[      ]+[0-9a-f]+:[   ]+25302573[     ]+csrr[         ]+a0,vsireg3
> +[      ]+[0-9a-f]+:[   ]+25359073[     ]+csrw[         ]+vsireg3,a1
> +[      ]+[0-9a-f]+:[   ]+25502573[     ]+csrr[         ]+a0,vsireg4
> +[      ]+[0-9a-f]+:[   ]+25559073[     ]+csrw[         ]+vsireg4,a1
> +[      ]+[0-9a-f]+:[   ]+25602573[     ]+csrr[         ]+a0,vsireg5
> +[      ]+[0-9a-f]+:[   ]+25659073[     ]+csrw[         ]+vsireg5,a1
> +[      ]+[0-9a-f]+:[   ]+25702573[     ]+csrr[         ]+a0,vsireg6
> +[      ]+[0-9a-f]+:[   ]+25759073[     ]+csrw[         ]+vsireg6,a1
>  [      ]+[0-9a-f]+:[   ]+14d02573[     ]+csrr[         ]+a0,stimecmp
>  [      ]+[0-9a-f]+:[   ]+14d59073[     ]+csrw[         ]+stimecmp,a1
>  [      ]+[0-9a-f]+:[   ]+15d02573[     ]+csrr[         ]+a0,stimecmph
> diff --git a/gas/testsuite/gas/riscv/csr-version-1p12.l
> b/gas/testsuite/gas/riscv/csr-version-1p12.l
> index bdebea22334a..2631f702e065 100644
> --- a/gas/testsuite/gas/riscv/csr-version-1p12.l
> +++ b/gas/testsuite/gas/riscv/csr-version-1p12.l
> @@ -543,13 +543,13 @@
>  .*Info: macro .*
>  .*Warning: invalid CSR `vsatp', needs `h' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `miselect', needs `smaia' extension
> +.*Warning: invalid CSR `miselect', needs `smaia' or `smcsrind' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `miselect', needs `smaia' extension
> +.*Warning: invalid CSR `miselect', needs `smaia' or `smcsrind' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `mireg', needs `smaia' extension
> +.*Warning: invalid CSR `mireg', needs `smaia' or `smcsrind' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `mireg', needs `smaia' extension
> +.*Warning: invalid CSR `mireg', needs `smaia' or `smcsrind' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `mtopei', needs `smaia' extension
>  .*Info: macro .*
> @@ -609,6 +609,26 @@
>  .*Info: macro .*
>  .*Warning: invalid CSR `miph', needs `smaia' extension
>  .*Info: macro .*
> +.*Warning: invalid CSR `mireg2', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg2', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg3', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg3', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg4', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg4', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg5', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg5', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg6', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg6', needs `smcsrind' extension
> +.*Info: macro .*
>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
> @@ -753,13 +773,13 @@
>  .*Info: macro .*
>  .*Warning: invalid CSR `hstateen3h', needs `ssstateen' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `siselect', needs `ssaia' extension
> +.*Warning: invalid CSR `siselect', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `siselect', needs `ssaia' extension
> +.*Warning: invalid CSR `siselect', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `sireg', needs `ssaia' extension
> +.*Warning: invalid CSR `sireg', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `sireg', needs `ssaia' extension
> +.*Warning: invalid CSR `sireg', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `stopei', needs `ssaia' extension
>  .*Info: macro .*
> @@ -821,19 +841,19 @@
>  .*Info: macro .*
>  .*Warning: invalid CSR `vsiselect', needs `h' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `vsiselect', needs `ssaia' extension
> +.*Warning: invalid CSR `vsiselect', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `vsiselect', needs `h' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `vsiselect', needs `ssaia' extension
> +.*Warning: invalid CSR `vsiselect', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `vsireg', needs `h' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `vsireg', needs `ssaia' extension
> +.*Warning: invalid CSR `vsireg', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `vsireg', needs `h' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `vsireg', needs `ssaia' extension
> +.*Warning: invalid CSR `vsireg', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `vstopei', needs `h' extension
>  .*Info: macro .*
> @@ -1175,6 +1195,66 @@
>  .*Info: macro .*
>  .*Warning: invalid CSR `mhpmevent31h', needs `sscofpmf' extension
>  .*Info: macro .*
> +.*Warning: invalid CSR `sireg2', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg2', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg3', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg3', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg4', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg4', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg5', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg5', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg6', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg6', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg2', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg2', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg2', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg2', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg3', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg3', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg3', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg3', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg4', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg4', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg4', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg4', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg5', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg5', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg5', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg5', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg6', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg6', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg6', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg6', needs `sscsrind' extension
> +.*Info: macro .*
>  .*Warning: invalid CSR `stimecmp', needs `sstc' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `stimecmp', needs `sstc' extension
> diff --git a/gas/testsuite/gas/riscv/csr-version-1p9p1.d
> b/gas/testsuite/gas/riscv/csr-version-1p9p1.d
> index 0fe849c269c2..1be6229ba5f4 100644
> --- a/gas/testsuite/gas/riscv/csr-version-1p9p1.d
> +++ b/gas/testsuite/gas/riscv/csr-version-1p9p1.d
> @@ -623,6 +623,16 @@ 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]+:[   ]+35202573[     ]+csrr[         ]+a0,mireg2
> +[      ]+[0-9a-f]+:[   ]+35259073[     ]+csrw[         ]+mireg2,a1
> +[      ]+[0-9a-f]+:[   ]+35302573[     ]+csrr[         ]+a0,mireg3
> +[      ]+[0-9a-f]+:[   ]+35359073[     ]+csrw[         ]+mireg3,a1
> +[      ]+[0-9a-f]+:[   ]+35502573[     ]+csrr[         ]+a0,mireg4
> +[      ]+[0-9a-f]+:[   ]+35559073[     ]+csrw[         ]+mireg4,a1
> +[      ]+[0-9a-f]+:[   ]+35602573[     ]+csrr[         ]+a0,mireg5
> +[      ]+[0-9a-f]+:[   ]+35659073[     ]+csrw[         ]+mireg5,a1
> +[      ]+[0-9a-f]+:[   ]+35702573[     ]+csrr[         ]+a0,mireg6
> +[      ]+[0-9a-f]+:[   ]+35759073[     ]+csrw[         ]+mireg6,a1
>  [      ]+[0-9a-f]+:[   ]+30c02573[     ]+csrr[         ]+a0,mstateen0
>  [      ]+[0-9a-f]+:[   ]+30c59073[     ]+csrw[         ]+mstateen0,a1
>  [      ]+[0-9a-f]+:[   ]+30d02573[     ]+csrr[         ]+a0,mstateen1
> @@ -765,6 +775,26 @@ Disassembly of section .text:
>  [      ]+[0-9a-f]+:[   ]+73e59073[     ]+csrw[         ]+mhpmevent30h,a1
>  [      ]+[0-9a-f]+:[   ]+73f02573[     ]+csrr[         ]+a0,mhpmevent31h
>  [      ]+[0-9a-f]+:[   ]+73f59073[     ]+csrw[         ]+mhpmevent31h,a1
> +[      ]+[0-9a-f]+:[   ]+15202573[     ]+csrr[         ]+a0,sireg2
> +[      ]+[0-9a-f]+:[   ]+15259073[     ]+csrw[         ]+sireg2,a1
> +[      ]+[0-9a-f]+:[   ]+15302573[     ]+csrr[         ]+a0,sireg3
> +[      ]+[0-9a-f]+:[   ]+15359073[     ]+csrw[         ]+sireg3,a1
> +[      ]+[0-9a-f]+:[   ]+15502573[     ]+csrr[         ]+a0,sireg4
> +[      ]+[0-9a-f]+:[   ]+15559073[     ]+csrw[         ]+sireg4,a1
> +[      ]+[0-9a-f]+:[   ]+15602573[     ]+csrr[         ]+a0,sireg5
> +[      ]+[0-9a-f]+:[   ]+15659073[     ]+csrw[         ]+sireg5,a1
> +[      ]+[0-9a-f]+:[   ]+15702573[     ]+csrr[         ]+a0,sireg6
> +[      ]+[0-9a-f]+:[   ]+15759073[     ]+csrw[         ]+sireg6,a1
> +[      ]+[0-9a-f]+:[   ]+25202573[     ]+csrr[         ]+a0,vsireg2
> +[      ]+[0-9a-f]+:[   ]+25259073[     ]+csrw[         ]+vsireg2,a1
> +[      ]+[0-9a-f]+:[   ]+25302573[     ]+csrr[         ]+a0,vsireg3
> +[      ]+[0-9a-f]+:[   ]+25359073[     ]+csrw[         ]+vsireg3,a1
> +[      ]+[0-9a-f]+:[   ]+25502573[     ]+csrr[         ]+a0,vsireg4
> +[      ]+[0-9a-f]+:[   ]+25559073[     ]+csrw[         ]+vsireg4,a1
> +[      ]+[0-9a-f]+:[   ]+25602573[     ]+csrr[         ]+a0,vsireg5
> +[      ]+[0-9a-f]+:[   ]+25659073[     ]+csrw[         ]+vsireg5,a1
> +[      ]+[0-9a-f]+:[   ]+25702573[     ]+csrr[         ]+a0,vsireg6
> +[      ]+[0-9a-f]+:[   ]+25759073[     ]+csrw[         ]+vsireg6,a1
>  [      ]+[0-9a-f]+:[   ]+14d02573[     ]+csrr[         ]+a0,stimecmp
>  [      ]+[0-9a-f]+:[   ]+14d59073[     ]+csrw[         ]+stimecmp,a1
>  [      ]+[0-9a-f]+:[   ]+15d02573[     ]+csrr[         ]+a0,stimecmph
> diff --git a/gas/testsuite/gas/riscv/csr-version-1p9p1.l
> b/gas/testsuite/gas/riscv/csr-version-1p9p1.l
> index 49bd95954e2c..5f47da3db02c 100644
> --- a/gas/testsuite/gas/riscv/csr-version-1p9p1.l
> +++ b/gas/testsuite/gas/riscv/csr-version-1p9p1.l
> @@ -923,13 +923,13 @@
>  .*Info: macro .*
>  .*Warning: invalid CSR `vsatp', needs `h' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `miselect', needs `smaia' extension
> +.*Warning: invalid CSR `miselect', needs `smaia' or `smcsrind' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `miselect', needs `smaia' extension
> +.*Warning: invalid CSR `miselect', needs `smaia' or `smcsrind' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `mireg', needs `smaia' extension
> +.*Warning: invalid CSR `mireg', needs `smaia' or `smcsrind' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `mireg', needs `smaia' extension
> +.*Warning: invalid CSR `mireg', needs `smaia' or `smcsrind' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `mtopei', needs `smaia' extension
>  .*Info: macro .*
> @@ -989,6 +989,26 @@
>  .*Info: macro .*
>  .*Warning: invalid CSR `miph', needs `smaia' extension
>  .*Info: macro .*
> +.*Warning: invalid CSR `mireg2', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg2', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg3', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg3', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg4', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg4', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg5', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg5', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg6', needs `smcsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `mireg6', needs `smcsrind' extension
> +.*Info: macro .*
>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
> @@ -1133,13 +1153,13 @@
>  .*Info: macro .*
>  .*Warning: invalid CSR `hstateen3h', needs `ssstateen' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `siselect', needs `ssaia' extension
> +.*Warning: invalid CSR `siselect', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `siselect', needs `ssaia' extension
> +.*Warning: invalid CSR `siselect', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `sireg', needs `ssaia' extension
> +.*Warning: invalid CSR `sireg', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `sireg', needs `ssaia' extension
> +.*Warning: invalid CSR `sireg', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `stopei', needs `ssaia' extension
>  .*Info: macro .*
> @@ -1201,19 +1221,19 @@
>  .*Info: macro .*
>  .*Warning: invalid CSR `vsiselect', needs `h' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `vsiselect', needs `ssaia' extension
> +.*Warning: invalid CSR `vsiselect', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `vsiselect', needs `h' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `vsiselect', needs `ssaia' extension
> +.*Warning: invalid CSR `vsiselect', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `vsireg', needs `h' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `vsireg', needs `ssaia' extension
> +.*Warning: invalid CSR `vsireg', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `vsireg', needs `h' extension
>  .*Info: macro .*
> -.*Warning: invalid CSR `vsireg', needs `ssaia' extension
> +.*Warning: invalid CSR `vsireg', needs `ssaia' or `sscsrind' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `vstopei', needs `h' extension
>  .*Info: macro .*
> @@ -1555,6 +1575,66 @@
>  .*Info: macro .*
>  .*Warning: invalid CSR `mhpmevent31h', needs `sscofpmf' extension
>  .*Info: macro .*
> +.*Warning: invalid CSR `sireg2', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg2', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg3', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg3', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg4', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg4', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg5', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg5', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg6', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `sireg6', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg2', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg2', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg2', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg2', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg3', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg3', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg3', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg3', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg4', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg4', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg4', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg4', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg5', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg5', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg5', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg5', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg6', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg6', needs `sscsrind' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg6', needs `h' extension
> +.*Info: macro .*
> +.*Warning: invalid CSR `vsireg6', needs `sscsrind' extension
> +.*Info: macro .*
>  .*Warning: invalid CSR `stimecmp', needs `sstc' extension
>  .*Info: macro .*
>  .*Warning: invalid CSR `stimecmp', needs `sstc' extension
> diff --git a/gas/testsuite/gas/riscv/csr.s b/gas/testsuite/gas/riscv/csr.s
> index c7406ce34c2e..cfe62a5f0c47 100644
> --- a/gas/testsuite/gas/riscv/csr.s
> +++ b/gas/testsuite/gas/riscv/csr.s
> @@ -350,6 +350,13 @@
>         csr mviph
>         csr miph
>
> +       # Smcsrind extension (except miselect/mireg in Smaia)
> +       csr mireg2
> +       csr mireg3
> +       csr mireg4
> +       csr mireg5
> +       csr mireg6
> +
>         # Smstateen/Ssstateen extensions
>         csr mstateen0
>         csr mstateen1
> @@ -427,6 +434,18 @@
>         csr mhpmevent30h
>         csr mhpmevent31h
>
> +       # Sscsrind extension (except {v,}si{select,reg} in Ssaia)
> +       csr sireg2
> +       csr sireg3
> +       csr sireg4
> +       csr sireg5
> +       csr sireg6
> +       csr vsireg2
> +       csr vsireg3
> +       csr vsireg4
> +       csr vsireg5
> +       csr vsireg6
> +
>         # Sstc extension
>         csr stimecmp
>         csr stimecmph
> diff --git a/include/opcode/riscv-opc.h b/include/opcode/riscv-opc.h
> index 26d2c04bf241..cca5c3d375a1 100644
> --- a/include/opcode/riscv-opc.h
> +++ b/include/opcode/riscv-opc.h
> @@ -2880,6 +2880,12 @@
>  #define CSR_MVIENH   0x318
>  #define CSR_MVIPH    0x319
>  #define CSR_MIPH     0x354
> +/* Smcsrind extension.  */
> +#define CSR_MIREG2 0x352
> +#define CSR_MIREG3 0x353
> +#define CSR_MIREG4 0x355
> +#define CSR_MIREG5 0x356
> +#define CSR_MIREG6 0x357
>  /* Smstateen extension */
>  #define CSR_MSTATEEN0 0x30c
>  #define CSR_MSTATEEN1 0x30d
> @@ -2954,6 +2960,17 @@
>  #define CSR_MHPMEVENT29H 0x73d
>  #define CSR_MHPMEVENT30H 0x73e
>  #define CSR_MHPMEVENT31H 0x73f
> +/* Sscsrind extension.  */
> +#define CSR_SIREG2 0x152
> +#define CSR_SIREG3 0x153
> +#define CSR_SIREG4 0x155
> +#define CSR_SIREG5 0x156
> +#define CSR_SIREG6 0x157
> +#define CSR_VSIREG2 0x252
> +#define CSR_VSIREG3 0x253
> +#define CSR_VSIREG4 0x255
> +#define CSR_VSIREG5 0x256
> +#define CSR_VSIREG6 0x257
>  /* Sstc extension */
>  #define CSR_STIMECMP 0x14d
>  #define CSR_STIMECMPH 0x15d
> @@ -3855,8 +3872,8 @@ DECLARE_CSR(vstval, CSR_VSTVAL, CSR_CLASS_H,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLA
>  DECLARE_CSR(vsip, CSR_VSIP, CSR_CLASS_H, PRIV_SPEC_CLASS_NONE,
> PRIV_SPEC_CLASS_NONE)
>  DECLARE_CSR(vsatp, CSR_VSATP, CSR_CLASS_H, PRIV_SPEC_CLASS_NONE,
> PRIV_SPEC_CLASS_NONE)
>  /* Smaia extension */
> -DECLARE_CSR(miselect, CSR_MISELECT, CSR_CLASS_SMAIA,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> -DECLARE_CSR(mireg, CSR_MIREG, CSR_CLASS_SMAIA, PRIV_SPEC_CLASS_NONE,
> PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(miselect, CSR_MISELECT, CSR_CLASS_SMAIA_OR_SMCSRIND,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(mireg, CSR_MIREG, CSR_CLASS_SMAIA_OR_SMCSRIND,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>  DECLARE_CSR(mtopei, CSR_MTOPEI, CSR_CLASS_SMAIA, PRIV_SPEC_CLASS_NONE,
> PRIV_SPEC_CLASS_NONE)
>  DECLARE_CSR(mtopi, CSR_MTOPI, CSR_CLASS_SMAIA, PRIV_SPEC_CLASS_NONE,
> PRIV_SPEC_CLASS_NONE)
>  DECLARE_CSR(mvien, CSR_MVIEN, CSR_CLASS_SMAIA, PRIV_SPEC_CLASS_NONE,
> PRIV_SPEC_CLASS_NONE)
> @@ -3866,6 +3883,12 @@ 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)
> +/* Smcsrind extension.  */
> +DECLARE_CSR(mireg2, CSR_MIREG2, CSR_CLASS_SMCSRIND, PRIV_SPEC_CLASS_NONE,
> PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(mireg3, CSR_MIREG3, CSR_CLASS_SMCSRIND, PRIV_SPEC_CLASS_NONE,
> PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(mireg4, CSR_MIREG4, CSR_CLASS_SMCSRIND, PRIV_SPEC_CLASS_NONE,
> PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(mireg5, CSR_MIREG5, CSR_CLASS_SMCSRIND, PRIV_SPEC_CLASS_NONE,
> PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(mireg6, CSR_MIREG6, CSR_CLASS_SMCSRIND, 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)
> @@ -3888,8 +3911,8 @@ DECLARE_CSR(hstateen1h, CSR_HSTATEEN1H,
> CSR_CLASS_SSSTATEEN_AND_H_32, PRIV_SPEC_
>  DECLARE_CSR(hstateen2h, CSR_HSTATEEN2H, CSR_CLASS_SSSTATEEN_AND_H_32,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>  DECLARE_CSR(hstateen3h, CSR_HSTATEEN3H, CSR_CLASS_SSSTATEEN_AND_H_32,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>  /* Ssaia extension */
> -DECLARE_CSR(siselect, CSR_SISELECT, CSR_CLASS_SSAIA,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> -DECLARE_CSR(sireg, CSR_SIREG, CSR_CLASS_SSAIA, PRIV_SPEC_CLASS_NONE,
> PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(siselect, CSR_SISELECT, CSR_CLASS_SSAIA_OR_SSCSRIND,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(sireg, CSR_SIREG, CSR_CLASS_SSAIA_OR_SSCSRIND,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>  DECLARE_CSR(stopei, CSR_STOPEI, CSR_CLASS_SSAIA, PRIV_SPEC_CLASS_NONE,
> PRIV_SPEC_CLASS_NONE)
>  DECLARE_CSR(stopi, CSR_STOPI, CSR_CLASS_SSAIA, PRIV_SPEC_CLASS_NONE,
> PRIV_SPEC_CLASS_NONE)
>  DECLARE_CSR(sieh, CSR_SIEH, CSR_CLASS_SSAIA_32, PRIV_SPEC_CLASS_NONE,
> PRIV_SPEC_CLASS_NONE)
> @@ -3898,8 +3921,8 @@ DECLARE_CSR(hvien, CSR_HVIEN, CSR_CLASS_SSAIA_AND_H,
> PRIV_SPEC_CLASS_NONE, PRIV_
>  DECLARE_CSR(hvictl, CSR_HVICTL, CSR_CLASS_SSAIA_AND_H,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>  DECLARE_CSR(hviprio1, CSR_HVIPRIO1, CSR_CLASS_SSAIA_AND_H,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>  DECLARE_CSR(hviprio2, CSR_HVIPRIO2, CSR_CLASS_SSAIA_AND_H,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> -DECLARE_CSR(vsiselect, CSR_VSISELECT, CSR_CLASS_SSAIA_AND_H,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> -DECLARE_CSR(vsireg, CSR_VSIREG, CSR_CLASS_SSAIA_AND_H,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(vsiselect, CSR_VSISELECT, CSR_CLASS_SSAIA_OR_SSCSRIND_AND_H,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(vsireg, CSR_VSIREG, CSR_CLASS_SSAIA_OR_SSCSRIND_AND_H,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>  DECLARE_CSR(vstopei, CSR_VSTOPEI, CSR_CLASS_SSAIA_AND_H,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>  DECLARE_CSR(vstopi, CSR_VSTOPI, CSR_CLASS_SSAIA_AND_H,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>  DECLARE_CSR(hidelegh, CSR_HIDELEGH, CSR_CLASS_SSAIA_AND_H_32,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> @@ -3940,6 +3963,17 @@ DECLARE_CSR(mhpmevent28h, CSR_MHPMEVENT28H,
> CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLA
>  DECLARE_CSR(mhpmevent29h, CSR_MHPMEVENT29H, CSR_CLASS_SSCOFPMF_32,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>  DECLARE_CSR(mhpmevent30h, CSR_MHPMEVENT30H, CSR_CLASS_SSCOFPMF_32,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>  DECLARE_CSR(mhpmevent31h, CSR_MHPMEVENT31H, CSR_CLASS_SSCOFPMF_32,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> +/* Sscsrind extension.  */
> +DECLARE_CSR(sireg2, CSR_SIREG2, CSR_CLASS_SSCSRIND, PRIV_SPEC_CLASS_NONE,
> PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(sireg3, CSR_SIREG3, CSR_CLASS_SSCSRIND, PRIV_SPEC_CLASS_NONE,
> PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(sireg4, CSR_SIREG4, CSR_CLASS_SSCSRIND, PRIV_SPEC_CLASS_NONE,
> PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(sireg5, CSR_SIREG5, CSR_CLASS_SSCSRIND, PRIV_SPEC_CLASS_NONE,
> PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(sireg6, CSR_SIREG6, CSR_CLASS_SSCSRIND, PRIV_SPEC_CLASS_NONE,
> PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(vsireg2, CSR_VSIREG2, CSR_CLASS_SSCSRIND_AND_H,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(vsireg3, CSR_VSIREG3, CSR_CLASS_SSCSRIND_AND_H,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(vsireg4, CSR_VSIREG4, CSR_CLASS_SSCSRIND_AND_H,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(vsireg5, CSR_VSIREG5, CSR_CLASS_SSCSRIND_AND_H,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> +DECLARE_CSR(vsireg6, CSR_VSIREG6, CSR_CLASS_SSCSRIND_AND_H,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
>  /* Sstc extension */
>  DECLARE_CSR(stimecmp, CSR_STIMECMP, CSR_CLASS_SSTC, PRIV_SPEC_CLASS_NONE,
> PRIV_SPEC_CLASS_NONE)
>  DECLARE_CSR(stimecmph, CSR_STIMECMPH, CSR_CLASS_SSTC_32,
> PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
> --
> 2.41.0
>
>

      reply	other threads:[~2023-08-24  1:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-11  2:39 [REVIEW ONLY 0/2] UNRATIFIED RISC-V: Add support for indirect CSR access extensions Tsukasa OI
2023-08-11  2:39 ` [REVIEW ONLY 1/2] RISC-V: Add complex CSR error handling Tsukasa OI
2023-08-11  2:39 ` [REVIEW ONLY 2/2] UNRATIFIED RISC-V: Add indirect CSR Access Extensions and its CSRs Tsukasa OI
2023-08-21  7:27 ` [PATCH 0/2] RISC-V: Add support for indirect CSR access extensions Tsukasa OI
2023-08-21  7:27   ` [PATCH 1/2] RISC-V: Add complex CSR error handling Tsukasa OI
2023-08-21  7:27   ` [PATCH 2/2] RISC-V: Add indirect CSR Access Extensions and its CSRs Tsukasa OI
2023-08-24  1:28     ` Nelson Chu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPpQWtBBdphQi_=O-BZMkx7wGvvm-8Vdaps2KxW1xG1yp-0tYA@mail.gmail.com' \
    --to=nelson@rivosinc.com \
    --cc=andrew@sifive.com \
    --cc=binutils@sourceware.org \
    --cc=jim.wilson.gcc@gmail.com \
    --cc=kito.cheng@sifive.com \
    --cc=palmer@dabbelt.com \
    --cc=research_trasio@irq.a4lg.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).