Arm_arch_timer wrap around

I am trying to learn about arm_arch_timer for my HiKey960 board.
Currently, my dmesg shows the following when arm_arch_timer registers as sched_clock:

dmesg | grep -i “sched_clock|arm_arch”
[ 0.000000] arm_arch_timer: Architected cp15 timer(s) running at 1.92MHz (phys).
[ 0.000006] sched_clock: 56 bits at 1920kHz, resolution 520ns, wraps every 4398046510977ns

I want to know what each of these fields exactly mean:

  • 56 bits
  • 520ns
  • wrap around 4398046510977ns

FYI: I have tested if the monotonic clock wraps around after 4398046510977ns or 4398s.
I kept the board up for about 17 hours and the monotonic time has not wrapped around.
So, is there code in the kernel to handle the wrap around?

I think these fields are explicit

- 56 bits is the number of bits available to store the timer counter.
- 520ns is the timer resolution (1920Khz).
wrap around 4398046510977ns the counter wraps around to zero every 4398s.

Actually all of this is correctly managed in the kernel which uses xtime and raw_time variables for real and monotonic time keeping. Kernel regularly updates xtime and raw_time based on the time elapsed since the last update (keep the last timer value).
For sure timer can wrap around to zero so the code handling the clock source will have to compensate for this. the clock source struct also contains a ‘mask’ member telling how many bits of the source are valid in order to know when the counter will wrap around.