* [PATCH] qemu/timer: Add host ticks function for LoongArch
@ 2024-07-16 3:15 Song Gao
2024-07-16 8:51 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Song Gao @ 2024-07-16 3:15 UTC (permalink / raw)
To: qemu-devel
Cc: alex.bennee, philmd, richard.henderson, peter.maydell, pbonzini,
maobibo
Signed-off-by: Song Gao <gaosong@loongson.cn>
---
include/qemu/timer.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index 5ce83c7911..fa56ec9481 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -1016,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
--
2.33.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] qemu/timer: Add host ticks function for LoongArch
2024-07-16 3:15 [PATCH] qemu/timer: Add host ticks function for LoongArch Song Gao
@ 2024-07-16 8:51 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2024-07-16 8:51 UTC (permalink / raw)
To: Song Gao
Cc: qemu-devel, alex.bennee, philmd, richard.henderson, peter.maydell,
pbonzini, maobibo
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-07-16 8:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-16 3:15 [PATCH] qemu/timer: Add host ticks function for LoongArch Song Gao
2024-07-16 8:51 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).