]> asedeno.scripts.mit.edu Git - linux.git/commit
KVM: arm/arm64: Rework kvm_timer_should_fire
authorChristoffer Dall <cdall@linaro.org>
Fri, 6 Jan 2017 15:07:48 +0000 (16:07 +0100)
committerChristoffer Dall <christoffer.dall@linaro.org>
Mon, 6 Nov 2017 15:23:17 +0000 (16:23 +0100)
commit1c88ab7ec8c53c4d806bb2b6871ddafdebbffa8b
tree2445aeec45a54b2d5a945c6b589563e0a59f039a
parent7e90c8e5704cbb299d48e7debb1e61614cb12f41
KVM: arm/arm64: Rework kvm_timer_should_fire

kvm_timer_should_fire() can be called in two different situations from
the kvm_vcpu_block().

The first case is before calling kvm_timer_schedule(), used for wait
polling, and in this case the VCPU thread is running and the timer state
is loaded onto the hardware so all we have to do is check if the virtual
interrupt lines are asserted, becasue the timer interrupt handler
functions will raise those lines as appropriate.

The second case is inside the wait loop of kvm_vcpu_block(), where we
have already called kvm_timer_schedule() and therefore the hardware will
be disabled and the software view of the timer state is up to date
(timer->loaded is false), and so we can simply check if the timer should
fire by looking at the software state.

Signed-off-by: Christoffer Dall <cdall@linaro.org>
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
include/kvm/arm_arch_timer.h
virt/kvm/arm/arch_timer.c
virt/kvm/arm/arm.c