summaryrefslogtreecommitdiffstats
path: root/include/hw/intc
diff options
context:
space:
mode:
authorFrank Chang2022-04-20 10:08:59 +0200
committerAlistair Francis2022-04-22 02:35:16 +0200
commite2f01f3c2e13bfe0d143d960e784909d924640f3 (patch)
tree535e6a7ec01754d00785db96d2509fa80dc2db44 /include/hw/intc
parenthw/intc: Support 32/64-bit mtimecmp and mtime accesses in RISC-V ACLINT (diff)
downloadqemu-e2f01f3c2e13bfe0d143d960e784909d924640f3.tar.gz
qemu-e2f01f3c2e13bfe0d143d960e784909d924640f3.tar.xz
qemu-e2f01f3c2e13bfe0d143d960e784909d924640f3.zip
hw/intc: Make RISC-V ACLINT mtime MMIO register writable
RISC-V privilege spec defines that mtime is exposed as a memory-mapped machine-mode read-write register. However, as QEMU uses host monotonic timer as timer source, this makes mtime to be read-only in RISC-V ACLINT. This patch makes mtime to be writable by recording the time delta value between the mtime value to be written and the timer value at the time mtime is written. Time delta value is then added back whenever the timer value is retrieved. Signed-off-by: Frank Chang <frank.chang@sifive.com> Reviewed-by: Jim Shu <jim.shu@sifive.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <20220420080901.14655-4-frank.chang@sifive.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'include/hw/intc')
-rw-r--r--include/hw/intc/riscv_aclint.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/hw/intc/riscv_aclint.h b/include/hw/intc/riscv_aclint.h
index 229bd08d25..26d4048687 100644
--- a/include/hw/intc/riscv_aclint.h
+++ b/include/hw/intc/riscv_aclint.h
@@ -31,6 +31,7 @@
typedef struct RISCVAclintMTimerState {
/*< private >*/
SysBusDevice parent_obj;
+ uint64_t time_delta;
/*< public >*/
MemoryRegion mmio;