On 1/1/21 9:35 PM, Philippe Mathieu-Daudé wrote:
> On 12/15/20 4:09 PM, Peter Maydell wrote:
>> This patchseries makes some changes to the clock API:
>> * Remove clock_get_ns()
>> * Add clock_ticks_to_ns() to return number of nanoseconds
>> it will take the clock to tick N times
>> * clock_display_freq() to return prettily-formatted string
>> for showing humans the approximate clock frequency
>>
>> This is based on discussions we had about these APIs a little while
>> back. The core driver here is that the clock objects internally
>> store the period in units of 2^-32 ns, so both clock_get_ns() and
>> clock_get_hz() are inherently returning a rounded-off result, which
>> can be badly inaccurate for fast clocks or if you want to multiply it
>> by a large tick count.
> ...
>> Peter Maydell (4):
>> clock: Introduce clock_ticks_to_ns()
>> target/mips: Don't use clock_get_ns() in clock period calculation
>> clock: Remove clock_get_ns()
>> clock: Define and use new clock_display_freq()
>>
>> docs/devel/clocks.rst | 51 ++++++++++++++++++++++++++++++++++++----
>> include/hw/clock.h | 53 +++++++++++++++++++++++++++++++++++++++---
>> hw/core/clock.c | 6 +++++
>> softmmu/qdev-monitor.c | 6 ++---
>> target/mips/cpu.c | 4 ++--
>> 5 files changed, 108 insertions(+), 12 deletions(-)
>
> Until someone else prefers otherwise, I plan to queue this series
> via the MIPS tree, as I can add the patch which increases the
> Loongson3v frequency to 2GHz on top (the unique machine using
> a frequency over 1GHz).
Thanks, series applied to mips-next.