]> asedeno.scripts.mit.edu Git - linux.git/commit
arm/arm64: KVM: Load the timer state when enabling the timer
authorChristoffer Dall <christoffer.dall@linaro.org>
Sun, 29 Oct 2017 01:04:55 +0000 (02:04 +0100)
committerChristoffer Dall <christoffer.dall@linaro.org>
Mon, 6 Nov 2017 15:23:17 +0000 (16:23 +0100)
commit4a2c4da1250d09c1477eff8e14a82b2573481f32
treeeb03cce431fca32a6726e8883d201a5917ad2e96
parent1c88ab7ec8c53c4d806bb2b6871ddafdebbffa8b
arm/arm64: KVM: Load the timer state when enabling the timer

After being lazy with saving/restoring the timer state, we defer that
work to vcpu_load and vcpu_put, which ensure that the timer state is
loaded on the hardware timers whenever the VCPU runs.

Unfortunately, we are failing to do that the first time vcpu_load()
runs, because the timer has not yet been enabled at that time.  As long
as the initialized timer state matches what happens to be in the
hardware (a disabled timer, because we never leave the timer screaming),
this does not show up as a problem, but is nevertheless incorrect.

The solution is simple; disable preemption while setting the timer to be
enabled, and call the timer load function when first enabling the timer.

Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
virt/kvm/arm/arch_timer.c