KVM: arm/arm64: Use separate timer for phys timer emulation
authorChristoffer Dall <cdall@linaro.org>
Sun, 18 Jun 2017 07:32:08 +0000 (00:32 -0700)
committerChristoffer Dall <christoffer.dall@linaro.org>
Mon, 6 Nov 2017 15:23:12 +0000 (16:23 +0100)
commitf2a2129e0ac8d8fa79c3f85425c36f6e3368f022
tree02b8a911c717be93bc7658b95560fb175047e74c
parentee9bb9a1e3c6e40874c1611ac24b76c87d2cba7b
KVM: arm/arm64: Use separate timer for phys timer emulation

We were using the same hrtimer for emulating the physical timer and for
making sure a blocking VCPU thread would be eventually woken up.  That
worked fine in the previous arch timer design, but as we are about to
actually use the soft timer expire function for the physical timer
emulation, change the logic to use a dedicated hrtimer.

This has the added benefit of not having to cancel any work in the sync
path, which in turn allows us to run the flush and sync with IRQs
disabled.

Note that the hrtimer used to program the host kernel's timer to
generate an exit from the guest when the emulated physical timer fires
never has to inject any work, and to share the soft_timer_cancel()
function with the bg_timer, we change the function to only cancel any
pending work if the pointer to the work struct is not null.

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