I asked this same question shortly after the priv-1.9 came out, Perhaps by now more people have read the spec and someone can answer me. I’d like some more explanation on why the mtimecmp register is in a memory mapped register rather than a csr.
The spec says :
The timer compare register mtimecmp is provided as a memory-mapped register rather than a CSR, as it must live in the same voltage/frequency domain as the real-time clock, and is accessed much less frequently than the timer value itself.
Just before this it says regarding the mtime register: We assume the RTC will be exposed via memory-mapped registers at the platform level, and so one microarchitectural implementation strategy is to convert reads of the mtime CSR into uncached reads of the platform RTC, reusing the existing memory-mapped path to the RTC
I don’t understand why the mtimecmp register can’t also be a CSR, and use the same implementation strategy. Is it not preferable that mtime and mtimecmp are accessed in a consistent manner?
Y'all know mtime has been removed right?
https://github.com/riscv/riscv-opcodes/commit/c86d2ee8
(it appears that all privilege levels are now expected to use the
U-mode "time" CSR for reads. It makes sense IMO to have an abstract
CSR for U-mode because U-mode isn't generally going to have access to
MMIO resources; I'm still eagerly awaiting the U-mode version of misa)
-s
In short, I agree that mtimecmp should be a CSR.
> There is a PVHVM model which is a hybrid of Type 1 and Type 2 and can
> use PV constructs where they are faster than hardware emulation.
I think that this is the purpose of SBI in RISC-V, except that physical
hardware *also* supports the PV constructs.
The page table entries, on the other hand, have far-reaching effects
that are difficult to wrap a useful interface around. For example, the
supervisor must allocate storage for page tables: How large is a page
table? How many virtual address bits does a single table map?
Unless the mapping portion is setup and changed rarely, but permissions are under the supervisor's control...
In practice, mappings change very frequently. Most user page faults are
likely to result in a mapping change. In Linux, page faults are used
for demand-loading executables, demand-loading memory-mapped files,
swapping data back in when needed, and probably more. Also, the entire
page table set is changed on every process switch, but this is done by
reloading the page table base register.