mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 02:24:58 -06:00
target/riscv/kvm: fix timebase-frequency when using KVM acceleration
The timebase-frequency of guest OS should be the same with host machine. The timebase-frequency value in DTS should be got from hypervisor when using KVM acceleration. Signed-off-by: Yong-Xuan Wang <yongxuan.wang@sifive.com> Message-ID: <20240314061510.9800-1-yongxuan.wang@sifive.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
e06adebb08
commit
385e575cd5
3 changed files with 12 additions and 0 deletions
|
@ -739,6 +739,15 @@ static void kvm_riscv_put_regs_timer(CPUState *cs)
|
|||
env->kvm_timer_dirty = false;
|
||||
}
|
||||
|
||||
uint64_t kvm_riscv_get_timebase_frequency(CPUState *cs)
|
||||
{
|
||||
uint64_t reg;
|
||||
|
||||
KVM_RISCV_GET_TIMER(cs, frequency, reg);
|
||||
|
||||
return reg;
|
||||
}
|
||||
|
||||
static int kvm_riscv_get_regs_vector(CPUState *cs)
|
||||
{
|
||||
RISCVCPU *cpu = RISCV_CPU(cs);
|
||||
|
|
|
@ -28,5 +28,6 @@ void kvm_riscv_aia_create(MachineState *machine, uint64_t group_shift,
|
|||
void riscv_kvm_aplic_request(void *opaque, int irq, int level);
|
||||
int kvm_riscv_sync_mpstate_to_kvm(RISCVCPU *cpu, int state);
|
||||
void riscv_kvm_cpu_finalize_features(RISCVCPU *cpu, Error **errp);
|
||||
uint64_t kvm_riscv_get_timebase_frequency(CPUState *cs);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue