[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 09/20] target/mips/cpu: Calculate the CP0 timer period using t
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v3 09/20] target/mips/cpu: Calculate the CP0 timer period using the CPU frequency |
Date: |
Sat, 10 Oct 2020 22:43:08 +0200 |
The CP0 timer period is a function of the CPU frequency.
Start using the default values, which will be replaced by
properties in the next commits.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
target/mips/cpu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
index 84b727fefa8..46188139b7b 100644
--- a/target/mips/cpu.c
+++ b/target/mips/cpu.c
@@ -144,13 +144,13 @@ static void mips_cpu_disas_set_info(CPUState *s,
disassemble_info *info)
*/
#define CPU_FREQ_HZ_DEFAULT 200000000
#define CP0_COUNT_RATE_DEFAULT 2
-#define TIMER_PERIOD_DEFAULT 10 /* 1 / (CPU_FREQ_HZ / CP0_COUNT_RATE) */
static void mips_cp0_period_set(MIPSCPU *cpu)
{
CPUMIPSState *env = &cpu->env;
- env->cp0_count_ns = TIMER_PERIOD_DEFAULT;
+ env->cp0_count_ns = muldiv64(NANOSECONDS_PER_SECOND,
CP0_COUNT_RATE_DEFAULT,
+ CPU_FREQ_HZ_DEFAULT);
}
static void mips_cpu_realizefn(DeviceState *dev, Error **errp)
--
2.26.2
- [PATCH v3 01/20] util/cutils: Introduce freq_to_str() to display Hertz units, (continued)
- [PATCH v3 01/20] util/cutils: Introduce freq_to_str() to display Hertz units, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v3 02/20] qdev-monitor: Display frequencies scaled to SI unit, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v3 03/20] hw/qdev-clock: Display error hint when clock is missing from device, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v3 04/20] hw/core/clock: add the clock_new helper function, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v3 06/20] target/mips/cp0_timer: Explicit unit in variable name, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v3 08/20] target/mips: Move cp0_count_ns to CPUMIPSState, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v3 05/20] target/mips: Move cpu_mips_get_random() with CP0 helpers, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v3 07/20] target/mips/cp0_timer: Document TIMER_PERIOD origin, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v3 09/20] target/mips/cpu: Calculate the CP0 timer period using the CPU frequency,
Philippe Mathieu-Daudé <=
- [PATCH v3 10/20] target/mips/cpu: Make cp0_count_rate a property, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v3 11/20] target/mips/cpu: Allow the CPU to use dynamic frequencies, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v3 12/20] hw/mips/r4k: Explicit CPU frequency is 200 MHz, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v3 14/20] hw/mips/mipssim: Correct CPU frequency, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v3 18/20] hw/mips/malta: Set CPU frequency to 320 MHz, Philippe Mathieu-Daudé, 2020/10/10
- [PATCH v3 20/20] target/mips/cpu: Display warning when CPU is used without input clock, Philippe Mathieu-Daudé, 2020/10/10