Skip to content
Commit 8fa76162 authored by Wei Huang's avatar Wei Huang Committed by Marc Zyngier
Browse files

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 84135d3d ("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: 84135d3d ("KVM: arm/arm64: consolidate arch timer trap handlers")
Signed-off-by: default avatarWei Huang <wei@redhat.com>
[maz: commit message tidy-up]
Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
parent 8324c3d5
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment