diff mbox series

[05/16] target/mips/cpu: Set default CPU frequency to 200 MHz

Message ID 20200928171539.788309-6-f4bug@amsat.org
State New
Headers show
Series hw/mips: Set CPU frequency | expand

Commit Message

Philippe Mathieu-Daudé Sept. 28, 2020, 5:15 p.m. UTC
Since the introduction of the 'r4k' machine in commit 6af0bf9c7c3,
the MIPS target assumes a CPU running at 200 MHz.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 target/mips/cpu.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/target/mips/cpu.c b/target/mips/cpu.c
index c1c0f2e12ba..8d07a293a2e 100644
--- a/target/mips/cpu.c
+++ b/target/mips/cpu.c
@@ -141,6 +141,14 @@  static void mips_cpu_realizefn(DeviceState *dev, Error **errp)
     MIPSCPUClass *mcc = MIPS_CPU_GET_CLASS(dev);
     Error *local_err = NULL;
 
+    if (!clock_get(cs->clock)) {
+        /*
+         * Initialize the frequency to 200MHz in case
+         * the clock remains unconnected.
+         */
+        clock_set_hz(cs->clock, 200000000);
+    }
+
     cpu_exec_realizefn(cs, &local_err);
     if (local_err != NULL) {
         error_propagate(errp, local_err);