projects
/
qemu.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
57a8a80
)
qemu/timer: Add host ticks function for LoongArch
author
Song Gao
<gaosong@loongson.cn>
Tue, 16 Jul 2024 03:15:00 +0000
(11:15 +0800)
committer
Paolo Bonzini
<pbonzini@redhat.com>
Tue, 16 Jul 2024 16:18:24 +0000
(18:18 +0200)
Signed-off-by: Song Gao <gaosong@loongson.cn>
Link:
https://lore.kernel.org/r/20240716031500.4193498-1-gaosong@loongson.cn
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
include/qemu/timer.h
patch
|
blob
|
history
diff --git
a/include/qemu/timer.h
b/include/qemu/timer.h
index 5ce83c791129e121a34f5d3900292fd6118213a1..fa56ec9481def6195ec2e6c83792a485eb2f9692 100644
(file)
--- 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