RISC-V: Add 'Smcntrpmf' extension and its CSRs
authorTsukasa OI <research_trasio@irq.a4lg.com>
Sun, 3 Sep 2023 02:13:14 +0000 (02:13 +0000)
committerTsukasa OI <research_trasio@irq.a4lg.com>
Tue, 5 Sep 2023 03:09:30 +0000 (03:09 +0000)
This commit adds now stable and approved 'Smcntrpmf' extension defined by
the RISC-V Cycle and Instret Privilege Mode Filtering specification.

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

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

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

bfd/ChangeLog:

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

gas/ChangeLog:

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

include/ChangeLog:

* opcode/riscv-opc.h: Add new CSRs noting that this extension is
incompatible with the privileged specification version 1.9.1.
Move "mscounteren" and "mhcounteren" CSRs, make them aliases and
reuse the CSR numbers from the 'Smcntrpmf' extension.
(CSR_MSCOUNTEREN, CSR_MHCOUNTEREN) Remove as "mscounteren" and
"mhcounteren" are now aliases and new CSR macros are used instead.
(CSR_MCYCLECFG, CSR_MINSTRETCFG, CSR_MCYCLECFGH, CSR_MINSTRETCFGH):
New CSR macros.

14 files changed:
bfd/elfxx-riscv.c
gas/config/tc-riscv.c
gas/testsuite/gas/riscv/csr-dw-regnums.d
gas/testsuite/gas/riscv/csr-dw-regnums.s
gas/testsuite/gas/riscv/csr-version-1p10.d
gas/testsuite/gas/riscv/csr-version-1p10.l
gas/testsuite/gas/riscv/csr-version-1p11.d
gas/testsuite/gas/riscv/csr-version-1p11.l
gas/testsuite/gas/riscv/csr-version-1p12.d
gas/testsuite/gas/riscv/csr-version-1p12.l
gas/testsuite/gas/riscv/csr-version-1p9p1.d
gas/testsuite/gas/riscv/csr-version-1p9p1.l
gas/testsuite/gas/riscv/csr.s
include/opcode/riscv-opc.h

index c5972b4c6576febe233e982e481e9ada5ac903f2..ff61a601ca2a971d5304ce57c214232440595bfe 100644 (file)
@@ -1183,6 +1183,7 @@ static struct riscv_implicit_subset riscv_implicit_subsets[] =
   {"zcd", "zca",       check_implicit_always},
   {"zcb", "zca",       check_implicit_always},
   {"smaia", "ssaia",           check_implicit_always},
+  {"smcntrpmf", "zicsr",       check_implicit_always},
   {"smstateen", "ssstateen",   check_implicit_always},
   {"smepmp", "zicsr",          check_implicit_always},
   {"ssaia", "zicsr",           check_implicit_always},
@@ -1328,6 +1329,7 @@ static struct riscv_supported_ext riscv_supported_std_z_ext[] =
 static struct riscv_supported_ext riscv_supported_std_s_ext[] =
 {
   {"smaia",            ISA_SPEC_CLASS_DRAFT,           1, 0, 0 },
+  {"smcntrpmf",                ISA_SPEC_CLASS_DRAFT,           1, 0, 0 },
   {"smepmp",           ISA_SPEC_CLASS_DRAFT,           1, 0, 0 },
   {"smstateen",                ISA_SPEC_CLASS_DRAFT,           1, 0, 0 },
   {"ssaia",            ISA_SPEC_CLASS_DRAFT,           1, 0, 0 },
index e49b34fd5245c51b587d4c306f0501594135be2b..8c67623e88c19e5e7ba75019ef8bbbed35acca91 100644 (file)
@@ -74,6 +74,8 @@ enum riscv_csr_class
   CSR_CLASS_H_32,      /* hypervisor, rv32 only */
   CSR_CLASS_SMAIA,             /* Smaia */
   CSR_CLASS_SMAIA_32,          /* Smaia, rv32 only */
+  CSR_CLASS_SMCNTRPMF,         /* Smcntrpmf */
+  CSR_CLASS_SMCNTRPMF_32,      /* Smcntrpmf, rv32 only */
   CSR_CLASS_SMSTATEEN,         /* Smstateen only */
   CSR_CLASS_SMSTATEEN_32,      /* Smstateen RV32 only */
   CSR_CLASS_SSAIA,             /* Ssaia */
@@ -1052,6 +1054,13 @@ riscv_csr_address (const char *csr_name,
     case CSR_CLASS_SMAIA:
       extension = "smaia";
       break;
+    case CSR_CLASS_SMCNTRPMF_32:
+      is_rv32_only = true;
+      /* Fall through.  */
+    case CSR_CLASS_SMCNTRPMF:
+      need_check_version = true;
+      extension = "smcntrpmf";
+      break;
     case CSR_CLASS_SMSTATEEN_32:
       is_rv32_only = true;
       /* Fall through.  */
index fd830666ab8980416f3254b904848a0486755fc5..cabb7c719181937f37c96b4e8d01d8acaf6724b4 100644 (file)
@@ -324,6 +324,10 @@ Contents of the .* section:
   DW_CFA_offset_extended_sf: r4888 \(mvienh\) at cfa\+3168
   DW_CFA_offset_extended_sf: r4889 \(mviph\) at cfa\+3172
   DW_CFA_offset_extended_sf: r4948 \(miph\) at cfa\+3408
+  DW_CFA_offset_extended_sf: r4897 \(mcyclecfg\) at cfa\+3204
+  DW_CFA_offset_extended_sf: r4898 \(minstretcfg\) at cfa\+3208
+  DW_CFA_offset_extended_sf: r5921 \(mcyclecfgh\) at cfa\+7300
+  DW_CFA_offset_extended_sf: r5922 \(minstretcfgh\) at cfa\+7304
   DW_CFA_offset_extended_sf: r4876 \(mstateen0\) at cfa\+3120
   DW_CFA_offset_extended_sf: r4877 \(mstateen1\) at cfa\+3124
   DW_CFA_offset_extended_sf: r4878 \(mstateen2\) at cfa\+3128
@@ -404,14 +408,14 @@ Contents of the .* section:
   DW_CFA_offset_extended_sf: r4480 \(satp\) at cfa\+1536
   DW_CFA_offset_extended_sf: r4931 \(mtval\) at cfa\+3340
   DW_CFA_offset_extended_sf: r4896 \(mcountinhibit\) at cfa\+3200
+  DW_CFA_offset_extended_sf: r4897 \(mcyclecfg\) at cfa\+3204
+  DW_CFA_offset_extended_sf: r4898 \(minstretcfg\) at cfa\+3208
   DW_CFA_offset_extended_sf: r4992 \(mbase\) at cfa\+3584
   DW_CFA_offset_extended_sf: r4993 \(mbound\) at cfa\+3588
   DW_CFA_offset_extended_sf: r4994 \(mibase\) at cfa\+3592
   DW_CFA_offset_extended_sf: r4995 \(mibound\) at cfa\+3596
   DW_CFA_offset_extended_sf: r4996 \(mdbase\) at cfa\+3600
   DW_CFA_offset_extended_sf: r4997 \(mdbound\) at cfa\+3604
-  DW_CFA_offset_extended_sf: r4897 \(mscounteren\) at cfa\+3204
-  DW_CFA_offset_extended_sf: r4898 \(mhcounteren\) at cfa\+3208
   DW_CFA_offset_extended: r4096 \(ustatus\) at cfa\+0
   DW_CFA_offset_extended_sf: r4100 \(uie\) at cfa\+16
   DW_CFA_offset_extended_sf: r4101 \(utvec\) at cfa\+20
index b8b0f7902297ca376bbabcefc3164bdee5537218..428d077077905ddd5e3999e1d3d8138ec8e726c1 100644 (file)
@@ -321,6 +321,11 @@ _start:
        .cfi_offset mvienh, 3168
        .cfi_offset mviph, 3172
        .cfi_offset miph, 3408
+       # Smcntrpmf extension
+       .cfi_offset mcyclecfg, 3204
+       .cfi_offset minstretcfg, 3208
+       .cfi_offset mcyclecfgh, 7300
+       .cfi_offset minstretcfgh, 7304
        # Smstateen extension
        .cfi_offset mstateen0, 3120
        .cfi_offset mstateen1, 3124
@@ -406,14 +411,14 @@ _start:
        .cfi_offset sptbr, 1536         # aliases
        .cfi_offset mbadaddr, 3340      # aliases
        .cfi_offset mucounteren, 3200   # aliases
+       .cfi_offset mscounteren, 3204   # aliases
+       .cfi_offset mhcounteren, 3208   # aliases
        .cfi_offset mbase, 3584
        .cfi_offset mbound, 3588
        .cfi_offset mibase, 3592
        .cfi_offset mibound, 3596
        .cfi_offset mdbase, 3600
        .cfi_offset mdbound, 3604
-       .cfi_offset mscounteren, 3204
-       .cfi_offset mhcounteren, 3208
        .cfi_offset ustatus, 0
        .cfi_offset uie, 16
        .cfi_offset utvec, 20
index ee41e1025cce076e746a51483c47b821f84d9eac..dbdc077adac89804b19cd5455a5229e7015602f0 100644 (file)
@@ -623,6 +623,14 @@ Disassembly of section .text:
 [      ]+[0-9a-f]+:[   ]+31959073[     ]+csrw[         ]+mviph,a1
 [      ]+[0-9a-f]+:[   ]+35402573[     ]+csrr[         ]+a0,miph
 [      ]+[0-9a-f]+:[   ]+35459073[     ]+csrw[         ]+miph,a1
+[      ]+[0-9a-f]+:[   ]+32102573[     ]+csrr[         ]+a0,mcyclecfg
+[      ]+[0-9a-f]+:[   ]+32159073[     ]+csrw[         ]+mcyclecfg,a1
+[      ]+[0-9a-f]+:[   ]+32202573[     ]+csrr[         ]+a0,minstretcfg
+[      ]+[0-9a-f]+:[   ]+32259073[     ]+csrw[         ]+minstretcfg,a1
+[      ]+[0-9a-f]+:[   ]+72102573[     ]+csrr[         ]+a0,mcyclecfgh
+[      ]+[0-9a-f]+:[   ]+72159073[     ]+csrw[         ]+mcyclecfgh,a1
+[      ]+[0-9a-f]+:[   ]+72202573[     ]+csrr[         ]+a0,minstretcfgh
+[      ]+[0-9a-f]+:[   ]+72259073[     ]+csrw[         ]+minstretcfgh,a1
 [      ]+[0-9a-f]+:[   ]+30c02573[     ]+csrr[         ]+a0,mstateen0
 [      ]+[0-9a-f]+:[   ]+30c59073[     ]+csrw[         ]+mstateen0,a1
 [      ]+[0-9a-f]+:[   ]+30d02573[     ]+csrr[         ]+a0,mstateen1
@@ -783,6 +791,10 @@ Disassembly of section .text:
 [      ]+[0-9a-f]+:[   ]+34359073[     ]+csrw[         ]+mtval,a1
 [      ]+[0-9a-f]+:[   ]+32002573[     ]+csrr[         ]+a0,0x320
 [      ]+[0-9a-f]+:[   ]+32059073[     ]+csrw[         ]+0x320,a1
+[      ]+[0-9a-f]+:[   ]+32102573[     ]+csrr[         ]+a0,mcyclecfg
+[      ]+[0-9a-f]+:[   ]+32159073[     ]+csrw[         ]+mcyclecfg,a1
+[      ]+[0-9a-f]+:[   ]+32202573[     ]+csrr[         ]+a0,minstretcfg
+[      ]+[0-9a-f]+:[   ]+32259073[     ]+csrw[         ]+minstretcfg,a1
 [      ]+[0-9a-f]+:[   ]+38002573[     ]+csrr[         ]+a0,0x380
 [      ]+[0-9a-f]+:[   ]+38059073[     ]+csrw[         ]+0x380,a1
 [      ]+[0-9a-f]+:[   ]+38102573[     ]+csrr[         ]+a0,0x381
@@ -795,10 +807,6 @@ Disassembly of section .text:
 [      ]+[0-9a-f]+:[   ]+38459073[     ]+csrw[         ]+0x384,a1
 [      ]+[0-9a-f]+:[   ]+38502573[     ]+csrr[         ]+a0,0x385
 [      ]+[0-9a-f]+:[   ]+38559073[     ]+csrw[         ]+0x385,a1
-[      ]+[0-9a-f]+:[   ]+32102573[     ]+csrr[         ]+a0,0x321
-[      ]+[0-9a-f]+:[   ]+32159073[     ]+csrw[         ]+0x321,a1
-[      ]+[0-9a-f]+:[   ]+32202573[     ]+csrr[         ]+a0,0x322
-[      ]+[0-9a-f]+:[   ]+32259073[     ]+csrw[         ]+0x322,a1
 [      ]+[0-9a-f]+:[   ]+00002573[     ]+csrr[         ]+a0,ustatus
 [      ]+[0-9a-f]+:[   ]+00059073[     ]+csrw[         ]+ustatus,a1
 [      ]+[0-9a-f]+:[   ]+00402573[     ]+csrr[         ]+a0,uie
index 27bdc80c0d54d453b080512248461d35232f24cb..054179a416db218572d4a2ba4cd90d5c6bf3ea56 100644 (file)
 .*Info: macro .*
 .*Warning: invalid CSR `miph', needs `smaia' extension
 .*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs `smcntrpmf' extension
+.*Info: macro .*
 .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
 .*Info: macro .*
 .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
 .*Info: macro .*
 .*Warning: invalid CSR `mucounteren' for the privileged spec `1.10'
 .*Info: macro .*
+.*Warning: invalid CSR `mscounteren' for the privileged spec `1.10'
+.*Info: macro .*
+.*Warning: invalid CSR `mscounteren' for the privileged spec `1.10'
+.*Info: macro .*
+.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.10'
+.*Info: macro .*
+.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.10'
+.*Info: macro .*
 .*Warning: invalid CSR `mbase' for the privileged spec `1.10'
 .*Info: macro .*
 .*Warning: invalid CSR `mbase' for the privileged spec `1.10'
 .*Info: macro .*
 .*Warning: invalid CSR `mdbound' for the privileged spec `1.10'
 .*Info: macro .*
-.*Warning: invalid CSR `mscounteren' for the privileged spec `1.10'
-.*Info: macro .*
-.*Warning: invalid CSR `mscounteren' for the privileged spec `1.10'
-.*Info: macro .*
-.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.10'
-.*Info: macro .*
-.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.10'
-.*Info: macro .*
 .*Warning: invalid CSR `fflags', needs `f' extension
 .*Info: macro .*
 .*Warning: invalid CSR `fflags', needs `f' extension
index a83b1bf68f98e44d21a2d9435bf00af5415eb821..7ba88b6d1d53663aaf9b2cb9e893461671b2f5ce 100644 (file)
@@ -623,6 +623,14 @@ Disassembly of section .text:
 [      ]+[0-9a-f]+:[   ]+31959073[     ]+csrw[         ]+mviph,a1
 [      ]+[0-9a-f]+:[   ]+35402573[     ]+csrr[         ]+a0,miph
 [      ]+[0-9a-f]+:[   ]+35459073[     ]+csrw[         ]+miph,a1
+[      ]+[0-9a-f]+:[   ]+32102573[     ]+csrr[         ]+a0,mcyclecfg
+[      ]+[0-9a-f]+:[   ]+32159073[     ]+csrw[         ]+mcyclecfg,a1
+[      ]+[0-9a-f]+:[   ]+32202573[     ]+csrr[         ]+a0,minstretcfg
+[      ]+[0-9a-f]+:[   ]+32259073[     ]+csrw[         ]+minstretcfg,a1
+[      ]+[0-9a-f]+:[   ]+72102573[     ]+csrr[         ]+a0,mcyclecfgh
+[      ]+[0-9a-f]+:[   ]+72159073[     ]+csrw[         ]+mcyclecfgh,a1
+[      ]+[0-9a-f]+:[   ]+72202573[     ]+csrr[         ]+a0,minstretcfgh
+[      ]+[0-9a-f]+:[   ]+72259073[     ]+csrw[         ]+minstretcfgh,a1
 [      ]+[0-9a-f]+:[   ]+30c02573[     ]+csrr[         ]+a0,mstateen0
 [      ]+[0-9a-f]+:[   ]+30c59073[     ]+csrw[         ]+mstateen0,a1
 [      ]+[0-9a-f]+:[   ]+30d02573[     ]+csrr[         ]+a0,mstateen1
@@ -783,6 +791,10 @@ Disassembly of section .text:
 [      ]+[0-9a-f]+:[   ]+34359073[     ]+csrw[         ]+mtval,a1
 [      ]+[0-9a-f]+:[   ]+32002573[     ]+csrr[         ]+a0,mcountinhibit
 [      ]+[0-9a-f]+:[   ]+32059073[     ]+csrw[         ]+mcountinhibit,a1
+[      ]+[0-9a-f]+:[   ]+32102573[     ]+csrr[         ]+a0,mcyclecfg
+[      ]+[0-9a-f]+:[   ]+32159073[     ]+csrw[         ]+mcyclecfg,a1
+[      ]+[0-9a-f]+:[   ]+32202573[     ]+csrr[         ]+a0,minstretcfg
+[      ]+[0-9a-f]+:[   ]+32259073[     ]+csrw[         ]+minstretcfg,a1
 [      ]+[0-9a-f]+:[   ]+38002573[     ]+csrr[         ]+a0,0x380
 [      ]+[0-9a-f]+:[   ]+38059073[     ]+csrw[         ]+0x380,a1
 [      ]+[0-9a-f]+:[   ]+38102573[     ]+csrr[         ]+a0,0x381
@@ -795,10 +807,6 @@ Disassembly of section .text:
 [      ]+[0-9a-f]+:[   ]+38459073[     ]+csrw[         ]+0x384,a1
 [      ]+[0-9a-f]+:[   ]+38502573[     ]+csrr[         ]+a0,0x385
 [      ]+[0-9a-f]+:[   ]+38559073[     ]+csrw[         ]+0x385,a1
-[      ]+[0-9a-f]+:[   ]+32102573[     ]+csrr[         ]+a0,0x321
-[      ]+[0-9a-f]+:[   ]+32159073[     ]+csrw[         ]+0x321,a1
-[      ]+[0-9a-f]+:[   ]+32202573[     ]+csrr[         ]+a0,0x322
-[      ]+[0-9a-f]+:[   ]+32259073[     ]+csrw[         ]+0x322,a1
 [      ]+[0-9a-f]+:[   ]+00002573[     ]+csrr[         ]+a0,ustatus
 [      ]+[0-9a-f]+:[   ]+00059073[     ]+csrw[         ]+ustatus,a1
 [      ]+[0-9a-f]+:[   ]+00402573[     ]+csrr[         ]+a0,uie
index ba497228d7fdb641b7afcaaaa21a5265a42ca920..cc365f1df4154bb6e87aa6180ae31b7b73b0490b 100644 (file)
 .*Info: macro .*
 .*Warning: invalid CSR `miph', needs `smaia' extension
 .*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs `smcntrpmf' extension
+.*Info: macro .*
 .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
 .*Info: macro .*
 .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
 .*Info: macro .*
 .*Warning: invalid CSR `mucounteren' for the privileged spec `1.11'
 .*Info: macro .*
+.*Warning: invalid CSR `mscounteren' for the privileged spec `1.11'
+.*Info: macro .*
+.*Warning: invalid CSR `mscounteren' for the privileged spec `1.11'
+.*Info: macro .*
+.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.11'
+.*Info: macro .*
+.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.11'
+.*Info: macro .*
 .*Warning: invalid CSR `mbase' for the privileged spec `1.11'
 .*Info: macro .*
 .*Warning: invalid CSR `mbase' for the privileged spec `1.11'
 .*Info: macro .*
 .*Warning: invalid CSR `mdbound' for the privileged spec `1.11'
 .*Info: macro .*
-.*Warning: invalid CSR `mscounteren' for the privileged spec `1.11'
-.*Info: macro .*
-.*Warning: invalid CSR `mscounteren' for the privileged spec `1.11'
-.*Info: macro .*
-.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.11'
-.*Info: macro .*
-.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.11'
-.*Info: macro .*
 .*Warning: invalid CSR `fflags', needs `f' extension
 .*Info: macro .*
 .*Warning: invalid CSR `fflags', needs `f' extension
index 612aac28076868df10ddde1fbcb72800c0315cc0..677820b9526556eb20ec64316f628b7308e5cbc8 100644 (file)
@@ -623,6 +623,14 @@ Disassembly of section .text:
 [      ]+[0-9a-f]+:[   ]+31959073[     ]+csrw[         ]+mviph,a1
 [      ]+[0-9a-f]+:[   ]+35402573[     ]+csrr[         ]+a0,miph
 [      ]+[0-9a-f]+:[   ]+35459073[     ]+csrw[         ]+miph,a1
+[      ]+[0-9a-f]+:[   ]+32102573[     ]+csrr[         ]+a0,mcyclecfg
+[      ]+[0-9a-f]+:[   ]+32159073[     ]+csrw[         ]+mcyclecfg,a1
+[      ]+[0-9a-f]+:[   ]+32202573[     ]+csrr[         ]+a0,minstretcfg
+[      ]+[0-9a-f]+:[   ]+32259073[     ]+csrw[         ]+minstretcfg,a1
+[      ]+[0-9a-f]+:[   ]+72102573[     ]+csrr[         ]+a0,mcyclecfgh
+[      ]+[0-9a-f]+:[   ]+72159073[     ]+csrw[         ]+mcyclecfgh,a1
+[      ]+[0-9a-f]+:[   ]+72202573[     ]+csrr[         ]+a0,minstretcfgh
+[      ]+[0-9a-f]+:[   ]+72259073[     ]+csrw[         ]+minstretcfgh,a1
 [      ]+[0-9a-f]+:[   ]+30c02573[     ]+csrr[         ]+a0,mstateen0
 [      ]+[0-9a-f]+:[   ]+30c59073[     ]+csrw[         ]+mstateen0,a1
 [      ]+[0-9a-f]+:[   ]+30d02573[     ]+csrr[         ]+a0,mstateen1
@@ -783,6 +791,10 @@ Disassembly of section .text:
 [      ]+[0-9a-f]+:[   ]+34359073[     ]+csrw[         ]+mtval,a1
 [      ]+[0-9a-f]+:[   ]+32002573[     ]+csrr[         ]+a0,mcountinhibit
 [      ]+[0-9a-f]+:[   ]+32059073[     ]+csrw[         ]+mcountinhibit,a1
+[      ]+[0-9a-f]+:[   ]+32102573[     ]+csrr[         ]+a0,mcyclecfg
+[      ]+[0-9a-f]+:[   ]+32159073[     ]+csrw[         ]+mcyclecfg,a1
+[      ]+[0-9a-f]+:[   ]+32202573[     ]+csrr[         ]+a0,minstretcfg
+[      ]+[0-9a-f]+:[   ]+32259073[     ]+csrw[         ]+minstretcfg,a1
 [      ]+[0-9a-f]+:[   ]+38002573[     ]+csrr[         ]+a0,0x380
 [      ]+[0-9a-f]+:[   ]+38059073[     ]+csrw[         ]+0x380,a1
 [      ]+[0-9a-f]+:[   ]+38102573[     ]+csrr[         ]+a0,0x381
@@ -795,10 +807,6 @@ Disassembly of section .text:
 [      ]+[0-9a-f]+:[   ]+38459073[     ]+csrw[         ]+0x384,a1
 [      ]+[0-9a-f]+:[   ]+38502573[     ]+csrr[         ]+a0,0x385
 [      ]+[0-9a-f]+:[   ]+38559073[     ]+csrw[         ]+0x385,a1
-[      ]+[0-9a-f]+:[   ]+32102573[     ]+csrr[         ]+a0,0x321
-[      ]+[0-9a-f]+:[   ]+32159073[     ]+csrw[         ]+0x321,a1
-[      ]+[0-9a-f]+:[   ]+32202573[     ]+csrr[         ]+a0,0x322
-[      ]+[0-9a-f]+:[   ]+32259073[     ]+csrw[         ]+0x322,a1
 [      ]+[0-9a-f]+:[   ]+00002573[     ]+csrr[         ]+a0,0x0
 [      ]+[0-9a-f]+:[   ]+00059073[     ]+csrw[         ]+0x0,a1
 [      ]+[0-9a-f]+:[   ]+00402573[     ]+csrr[         ]+a0,0x4
index bdebea22334a2baa8297ed90663c27cd6175afda..7a7f5f717c52527e25d5867e4356b19022810567 100644 (file)
 .*Info: macro .*
 .*Warning: invalid CSR `miph', needs `smaia' extension
 .*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs `smcntrpmf' extension
+.*Info: macro .*
 .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
 .*Info: macro .*
 .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
 .*Info: macro .*
 .*Warning: invalid CSR `mucounteren' for the privileged spec `1.12'
 .*Info: macro .*
+.*Warning: invalid CSR `mscounteren' for the privileged spec `1.12'
+.*Info: macro .*
+.*Warning: invalid CSR `mscounteren' for the privileged spec `1.12'
+.*Info: macro .*
+.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.12'
+.*Info: macro .*
+.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.12'
+.*Info: macro .*
 .*Warning: invalid CSR `mbase' for the privileged spec `1.12'
 .*Info: macro .*
 .*Warning: invalid CSR `mbase' for the privileged spec `1.12'
 .*Info: macro .*
 .*Warning: invalid CSR `mdbound' for the privileged spec `1.12'
 .*Info: macro .*
-.*Warning: invalid CSR `mscounteren' for the privileged spec `1.12'
-.*Info: macro .*
-.*Warning: invalid CSR `mscounteren' for the privileged spec `1.12'
-.*Info: macro .*
-.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.12'
-.*Info: macro .*
-.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.12'
-.*Info: macro .*
 .*Warning: invalid CSR `ustatus' for the privileged spec `1.12'
 .*Info: macro .*
 .*Warning: invalid CSR `ustatus' for the privileged spec `1.12'
index 0fe849c269c29849e046af7e6bcd64a77561aae6..f4d2b04ca6a4add5a35e67bda1fc39e3bea2ad2e 100644 (file)
@@ -623,6 +623,14 @@ Disassembly of section .text:
 [      ]+[0-9a-f]+:[   ]+31959073[     ]+csrw[         ]+mviph,a1
 [      ]+[0-9a-f]+:[   ]+35402573[     ]+csrr[         ]+a0,miph
 [      ]+[0-9a-f]+:[   ]+35459073[     ]+csrw[         ]+miph,a1
+[      ]+[0-9a-f]+:[   ]+32102573[     ]+csrr[         ]+a0,mscounteren
+[      ]+[0-9a-f]+:[   ]+32159073[     ]+csrw[         ]+mscounteren,a1
+[      ]+[0-9a-f]+:[   ]+32202573[     ]+csrr[         ]+a0,mhcounteren
+[      ]+[0-9a-f]+:[   ]+32259073[     ]+csrw[         ]+mhcounteren,a1
+[      ]+[0-9a-f]+:[   ]+72102573[     ]+csrr[         ]+a0,0x721
+[      ]+[0-9a-f]+:[   ]+72159073[     ]+csrw[         ]+0x721,a1
+[      ]+[0-9a-f]+:[   ]+72202573[     ]+csrr[         ]+a0,0x722
+[      ]+[0-9a-f]+:[   ]+72259073[     ]+csrw[         ]+0x722,a1
 [      ]+[0-9a-f]+:[   ]+30c02573[     ]+csrr[         ]+a0,mstateen0
 [      ]+[0-9a-f]+:[   ]+30c59073[     ]+csrw[         ]+mstateen0,a1
 [      ]+[0-9a-f]+:[   ]+30d02573[     ]+csrr[         ]+a0,mstateen1
@@ -783,6 +791,10 @@ Disassembly of section .text:
 [      ]+[0-9a-f]+:[   ]+34359073[     ]+csrw[         ]+mbadaddr,a1
 [      ]+[0-9a-f]+:[   ]+32002573[     ]+csrr[         ]+a0,mucounteren
 [      ]+[0-9a-f]+:[   ]+32059073[     ]+csrw[         ]+mucounteren,a1
+[      ]+[0-9a-f]+:[   ]+32102573[     ]+csrr[         ]+a0,mscounteren
+[      ]+[0-9a-f]+:[   ]+32159073[     ]+csrw[         ]+mscounteren,a1
+[      ]+[0-9a-f]+:[   ]+32202573[     ]+csrr[         ]+a0,mhcounteren
+[      ]+[0-9a-f]+:[   ]+32259073[     ]+csrw[         ]+mhcounteren,a1
 [      ]+[0-9a-f]+:[   ]+38002573[     ]+csrr[         ]+a0,mbase
 [      ]+[0-9a-f]+:[   ]+38059073[     ]+csrw[         ]+mbase,a1
 [      ]+[0-9a-f]+:[   ]+38102573[     ]+csrr[         ]+a0,mbound
@@ -795,10 +807,6 @@ Disassembly of section .text:
 [      ]+[0-9a-f]+:[   ]+38459073[     ]+csrw[         ]+mdbase,a1
 [      ]+[0-9a-f]+:[   ]+38502573[     ]+csrr[         ]+a0,mdbound
 [      ]+[0-9a-f]+:[   ]+38559073[     ]+csrw[         ]+mdbound,a1
-[      ]+[0-9a-f]+:[   ]+32102573[     ]+csrr[         ]+a0,mscounteren
-[      ]+[0-9a-f]+:[   ]+32159073[     ]+csrw[         ]+mscounteren,a1
-[      ]+[0-9a-f]+:[   ]+32202573[     ]+csrr[         ]+a0,mhcounteren
-[      ]+[0-9a-f]+:[   ]+32259073[     ]+csrw[         ]+mhcounteren,a1
 [      ]+[0-9a-f]+:[   ]+00002573[     ]+csrr[         ]+a0,ustatus
 [      ]+[0-9a-f]+:[   ]+00059073[     ]+csrw[         ]+ustatus,a1
 [      ]+[0-9a-f]+:[   ]+00402573[     ]+csrr[         ]+a0,uie
index 49bd95954e2cb3f5e8848ee0c3e08e4ce5fe32e7..7fcd73ab7ddd8a36725c2b53dcf8a6d0ada3ac47 100644 (file)
 .*Info: macro .*
 .*Warning: invalid CSR `miph', needs `smaia' extension
 .*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg' for the privileged spec `1.9.1'
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg' for the privileged spec `1.9.1'
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg' for the privileged spec `1.9.1'
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg' for the privileged spec `1.9.1'
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh' for the privileged spec `1.9.1'
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh' for the privileged spec `1.9.1'
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh' for the privileged spec `1.9.1'
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh' for the privileged spec `1.9.1'
+.*Info: macro .*
 .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
 .*Info: macro .*
 .*Warning: invalid CSR `mstateen0', needs `smstateen' extension
index c7406ce34c2e4ad942281b5ff41aec05965e5103..6457436af263f17d9b8a745f49fc7d13b0792a43 100644 (file)
        csr mviph
        csr miph
 
+       # Smcntrpmf extension
+       csr mcyclecfg
+       csr minstretcfg
+       csr mcyclecfgh
+       csr minstretcfgh
+
        # Smstateen/Ssstateen extensions
        csr mstateen0
        csr mstateen1
        csr sptbr               # 0x180 in 1.9.1, but the value is satp since 1.10
        csr mbadaddr            # 0x343 in 1.9.1, but the value is mtval since 1.10
        csr mucounteren         # 0x320 in 1.9.1, dropped in 1.10, but the value is mcountinhibit since 1.11
+       csr mscounteren         # 0x321 in 1.9.1, dropped in 1.10, but the value is mcyclecfg for Smcntrpmf extension
+       csr mhcounteren         # 0x322 in 1.9.1, dropped in 1.10, but the value is mcyclecfg for Smcntrpmf extension
        csr mbase               # 0x380 in 1.9.1, dropped in 1.10
        csr mbound              # 0x381 in 1.9.1, dropped in 1.10
        csr mibase              # 0x382 in 1.9.1, dropped in 1.10
        csr mibound             # 0x383 in 1.9.1, dropped in 1.10
        csr mdbase              # 0x384 in 1.9.1, dropped in 1.10
        csr mdbound             # 0x385 in 1.9.1, dropped in 1.10
-       csr mscounteren         # 0x321 in 1.9.1, dropped in 1.10
-       csr mhcounteren         # 0x322 in 1.9.1, dropped in 1.10
        csr ustatus             # 0x0   in 1.9.1, dropped in 1.12
        csr uie                 # 0x4   in 1.9.1, dropped in 1.12
        csr utvec               # 0x5   in 1.9.1, dropped in 1.12
index 26d2c04bf241e371bc7bbb0f43a50435f324828e..2a26c45f0c24c66937cb405f3a6d3b5c0b70acbb 100644 (file)
 #define CSR_MIBOUND 0x383
 #define CSR_MDBASE 0x384
 #define CSR_MDBOUND 0x385
-#define CSR_MSCOUNTEREN 0x321
-#define CSR_MHCOUNTEREN 0x322
 #define CSR_USTATUS 0x0
 #define CSR_UIE 0x4
 #define CSR_UTVEC 0x5
 #define CSR_MVIENH   0x318
 #define CSR_MVIPH    0x319
 #define CSR_MIPH     0x354
+/* Smcntrpmf extension.  */
+#define CSR_MCYCLECFG    0x321
+#define CSR_MINSTRETCFG  0x322
+#define CSR_MCYCLECFGH   0x721
+#define CSR_MINSTRETCFGH 0x722
 /* Smstateen extension */
 #define CSR_MSTATEEN0 0x30c
 #define CSR_MSTATEEN1 0x30d
@@ -3866,6 +3869,11 @@ DECLARE_CSR(mieh, CSR_MIEH, CSR_CLASS_SMAIA_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_
 DECLARE_CSR(mvienh, CSR_MVIENH, CSR_CLASS_SMAIA_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
 DECLARE_CSR(mviph, CSR_MVIPH, CSR_CLASS_SMAIA_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
 DECLARE_CSR(miph, CSR_MIPH, CSR_CLASS_SMAIA_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+/* Smcntrpmf extension (incompatible with the privileged spec v1.9.1).  */
+DECLARE_CSR(mcyclecfg, CSR_MCYCLECFG, CSR_CLASS_SMCNTRPMF, PRIV_SPEC_CLASS_1P10, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(minstretcfg, CSR_MINSTRETCFG, CSR_CLASS_SMCNTRPMF, PRIV_SPEC_CLASS_1P10, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(mcyclecfgh, CSR_MCYCLECFGH, CSR_CLASS_SMCNTRPMF_32, PRIV_SPEC_CLASS_1P10, PRIV_SPEC_CLASS_DRAFT)
+DECLARE_CSR(minstretcfgh, CSR_MINSTRETCFGH, CSR_CLASS_SMCNTRPMF_32, PRIV_SPEC_CLASS_1P10, PRIV_SPEC_CLASS_DRAFT)
 /* Smstateen/Ssstateen extensions.  */
 DECLARE_CSR(mstateen0, CSR_MSTATEEN0, CSR_CLASS_SMSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
 DECLARE_CSR(mstateen1, CSR_MSTATEEN1, CSR_CLASS_SMSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
@@ -3952,8 +3960,6 @@ DECLARE_CSR(mibase, CSR_MIBASE, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CL
 DECLARE_CSR(mibound, CSR_MIBOUND, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P10)
 DECLARE_CSR(mdbase, CSR_MDBASE, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P10)
 DECLARE_CSR(mdbound, CSR_MDBOUND, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P10)
-DECLARE_CSR(mscounteren, CSR_MSCOUNTEREN, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P10)
-DECLARE_CSR(mhcounteren, CSR_MHCOUNTEREN, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P10)
 DECLARE_CSR(ustatus, CSR_USTATUS, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P12)
 DECLARE_CSR(uie, CSR_UIE, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P12)
 DECLARE_CSR(utvec, CSR_UTVEC, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P12)
@@ -4000,6 +4006,8 @@ DECLARE_CSR_ALIAS(sbadaddr, CSR_STVAL, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_
 DECLARE_CSR_ALIAS(sptbr, CSR_SATP, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P10)
 DECLARE_CSR_ALIAS(mbadaddr, CSR_MTVAL, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P10)
 DECLARE_CSR_ALIAS(mucounteren, CSR_MCOUNTINHIBIT, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P10)
+DECLARE_CSR_ALIAS(mscounteren, CSR_MCYCLECFG, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P10)
+DECLARE_CSR_ALIAS(mhcounteren, CSR_MINSTRETCFG, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P10)
 DECLARE_CSR_ALIAS(dscratch, CSR_DSCRATCH0, CSR_CLASS_DEBUG, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
 DECLARE_CSR_ALIAS(mcontrol, CSR_TDATA1, CSR_CLASS_DEBUG, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
 DECLARE_CSR_ALIAS(mcontrol6, CSR_TDATA1, CSR_CLASS_DEBUG, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)