Skip to content

Commit 3b9744f

Browse files
authored
add non-normative warning about perf implications if CTR is implemented without State Enable (riscv#1886)
1 parent 7d41254 commit 3b9744f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/smctr.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,12 @@ When `hstateen0`.CTR=0, qualified control transfers executed while V=1 will cont
425425
_See <<indirect-csr>> for how bit 60 in `mstateen0` and `hstateen0` can also restrict access to `sireg*`/`siselect` and `vsireg*`/`vsiselect` from privilege modes less privileged than M-mode._
426426
====
427427

428+
[NOTE]
429+
[%unbreakable]
430+
====
431+
_Implementations that support Smctr/Ssctr but not Smstateen/Ssstateen may observe reduced performance. Because Smctr/Ssctr introduces a significant number of new CSRs, it is desirable to avoid save/restore of CTR state when possible. A hypervisor is likely to leverage State Enable to trap on the initial guest access to CTR state, delegating CTR and enabling save/restore of guest CTR state only once the guest has begun to use it. Without Smstateen/Ssstateen, a hypervisor is required to save/restore guest CTR state on every context switch._
432+
====
433+
428434
=== Behavior
429435

430436
CTR records qualified control transfers. Control transfers are qualified if they meet the following criteria:

0 commit comments

Comments
 (0)