]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: arm/arm64: arch_timer: Fix CNTP_TVAL calculation
authorWei Huang <wei@redhat.com>
Fri, 29 Mar 2019 20:12:53 +0000 (15:12 -0500)
committerMarc Zyngier <marc.zyngier@arm.com>
Sat, 30 Mar 2019 10:06:00 +0000 (10:06 +0000)
commitb013a24eb38a46758eb50b0a1e22f4df28879e7c
tree09aa11fc53786a4e0079683f16752899f4fd875b
parentc5358ef13bdc4ed24216e28fb9154efa18051a89
KVM: arm/arm64: arch_timer: Fix CNTP_TVAL calculation

Recently the generic timer test of kvm-unit-tests failed to complete
(stalled) when a physical timer is being used. This issue is caused
by incorrect update of CNTP_CVAL when CNTP_TVAL is being accessed,
introduced by 'Commit d90d2263d149 ("KVM: arm/arm64: consolidate arch
timer trap handlers")'. According to Arm ARM, the read/write behavior
of accesses to the TVAL registers is expected to be:

  * READ: TimerValue = (CompareValue – (Counter - Offset)
  * WRITE: CompareValue = ((Counter - Offset) + Sign(TimerValue)

This patch fixes the TVAL read/write code path according to the
specification.

Fixes: d90d2263d149 ("KVM: arm/arm64: consolidate arch timer trap handlers")
Signed-off-by: Wei Huang <wei@redhat.com>
[maz: commit message tidy-up]
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
virt/kvm/arm/arch_timer.c