aboutsummaryrefslogtreecommitdiff
path: root/riscv/csrs.cc
AgeCommit message (Collapse)AuthorFilesLines
2024-08-01Avoid magic constants in hpmcounter implementationAndrew Waterman1-6/+6
2024-07-21Merge pull request #1729 from YenHaoChen/pr-require-vectorAndrew Waterman1-7/+2
Fix: Vector CSRs exist without any vector extension since a484f6e
2024-07-19Check if any vector extensions for vector CSRsYenHaoChen1-2/+2
2024-07-17Fix require_vector_vs checking by reverting ↵YenHaoChen1-5/+0
https://github.com/riscv-software-src/riscv-isa-sim/commit/66c4853bdc5b22bf4c4b364218c713e3f1e487f3 The require_vector_vs, i.e., sstatus_csr_t::enabled(SSTATUS_VS), was expected to provide has_any_vector() check [1]. Unfortunately, a previous commit [2] made the sstatus_csr_t::enabled(SSTATUS_VS) true without any vector extension. The previous commit [2] was for P-extension, which has been removed from Spike [3]. This commit reverts the commit [2] and corrects require_vector_vs [1]. [1] https://github.com/riscv-software-src/riscv-isa-sim/pull/1701/commits/a484f6efc5f50836bb8d846180dfbb9786d09ae2 [2] https://github.com/riscv-software-src/riscv-isa-sim/commit/66c4853bdc5b22bf4c4b364218c713e3f1e487f3 [3] https://github.com/riscv-software-src/riscv-isa-sim/pull/1660
2024-07-06Add SsdbltrpVed Shanbhogue1-4/+37
2024-07-06pointer masking: Implement hstatus.HUPMM (Flush TLB on changing hstatus.HUPMM)YenHaoChen1-1/+8
2024-07-06refactor: Add specialized hstatus_csr_tYenHaoChen1-0/+13
2024-07-06pointer masking: Implement Smnpm (Flush TLB on changing *envcfg.PMM)YenHaoChen1-0/+3
2024-07-06pointer masking: Let menvcfg.PMM be WARL if with SmnpmYenHaoChen1-1/+6
2024-07-06pointer masking: Let mseccfg.PMM be WARL if with SmmpmYenHaoChen1-0/+7
2024-07-19Merge pull request #1724 from chihminchao/cif-sse-fixAndrew Waterman1-1/+13
The senvcfg.SSE will read (only) as zero when menvcfg.SSE is 0
2024-07-19Merge pull request #1732 from chihminchao/fix-zkrAndrew Waterman1-1/+25
Fix zkr
2024-07-18The senvcfg.SSE will read (only) as zero when menvcfg.SSE is 0Binno1-1/+13
2024-07-17zkr: entropy source access control for seed csrBinno1-0/+18
2024-07-17Merge pull request #1736 from YenHaoChen/pr-hlvx-epmpAndrew Waterman1-3/+3
Fix ePMP checking on hlvx instructions
2024-07-18Fix ePMP checking on hlvx instructionsYenHaoChen1-3/+3
The hlvx instruction must grant PMP permissions of both execution and reading. Thus, with ePMP (mseccfg.MML==1), the hlvx instructions are only permitted with pmpcfg.RWXL=0111 from M-mode.
2024-07-17Merge pull request #1735 from chihminchao/deleg-hw-excpAndrew Waterman1-0/+1
excp: support hardware_error_exception delegation
2024-07-17Merge pull request #1733 from chihminchao/fix-ssqosidAndrew Waterman1-2/+4
ssqosid: modify permission check condition for srmcfg
2024-07-16zkr: enable write for useed/sseed fileds of mseccfg csrBinno1-0/+5
2024-07-16excp: support hardware_error_exception delegationBinno1-0/+1
enable M -> S and HS -> VU/VS delegation
2024-07-16ssqosid: modify permission check condition for srmcfgBinno1-2/+4
The srmcfg csr number is 0x181 which is a S-mode csr The patche uses independant permission check to make the csr available even there is no S-mode
2024-07-16zkr: check extension availability in csr_mseccef permssion checkBinno1-1/+2
2024-07-15Deprecate dcsr.haltYenHaoChen1-1/+0
The debug spec 1.0.0-rc3 deprecates the dcsr.halt and lets the bit become dcsr.nmip. This commit separates the halt variable from the dcsr.nmip and designates it as an internal variable for halt_on_reset (-H). Additionally, this commit removes the notifying comment about the deprecated dcsr.halt in the main loop.
2024-07-02Update encoding.h for pointer maskingYenHaoChen1-2/+2
Rename DCSR_STOPCYCLE to DCSR_STOPCOUNT Rename DCSR_HALT to DCSR_NMIP
2024-06-21Relax mstatus.vs dependency on full VJerry Zhao1-1/+2
2024-06-21Relax vector_csr dependency on 'V'Jerry Zhao1-4/+0
2024-06-21Relax has_fs dependency on misa.vJerry Zhao1-2/+1
isa_parser should already require any Zvef or Zved extensions imply F/D
2024-05-27Require vector extension when attempting vxsat writesrbuchner1-0/+2
Accidentally removed in c9468f6e02. See #1660.
2024-05-01Remove Zbpbo, Zpn, and Zpsfoperand implementationAndrew Waterman1-2/+0
2024-04-29Merge pull request #1648 from YenHaoChen/pr-hstateenAndrew Waterman1-5/+7
Smstateen: Ignore writes to read-only hstateen*[n] bits when mstateen*[n]=0
2024-04-29add hlvx pmp protect to fix issue 1557xinyuwang-sifive1-2/+2
2024-04-23Smstateen: Ignore writes to read-only hstateen*[n] bits when mstateen*[n]=0YenHaoChen1-5/+7
The specification states that writes to read-only bits in a RW CSR are ignored. The hstateen*[n] bits are read-only when mstateen*[n]=0. This PR proposes ignoring writes to read-only hstateen*[n] bits when mstateen*[n]=0 instead of writing the bits to 0.
2024-04-18Add Zicfiss extension from CFI extension, v0.4.0SuHsien Ho1-0/+10
1. Add EXT_ZICFISS for enable Zicfiss with zicfiss extension name. 2. Add new software exception with tval 3 for shadow stack. 3. Implement sspush_x1/sspush_x5/sspopchk_x1/sspopchk_x5/ssrdp/ssamoswap_w/ssamoswap_d. 4. Implement c_sspush_x1/c_sspopchk_x5 in c_lui.h which has same encoding. 5. Add new special access type ss_access in xlate_flags_t for checking special read/write permission in SS(Shadow Stack) page. 6. Add new ss_load/ss_store/ssamoswap to enable ss_access flag. 7. Check special pte(xwr=010) of SS page.
2024-04-09Ignore writes to henvcfg fields (PBMTE, STCE, and ADUE) when read-only 0YenHaoChen1-0/+5
The henvcfg fields, i.e., PBMTE, STCE, and ADUE, are read-only 0 when the corresponding bits in menvcfg are 0. Besides the reading behavior, the spec also specified the writing behavior, i.e., ignoring writes. This commit ignores writes to the henvcfg fields when read-only 0. Reference: https://github.com/riscv/riscv-isa-manual/issues/1312
2024-03-22Allow software check exception to be delegated from M mode regardless of ↵Ming-Yi Lai1-1/+1
Zicfilp being enabled
2024-03-06Zicfilp: Support delegating software check exception handlingMing-Yi Lai1-0/+1
2024-03-06Zicfilp: Preserve expected landing pad state on trapsMing-Yi Lai1-1/+3
2024-03-06Zicfilp: Add CSR fieldsMing-Yi Lai1-3/+16
2024-02-07Merge pull request #1591 from YenHaoChen/pr-sstc-stceAndrew Waterman1-2/+4
Teach Sstc to respect xenvcfg.STCE
2024-02-06Fix hvip.VSEIP and hvip.VSTIP, so they don't observe platform-specific ↵YenHaoChen1-0/+17
interrupts or CSR hgeip bits The H extension defines that bits VSEIP, VSTIP, and VSSIP of hvip are writable. (The other bits of hvip are read-only 0.) Only hip.VSSIP (mip.VSSIP) is an alias of hvip.VSSIP. The hip.VSEIP is the logical-OR of hvip.VSEIP, selected bit of hgeip by hstatus.VGEIN, and platform-specific external interrupt signals to VS-level, e.g., from AIA. The hip.VSTIP is the logical-OR of hvip.VSTIP and platform-specific timer interrupt signals to VS-level, e.g., from Sstc. Thus, the read values of hvip.VSEIP and hvip.VSTIP differ from the ones of hip.VSEIP and hip.VSTIP (mip.VSEIP and mip.VSTIP). In other words, the hvip isn't an alias (proxy) of mip. The current aliasing (proxy) implementation does not provide the desired behavior for hvip.VSEIP and hvip.VSTIP. An ISA-level behavior difference is that any platform-specific external and timer interrupt signals directed to VS-level should not be observable through the hvip. For instance, the hvip should not observe the virtual timer interrupt signal from the vstimecmp CSR (Sstc extension), which isn't true in the current implementation. Additionally, the hvip should not observe the virtual external interrupt signal from the IMSIC device (AIA extension). Another ISA-level behavior difference is that the hgeip and hstatus.VGEIN also should not affect hvip.VSEIP, which isn't true in the current implementation. This commit fixes the issue by giving the hvip a specialized class, hvip_csr_t. The hvip_csr_t aliases the hvip.VSSIP to the mip.VSSIP but decouples the hvip.VSEIP and hvip.VSTIP from mip.VSEIP and mip.VSTIP. Additionally, the commit updates the read value of mip to be the logical-OR of hvip.VSEIP, hvip.VSTIP, and other sources.
2024-02-06Teach Sstc to respect xenvcfg.STCEYenHaoChen1-2/+4
When menvcfg.STCE=0, mip.STIP reverts to its defined behavior as if unsupporting Sstc extension. When henvcfg.STCE=0, mip.VSTIP reverts to its defined behavior as if unsupporting Sstc extension. [https://github.com/riscv/riscv-time-compare/issues/5] The previous Sstc implementation does not respect the xenvcfg.STCE. In other words, the Sstc may assert mip.STIP (mip.VSTIP) when menvcfg.STCE=0 (henvcfg.STCE=0), which is a misbehaving.
2024-01-10fix merge issueVed Shanbhogue1-1/+0
2024-01-10fix merge issueVed Shanbhogue1-3/+0
2024-01-10Merge branch 'master' into zaamo_zalrscVed Shanbhogue1-0/+4
Signed-off-by: Ved Shanbhogue <91900059+ved-rivos@users.noreply.github.com>
2024-01-10Add Zaamo and Zalrsc extensionsVed Shanbhogue1-1/+7
2024-01-10B=Zba+Zbb+ZbsVed Shanbhogue1-1/+6
2024-01-04typo: HPM counters consider previous privilege mode if changedYenHaoChen1-1/+1
2023-12-30Add srmcfg CSRVed Shanbhogue1-0/+19
2023-11-29fix: dcsr.ebreak(v)[su] hardwired to 0 if unsupport corresponding privilege ↵YenHaoChen1-4/+4
modes
2023-11-24stimecmp: perform menvcfg.STCE permission check when accessing vstimecmp in ↵YenHaoChen1-2/+6
HS-mode The spec requires menvcfg.STCE=1 on accessing stimecmp or vstimecmp in a mode other than M-mode. The previous implementation does not check the permission on accessing vstimecmp in HS-mode. This commit fixes the issue by moveing the permission check from virtualized_stimecmp_csr_t to stimecmp_csr_t, which implements the vstimecmp.