summaryrefslogtreecommitdiff
path: root/hw/riscv/sifive_clint.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/riscv/sifive_clint.c')
-rw-r--r--hw/riscv/sifive_clint.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/hw/riscv/sifive_clint.c b/hw/riscv/sifive_clint.c
index e2feee871b..e933d35092 100644
--- a/hw/riscv/sifive_clint.c
+++ b/hw/riscv/sifive_clint.c
@@ -227,7 +227,8 @@ type_init(sifive_clint_register_types)
* Create CLINT device.
*/
DeviceState *sifive_clint_create(hwaddr addr, hwaddr size, uint32_t num_harts,
- uint32_t sip_base, uint32_t timecmp_base, uint32_t time_base)
+ uint32_t sip_base, uint32_t timecmp_base, uint32_t time_base,
+ bool provide_rdtime)
{
int i;
for (i = 0; i < num_harts; i++) {
@@ -236,6 +237,9 @@ DeviceState *sifive_clint_create(hwaddr addr, hwaddr size, uint32_t num_harts,
if (!env) {
continue;
}
+ if (provide_rdtime) {
+ riscv_cpu_set_rdtime_fn(env, cpu_riscv_read_rtc);
+ }
env->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL,
&sifive_clint_timer_cb, cpu);
env->timecmp = 0;