[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 14/20] hw/mips/mipssim: Correct CPU frequency
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 14/20] hw/mips/mipssim: Correct CPU frequency |
Date: |
Sat, 10 Oct 2020 19:26:11 +0200 |
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(-)
diff --git a/hw/mips/mipssim.c b/hw/mips/mipssim.c
index 5d4ad74828d..ded96a7868c 100644
--- a/hw/mips/mipssim.c
+++ b/hw/mips/mipssim.c
@@ -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 = clock_new(OBJECT(machine), "cpuclk-out");
+#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-in", cpuclk);
+ qdev_realize(DEVICE(cpu), NULL, &error_abort);
env = &cpu->env;
reset_info = g_malloc0(sizeof(ResetData));
--
2.26.2
- [PATCH v2 02/20] qdev-monitor: Display frequencies scaled to SI unit, (continued)
- [PATCH v2 02/20] qdev-monitor: Display frequencies scaled to SI unit, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v2 03/20] hw/qdev-clock: Display error hint when clock is missing from device, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v2 04/20] hw/core/clock: add the clock_new helper function, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v2 06/20] target/mips/cp0_timer: Explicit unit in variable name, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v2 05/20] target/mips: Move cpu_mips_get_random() with CP0 helpers, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v2 07/20] target/mips/cp0_timer: Document TIMER_PERIOD origin, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v2 08/20] target/mips: Move cp0_count_ns to CPUMIPSState, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v2 09/20] target/mips/cpu: Calculate the CP0 timer period using the CPU frequency, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v2 11/20] target/mips/cpu: Allow the CPU to use dynamic frequencies, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v2 10/20] target/mips/cpu: Make cp0_count_rate a property, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v2 14/20] hw/mips/mipssim: Correct CPU frequency,
Philippe Mathieu-Daudé <=
- [PATCH v2 13/20] hw/mips/fuloong2e: Set CPU frequency to 533 MHz, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v2 12/20] hw/mips/r4k: Explicit CPU frequency is 200 MHz, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v2 18/20] hw/mips/malta: Set CPU frequency to 320 MHz, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v2 17/20] hw/mips/boston: Set CPU frequency to 1 GHz, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v2 15/20] hw/mips/jazz: Correct CPU frequencies, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v2 20/20] target/mips/cpu: Display warning when CPU is used without input clock, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v2 16/20] hw/mips/cps: Expose input clock and connect it to CPU cores, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v2 19/20] hw/mips/cps: Do not allow use without input clock, Philippe Mathieu-Daudé, 2020/10/10