* [PATCH] hw/riscv/virt-acpi-build.c: Use kvm timer frequency when kvm enabled
@ 2026-03-25 8:13 Yicong Yang
0 siblings, 0 replies; only message in thread
From: Yicong Yang @ 2026-03-25 8:13 UTC (permalink / raw)
To: sunilvl, palmer, alistair.francis
Cc: qemu-riscv, qemu-devel, geshijian, wangziang.ok, Yicong Yang
The timer frequency is decided by the host(kvm) rather than a fixed
RISCV_ACLINT_DEFAULT_TIMEBASE_FREQ on kvm accelerated VM. So build
RCHT with KVM provided timer frequency if KVM is enabled, just like
how we build the timer node on DT based VM.
Fixes: ebfd39289370 ("hw/riscv/virt: virt-acpi-build.c: Add RHCT Table")
Signed-off-by: Yicong Yang <yang.yicong@picoheart.com>
---
hw/riscv/virt-acpi-build.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/hw/riscv/virt-acpi-build.c b/hw/riscv/virt-acpi-build.c
index f1406cb68339..fd6ca5dbc4ff 100644
--- a/hw/riscv/virt-acpi-build.c
+++ b/hw/riscv/virt-acpi-build.c
@@ -35,9 +35,11 @@
#include "hw/riscv/virt.h"
#include "hw/riscv/numa.h"
#include "hw/virtio/virtio-acpi.h"
+#include "kvm/kvm_riscv.h"
#include "migration/vmstate.h"
#include "qapi/error.h"
#include "qemu/error-report.h"
+#include "system/kvm.h"
#include "system/reset.h"
#define ACPI_BUILD_TABLE_SIZE 0x20000
@@ -296,7 +298,10 @@ static void build_rhct(GArray *table_data,
/* Time Base Frequency */
build_append_int_noprefix(table_data,
- RISCV_ACLINT_DEFAULT_TIMEBASE_FREQ, 8);
+ kvm_enabled() ?
+ kvm_riscv_get_timebase_frequency(&s->soc->harts[0]) :
+ RISCV_ACLINT_DEFAULT_TIMEBASE_FREQ,
+ 8);
/* ISA + N hart info */
num_rhct_nodes = 1 + ms->smp.cpus;
--
2.34.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-03-25 12:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-25 8:13 [PATCH] hw/riscv/virt-acpi-build.c: Use kvm timer frequency when kvm enabled Yicong Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox