mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 16:53:55 -06:00
hw/riscv/riscv-iommu: instantiate hpm_timer
The next HPM related changes requires the HPM overflow timer to be initialized by the riscv-iommu base emulation. Signed-off-by: Tomasz Jeznach <tjeznach@rivosinc.com> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Acked-by: Alistair Francis <alistair.francis@wdc.com> Message-ID: <20250224190826.1858473-6-dbarboza@ventanamicro.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
11ecf24c7e
commit
ffb37df056
4 changed files with 42 additions and 0 deletions
|
@ -2382,6 +2382,8 @@ static void riscv_iommu_realize(DeviceState *dev, Error **errp)
|
|||
address_space_init(&s->trap_as, &s->trap_mr, "riscv-iommu-trap-as");
|
||||
|
||||
if (s->cap & RISCV_IOMMU_CAP_HPM) {
|
||||
s->hpm_timer =
|
||||
timer_new_ns(QEMU_CLOCK_VIRTUAL, riscv_iommu_hpm_timer_cb, s);
|
||||
s->hpm_event_ctr_map = g_hash_table_new(g_direct_hash, g_direct_equal);
|
||||
}
|
||||
}
|
||||
|
@ -2395,6 +2397,7 @@ static void riscv_iommu_unrealize(DeviceState *dev)
|
|||
|
||||
if (s->cap & RISCV_IOMMU_CAP_HPM) {
|
||||
g_hash_table_unref(s->hpm_event_ctr_map);
|
||||
timer_free(s->hpm_timer);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue