1 .. SPDX-License-Identifier: GPL-2.0 2 3 Clocks and Timers 4 ================= 5 6 arm64 7 ----- 8 On arm64, Hyper-V virtualizes the ARMv8 archit 9 and timer. Guest VMs use this virtualized hard 10 clocksource and clockevents via the standard a 11 driver, just as they would on bare metal. Linu 12 architectural system counter is functional in 13 While Hyper-V also provides a synthetic system 14 per-CPU timers as described in the TLFS, they 15 Linux kernel in a Hyper-V guest on arm64. How 16 of Hyper-V for arm64 only partially virtualize 17 architectural timer, such that the timer does 18 interrupts in the VM. Because of this limitati 19 Linux kernel versions on these older Hyper-V v 20 out-of-tree patch to use the Hyper-V synthetic 21 22 x86/x64 23 ------- 24 On x86/x64, Hyper-V provides guest VMs with a 25 and four synthetic per-CPU timers as described 26 also provides access to the virtualized TSC vi 27 related instructions. These TSC instructions d 28 the hypervisor and so provide excellent perfor 29 Hyper-V performs TSC calibration, and provides 30 to the guest VM via a synthetic MSR. Hyper-V 31 in Linux reads this MSR to get the frequency, 32 calibration and sets tsc_reliable. Hyper-V pro 33 versions of the PIT (in Hyper-V Generation 1 34 APIC timer, and RTC. Hyper-V does not provide 35 guest VMs. 36 37 The Hyper-V synthetic system clock can be read 38 but this access traps to the hypervisor. As a 39 the guest can configure a memory page to be sh 40 and the hypervisor. Hyper-V populates this me 41 64-bit scale value and offset value. To read t 42 value, the guest reads the TSC and then applie 43 as described in the Hyper-V TLFS. The resultin 44 at a constant 10 MHz frequency. In the case of 45 to a host with a different TSC frequency, Hype 46 scale and offset values in the shared page so 47 frequency is maintained. 48 49 Starting with Windows Server 2022 Hyper-V, Hyp 50 support for TSC frequency scaling to enable li 51 across Hyper-V hosts where the TSC frequency m 52 When a Linux guest detects that this Hyper-V f 53 available, it prefers to use Linux's standard 54 Otherwise, it uses the clocksource for the Hyp 55 clock implemented via the shared page (identif 56 "hyperv_clocksource_tsc_page"). 57 58 The Hyper-V synthetic system clock is availabl 59 vDSO, and gettimeofday() and related system ca 60 entirely in user space. The vDSO is implement 61 shared page with scale and offset values into 62 space code performs the same algorithm of read 63 applying the scale and offset to get the const 64 65 Linux clockevents are based on Hyper-V synthet 66 While Hyper-V offers 4 synthetic timers for ea 67 timer 0. In older versions of Hyper-V, an inte 68 results in a VMBus control message that is dem 69 vmbus_isr() as described in the Documentation/ 70 documentation. In newer versions of Hyper-V, s 71 be mapped to an architectural interrupt, which 72 "Direct Mode". Linux prefers to use Direct Mod 73 x86/x64 doesn't support per-CPU interrupts, Di 74 allocates an x86 interrupt vector (HYPERV_STIM 75 and explicitly codes it to call the stimer0 in 76 interrupts from stimer0 are recorded on the "H 77 rather than being associated with a Linux IRQ. 78 virtualized PIT and local APIC timer also work 79 is preferred. 80 81 The driver for the Hyper-V synthetic system cl 82 drivers/clocksource/hyperv_timer.c.
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.