arm_hyp: Save and restore vtimer state on switches

Added support for reading and writing additional virtual timer
registers for vcpu hw read and write accesses. These include the
compare value register (CNTV_CVAL) and offset register (CNTV_OFF),
each represented as two 32 bit (high and low) registers on aarch32 and
as single 64 bit registers on aarch64.

Added support for explicitly saving and restoring the virtual
timer registers when the vcpu is enabled and disabled. This
ensures when the vcpu is switched in and out, the virtual timer
registers are restored to a state that is consistent to when
it was last run.

By default the CNTVOFF register will be updated by the kernel to
accumulate the time the VCPU is not running. From the guest this will
result in the VCNT register not increasing when the VCPU is suspended.
This behavior can be turned off by disabling the
KernelArmVtimerUpdateVOffset config option.
This commit is contained in:
Alison Felizzi
2019-06-20 18:54:21 +10:00
committed by Kent Mcleod
parent f795e7c0ec
commit 71d636f8b3
12 changed files with 290 additions and 31 deletions

View File

@@ -135,6 +135,7 @@ devices:
sel_macro: CONFIG_ARM_HYPERVISOR_SUPPORT
index: 3
undef_index: 2
INTERRUPT_VTIMER_EVENT: 2
# Allwinner A10 Timer (timer/allwinner,sun4i-timer.txt)
- compatible:
- allwinner,sun4i-a10-timer