From: Marc Zyngier Subject: Re: [PATCH 1/1] KVM: arm/arm64: arch_timer: Fix TimerValue TVAL calculation in KVM Date: Sat, 30 Mar 2019 09:56:14 +0000 Message-ID: <86wokg65z5.wl-marc.zyngier@arm.com> References: <20190329201253.29164-1-wei@redhat.com> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Return-path: In-Reply-To: <20190329201253.29164-1-wei@redhat.com> Sender: linux-kernel-owner@vger.kernel.org To: Wei Huang Cc: linux-kernel@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, andre.przywara@arm.com, christoffer.dall@arm.com, james.morse@arm.com, julien.thierry@arm.com, suzuki.poulose@arm.com List-Id: kvmarm@lists.cs.columbia.edu On Fri, 29 Mar 2019 20:12:53 +0000, Wei Huang wrote: > > 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 CNT_CVAL when TimerValue is being accessed, > introduced by 'Commit 84135d3d18da ("KVM: arm/arm64: consolidate arch > timer trap handlers")'. According to Arm ARM, the read/write behavior > of accesses to TimeValue 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. > > Signed-off-by: Wei Huang Huh... Nice catch. I guess I only ran this with a VHE host, where this code path is unused. Thanks, M. -- Jazz is not dead, it just smell funny.