diff options
author | Jim Shu <jim.shu@sifive.com> | 2025-05-19 22:35:16 +0800 |
---|---|---|
committer | Alistair Francis <alistair.francis@wdc.com> | 2025-07-04 21:09:48 +1000 |
commit | af27fc569af58e10d9e77afd10079809f05827bc (patch) | |
tree | 235b8ceab249e15db470ad7e015e8ee82dc7175b /scripts/tracetool/backend/log.py | |
parent | 6eba6fe967c3a2606ef5ec5ba9a283b21d09f85b (diff) | |
download | qemu-af27fc569af58e10d9e77afd10079809f05827bc.zip qemu-af27fc569af58e10d9e77afd10079809f05827bc.tar.gz qemu-af27fc569af58e10d9e77afd10079809f05827bc.tar.bz2 |
hw/intc: riscv_aclint: Fix mtime write for sstc extension
When changing the mtime value, the period of [s|vs]timecmp timers
should also be updated, similar to the period of mtimecmp timer.
The period of the stimecmp timer is the time until the next S-mode
timer IRQ. The value is calculated as "stimecmp - time". [1]
It is equal to "stimecmp - mtime" since the time CSR is a read-only
shadow of the memory-mapped mtime register.
Thus, changing mtime value will update the period of stimecmp timer.
Similarly, the period of vstimecmp timer is calculated as "vstimecmp -
(mtime + htimedelta)" [2], so changing mtime value will update the
period of vstimecmp timer.
[1] RISC-V Priv spec ch 9.1.1. Supervisor Timer (stimecmp) Register
A supervisor timer interrupt becomes pending, as reflected in the STIP
bit in the mip and sip registers whenever time contains a value
greater than or equal to stimecmp.
[2] RISC-V Priv spec ch19.2.1. Virtual Supervisor Timer (vstimecmp) Register
A virtual supervisor timer interrupt becomes pending, as reflected in
the VSTIP bit in the hip register, whenever (time + htimedelta),
truncated to 64 bits, contains a value greater than or equal to
vstimecmp
Signed-off-by: Jim Shu <jim.shu@sifive.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20250519143518.11086-3-jim.shu@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'scripts/tracetool/backend/log.py')
0 files changed, 0 insertions, 0 deletions