Fallback 'clock_freq' to CPU_FREQ if kvmppc_get_clockfreq() fails to read the clock from the DT.
Signed-off-by: Daniel Henrique Barboza <danielhb...@gmail.com> --- hw/ppc/sam460ex.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c index 4d25cb2c2e..0b3ce0cb17 100644 --- a/hw/ppc/sam460ex.c +++ b/hw/ppc/sam460ex.c @@ -178,8 +178,14 @@ static int sam460ex_load_device_tree(hwaddr addr, * directly access the timebase without host involvement, we must expose * the correct frequencies. */ if (kvm_enabled()) { + Error *local_err = NULL; + tb_freq = kvmppc_get_tbfreq(); - clock_freq = kvmppc_get_clockfreq(NULL); + clock_freq = kvmppc_get_clockfreq(&local_err); + + if (local_err) { + clock_freq = CPU_FREQ; + } } qemu_fdt_setprop_cell(fdt, "/cpus/cpu@0", "clock-frequency", -- 2.36.1