1.Introduction
The Generic Timer in the Armv8-A can schedule events and trigger interrupts based on an incrementing counter value. It provides:
1.1.The Generic Timer
Provides a system counter, that measures the passing of time in real-time.
Supports virtual counters that measure the passing of virtual-time. That is, a virtual counter can measure the passing of time on a particular virtual machine.
Timers, that can trigger events after a period of time has passed. The timers:
ARM generic timer的硬件block主要是SOC上的System counter(多个process共享,用来记录时间的流逝)以及附着在各个processor上的Timer(用于触发timer event)组成,其他的generic timer的硬件电路主要是用来进行交流generic time event的。例如各个processor中的timer和system counter外设进行交互,各个processor中的timer进行信息交互。System counter的功能很简单,就是计算输入时钟已经过了多少个clock,开始的时候是0,每一个clock,System counter会加一。System counter的counter value需要分发到各个timer中,也就是说,从各个timer的角度看,system counter value应该是一致的。Timer其实就是定时器,它可以定义一段指定的时间,当时间到了,就会assert一个外部的输出信号(可以输出到GIC,作为一个interrupt source)。
从power domain来看,ARM generic timer分成两个部分:System counter和各个Multiprocessor系统中的Timer_x、接口电路等。之所以这么分原因很明显:功耗方面(电源管理)的考量。在power saving mode下,可以shutdown各个processor系统的供电,但是可以保持system counter的供电,这样,至少系统时间可以保持住。
和power domain类似,clock domain也是不同的,system counter和processor工作在不同的clock下,软件修改了CPU的频率也不会影响system counter的工作节奏,从而也不会改变timer的行为。
2. 手册 timer关键点整理
