[RFC PATCH-for-6.1 v2 0/6] target/mips/cp0_timer: Use new clock_ns_to_ticks()

Philippe Mathieu-Daudé posted 6 patches 2 years, 11 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20210409093623.2402750-1-f4bug@amsat.org
Maintainers: Jiaxun Yang <jiaxun.yang@flygoat.com>, Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>, Aurelien Jarno <aurelien@aurel32.net>, "Philippe Mathieu-Daudé" <f4bug@amsat.org>
target/mips/cpu.h        |  1 -
hw/mips/loongson3_virt.c |  2 +-
target/mips/cp0_timer.c  | 45 ++++++++++++++++++++++++++++++++--------
target/mips/cpu.c        | 15 +++-----------
4 files changed, 40 insertions(+), 23 deletions(-)
[RFC PATCH-for-6.1 v2 0/6] target/mips/cp0_timer: Use new clock_ns_to_ticks()
Posted by Philippe Mathieu-Daudé 2 years, 11 months ago
Since v1:
- Fix clock_has_source()
- Split patch to be more digestible
- Raise loongson3_virt/TCG clock

This series uses the recently introduced clock_ns_to_ticks()
function which "tells me how many times this clock would tick
in this length of time" to simplify the MIPS CP0 R4K timer
logic and remove the restriction to use frequencies >= 1GHz.

Still RFC because we could rethink the MIPS CP0 timer logic
to avoid too frequent divu128 calls (painful on 32-bit hosts).

Also, env_archcpu() could eventually be dropped (by passing
MIPSCPU* instead of CPUMIPSState*).

Still, enough for a first step cleanup.

Regards,

Phil.

Philippe Mathieu-Daudé (6):
  target/mips/cpu: Use clock_has_source() instead of clock_get()
  target/mips/cpu: Update CP0 clock when CPU clock is propagated
  target/mips/cp0_timer: Add ns_to_count() helper
  target/mips/cp0_timer: Add ns_substract_to_count() helper
  target/mips/cp0_timer: Use new clock_ns_to_ticks()
  hw/mips/loongson3_virt: Raise CPU clock to 2 GHz

 target/mips/cpu.h        |  1 -
 hw/mips/loongson3_virt.c |  2 +-
 target/mips/cp0_timer.c  | 45 ++++++++++++++++++++++++++++++++--------
 target/mips/cpu.c        | 15 +++-----------
 4 files changed, 40 insertions(+), 23 deletions(-)

-- 
2.26.3