mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
target/riscv/cpu.c: validate extensions before riscv_timer_init()
There is no need to init timers if we're not even sure that our extensions are valid. Execute riscv_cpu_validate_set_extensions() before riscv_timer_init(). Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com> Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <20230517135714.211809-10-dbarboza@ventanamicro.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
f5664064cc
commit
e2fa85f42f
1 changed files with 4 additions and 7 deletions
|
@ -1294,13 +1294,6 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef CONFIG_USER_ONLY
|
|
||||||
if (cpu->cfg.ext_sstc) {
|
|
||||||
riscv_timer_init(cpu);
|
|
||||||
}
|
|
||||||
#endif /* CONFIG_USER_ONLY */
|
|
||||||
|
|
||||||
riscv_cpu_validate_set_extensions(cpu, &local_err);
|
riscv_cpu_validate_set_extensions(cpu, &local_err);
|
||||||
if (local_err != NULL) {
|
if (local_err != NULL) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
|
@ -1308,6 +1301,10 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CONFIG_USER_ONLY
|
#ifndef CONFIG_USER_ONLY
|
||||||
|
if (cpu->cfg.ext_sstc) {
|
||||||
|
riscv_timer_init(cpu);
|
||||||
|
}
|
||||||
|
|
||||||
if (cpu->cfg.pmu_num) {
|
if (cpu->cfg.pmu_num) {
|
||||||
if (!riscv_pmu_init(cpu, cpu->cfg.pmu_num) && cpu->cfg.ext_sscofpmf) {
|
if (!riscv_pmu_init(cpu, cpu->cfg.pmu_num) && cpu->cfg.ext_sscofpmf) {
|
||||||
cpu->pmu_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL,
|
cpu->pmu_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue