Message ID | 20210409093623.2402750-7-f4bug@amsat.org |
---|---|
State | New |
Headers | show |
Series | target/mips/cp0_timer: Use new clock_ns_to_ticks() | expand |
Hi, Philippe, On Fri, Apr 9, 2021 at 5:36 PM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote: > > Commit cd3a53b727d ("clock: Add clock_ns_to_ticks() function") > removed the limitation of using clock with a frequency of 1 GHz > or more. > > The previous commit converted the MIPS CP0 timer to use this > new clock_ns_to_ticks() function. We can now use a clock of > 2 GHz with the Loongson3 virt board. Yes, we can do this, but why should we do this? I don't think this can bring any advantages. Huacai > > Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> > --- > hw/mips/loongson3_virt.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c > index b15071defc6..0b72ef8a684 100644 > --- a/hw/mips/loongson3_virt.c > +++ b/hw/mips/loongson3_virt.c > @@ -152,7 +152,7 @@ static const MemoryRegionOps loongson3_pm_ops = { > } > }; > > -#define DEF_LOONGSON3_FREQ (800 * 1000 * 1000) > +#define DEF_LOONGSON3_FREQ (2000 * 1000 * 1000) > > static uint64_t get_cpu_freq_hz(void) > { > -- > 2.26.3 >
Hi Huacai, On 4/10/21 4:43 AM, Huacai Chen wrote: > Hi, Philippe, > > On Fri, Apr 9, 2021 at 5:36 PM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote: >> >> Commit cd3a53b727d ("clock: Add clock_ns_to_ticks() function") >> removed the limitation of using clock with a frequency of 1 GHz >> or more. >> >> The previous commit converted the MIPS CP0 timer to use this >> new clock_ns_to_ticks() function. We can now use a clock of >> 2 GHz with the Loongson3 virt board. > Yes, we can do this, but why should we do this? I don't think this can > bring any advantages. IIRC this was how you sent the earlier series, then we had to reduce the frequency to <1GHz due to the DIV#0 bug. Now it is fixed I thought you'd get this back. I spent time with the R4K timer because it is often used by embedded firmwares, and a mismatch with the CPU clock makes firmware not work well. I suppose when using Linux guests it is not a real issue, because 1/ if there is another timer (different peripheral on a system-on-soc) Linux will use it first, 2/ Linux does some early check to adapt with the tick rate IIRC (it doesn't assume a precise rate). I'm fine with the current Loongson3 virt board behavior with TCG, so let's disregard this patch. Thanks, Phil.
diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c index b15071defc6..0b72ef8a684 100644 --- a/hw/mips/loongson3_virt.c +++ b/hw/mips/loongson3_virt.c @@ -152,7 +152,7 @@ static const MemoryRegionOps loongson3_pm_ops = { } }; -#define DEF_LOONGSON3_FREQ (800 * 1000 * 1000) +#define DEF_LOONGSON3_FREQ (2000 * 1000 * 1000) static uint64_t get_cpu_freq_hz(void) {
Commit cd3a53b727d ("clock: Add clock_ns_to_ticks() function") removed the limitation of using clock with a frequency of 1 GHz or more. The previous commit converted the MIPS CP0 timer to use this new clock_ns_to_ticks() function. We can now use a clock of 2 GHz with the Loongson3 virt board. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> --- hw/mips/loongson3_virt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)