@@ -40,6 +40,7 @@
#include "hw/loader.h"
#include "elf.h"
#include "hw/sysbus.h"
+#include "hw/qdev-clock.h"
#include "hw/qdev-properties.h"
#include "exec/address-spaces.h"
#include "qemu/error-report.h"
@@ -152,11 +153,20 @@ mips_mipssim_init(MachineState *machine)
MemoryRegion *bios = g_new(MemoryRegion, 1);
MIPSCPU *cpu;
CPUMIPSState *env;
+ Clock *cpuclk;
ResetData *reset_info;
int bios_size;
/* Init CPUs. */
- cpu = MIPS_CPU(cpu_create(machine->cpu_type));
+ cpu = MIPS_CPU(object_new(machine->cpu_type));
+ cpuclk = qdev_init_clock_out(DEVICE(cpu), "cpuclk");
+#ifdef TARGET_MIPS64
+ clock_set_hz(cpuclk, 6000000); /* 6 MHz */
+#else
+ clock_set_hz(cpuclk, 12000000); /* 12 MHz */
+#endif
+ qdev_connect_clock_in(DEVICE(cpu), "clk", cpuclk);
+ qdev_realize(DEVICE(cpu), NULL, &error_abort);
env = &cpu->env;
reset_info = g_malloc0(sizeof(ResetData));
The MIPSsim machine CPU frequency is too fast running at 200 MHz, while it should be 12 MHz for the 24K and 6 MHz for the 5K core. Ref: Linux commit c78cbf49c4ed ("Support for MIPSsim, the cycle accurate MIPS simulator.") Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> --- hw/mips/mipssim.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)