It is quite subtle why we mask the timer on behalf of the guest when then guest has programmed the timer and it fires and is handled on the host.
Add a comment to that effect.
Signed-off-by: Christoffer Dall christoffer.dall@linaro.org --- virt/kvm/arm/arch_timer.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c index c2e1ef4..8168437 100644 --- a/virt/kvm/arm/arch_timer.c +++ b/virt/kvm/arm/arch_timer.c @@ -63,6 +63,12 @@ static void kvm_timer_inject_irq(struct kvm_vcpu *vcpu) { struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu;
+ /* + * Mask the virtual timer, because otherwise, the guest would never + * execute its interrupt handler because the virtual timer interrupt + * would continously preempt guest execution as the hardware interrupt + * traps to Hyp mode. + */ timer->cntv_ctl |= ARCH_TIMER_CTRL_IT_MASK; kvm_vgic_inject_irq(vcpu->kvm, vcpu->vcpu_id, timer->irq->irq,