arm: timer: Fix TVAL comparison for timer condition met
ARM DDI 0487G.a states on page D13-4180 that, when the virtual timer is enabled, the timer condition is met when CNTVCT_EL0 - CNTV_CVAL_EL0 >= 0. Multiplying both sides of the inequality by -1, we get the equivalent condition CNTV_CVAL_EL0 - CNTVCT_EL0 <= 0 for when the timer should fire. On the same page, it states that a read of the CNTV_TVAL_EL0 register returns CNTV_CVAL_EL0 - CNTVCT_EL0 if the virtual timer is enabled. Putting the two together, the timer condition is met when the value of the TVAL register is less than or *equal* to 0. Same rules apply for the physical timer. Fix the check for the timer expiring by treating a TVAL value equal to zero as a valid condition for the timer to fire. Signed-off-by:Alexandru Elisei <alexandru.elisei@arm.com> Message-Id: <20211207154641.87740-2-alexandru.elisei@arm.com> Signed-off-by:
Andrew Jones <drjones@redhat.com>
Loading
Please register or sign in to comment