mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-29 21:12:07 -06:00
qemu/timer: Add host ticks function for LoongArch
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>
This commit is contained in:
parent
57a8a80d1a
commit
d16ccfea23
1 changed files with 9 additions and 0 deletions
|
@ -1016,6 +1016,15 @@ static inline int64_t cpu_get_host_ticks(void)
|
||||||
return val;
|
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
|
#else
|
||||||
/* The host CPU doesn't have an easily accessible cycle counter.
|
/* The host CPU doesn't have an easily accessible cycle counter.
|
||||||
Just return a monotonically increasing value. This will be
|
Just return a monotonically increasing value. This will be
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue