• Christoffer Dall's avatar
    KVM: arm/arm64: Rework kvm_timer_should_fire · 1c88ab7e
    Christoffer Dall authored
    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: default avatarChristoffer Dall <cdall@linaro.org>
    Reviewed-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
    1c88ab7e
arch_timer.c 24.9 KB