[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 20/35] target/mips: Don't use clock_get_ns() in clock period calcu
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 20/35] target/mips: Don't use clock_get_ns() in clock period calculation |
Date: |
Sun, 3 Jan 2021 21:50:06 +0100 |
From: Peter Maydell <peter.maydell@linaro.org>
Currently the MIPS code uses the old clock_get_ns() API to
calculate a time length in nanoseconds:
cpu->cp0_count_rate * clock_get_ns(MIPS_CPU(cpu)->clock)
This relies on the clock having a period which is an exact number
of nanoseconds.
Switch to the new clock_ticks_to_ns() function, which does the
multiplication internally at a higher precision.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Luc Michel <luc@lmichel.fr>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20201215150929.30311-3-peter.maydell@linaro.org>
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 b2cd69ff7f9..2283214c879 100644
--- a/target/mips/cpu.c
+++ b/target/mips/cpu.c
@@ -380,8 +380,8 @@ static void mips_cp0_period_set(MIPSCPU *cpu)
{
CPUMIPSState *env = &cpu->env;
- env->cp0_count_ns = cpu->cp0_count_rate
- * clock_get_ns(MIPS_CPU(cpu)->clock);
+ env->cp0_count_ns = clock_ticks_to_ns(MIPS_CPU(cpu)->clock,
+ cpu->cp0_count_rate);
assert(env->cp0_count_ns);
}
--
2.26.2
- [PULL 10/35] vt82c686: Remove vt82c686b_[am]c97_init() functions, (continued)
- [PULL 10/35] vt82c686: Remove vt82c686b_[am]c97_init() functions, Philippe Mathieu-Daudé, 2021/01/03
- [PULL 11/35] vt82c686: Split off via-[am]c97 into separate file in hw/audio, Philippe Mathieu-Daudé, 2021/01/03
- [PULL 12/35] audio/via-ac97: Simplify code and set user_creatable to false, Philippe Mathieu-Daudé, 2021/01/03
- [PULL 13/35] vt82c686: Remove legacy vt82c686b_isa_init() function, Philippe Mathieu-Daudé, 2021/01/03
- [PULL 14/35] vt82c686: Remove legacy vt82c686b_pm_init() function, Philippe Mathieu-Daudé, 2021/01/03
- [PULL 15/35] vt82c686: Convert debug printf to trace points, Philippe Mathieu-Daudé, 2021/01/03
- [PULL 17/35] vt82c686: Use shorter name for local variable holding object state, Philippe Mathieu-Daudé, 2021/01/03
- [PULL 16/35] vt82c686: Remove unneeded includes and defines, Philippe Mathieu-Daudé, 2021/01/03
- [PULL 18/35] vt82c686: Rename superio config related parts, Philippe Mathieu-Daudé, 2021/01/03
- [PULL 19/35] clock: Introduce clock_ticks_to_ns(), Philippe Mathieu-Daudé, 2021/01/03
- [PULL 20/35] target/mips: Don't use clock_get_ns() in clock period calculation,
Philippe Mathieu-Daudé <=
- [PULL 21/35] clock: Remove clock_get_ns(), Philippe Mathieu-Daudé, 2021/01/03
- [PULL 22/35] clock: Define and use new clock_display_freq(), Philippe Mathieu-Daudé, 2021/01/03
- [PULL 24/35] hw/mips: Implement fw_cfg_arch_key_name(), Philippe Mathieu-Daudé, 2021/01/03
- [PULL 23/35] hw/intc: Rework Loongson LIOINTC, Philippe Mathieu-Daudé, 2021/01/03
- Re: [PULL 23/35] hw/intc: Rework Loongson LIOINTC, Peter Maydell, 2021/01/10
- Re: [PULL 23/35] hw/intc: Rework Loongson LIOINTC, Philippe Mathieu-Daudé, 2021/01/10
- Re: [PULL 23/35] hw/intc: Rework Loongson LIOINTC, BALATON Zoltan, 2021/01/10
- Re: [PULL 23/35] hw/intc: Rework Loongson LIOINTC, Huacai Chen, 2021/01/10
- Re: [PULL 23/35] hw/intc: Rework Loongson LIOINTC, Jiaxun Yang, 2021/01/10
- Re: [PULL 23/35] hw/intc: Rework Loongson LIOINTC, BALATON Zoltan, 2021/01/11