aboutsummaryrefslogtreecommitdiff
path: root/include/qemu/timer.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/qemu/timer.h')
-rw-r--r--include/qemu/timer.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index 9a366e5..fa56ec9 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -245,6 +245,21 @@ bool qemu_clock_run_timers(QEMUClockType type);
*/
bool qemu_clock_run_all_timers(void);
+/**
+ * qemu_clock_advance_virtual_time(): advance the virtual time tick
+ * @target_ns: target time in nanoseconds
+ *
+ * This function is used where the control of the flow of time has
+ * been delegated to outside the clock subsystem (be it qtest, icount
+ * or some other external source). You can ask the clock system to
+ * return @early at the first expired timer.
+ *
+ * Time can only move forward, attempts to reverse time would lead to
+ * an error.
+ *
+ * Returns: new virtual time.
+ */
+int64_t qemu_clock_advance_virtual_time(int64_t target_ns);
/*
* QEMUTimerList
@@ -1001,6 +1016,15 @@ static inline int64_t cpu_get_host_ticks(void)
return val;
}
+#elif defined(__loongarch64)
+static inline int64_t cpu_get_host_ticks(void)
+{
+ uint64_t val;
+
+ asm volatile("rdtime.d %0, $zero" : "=r"(val));
+ return val;
+}
+
#else
/* The host CPU doesn't have an easily accessible cycle counter.
Just return a monotonically increasing value. This will be