From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoffer Dall Subject: [PATCH kvm-unit-tests 2/3] arm64: timer: Fix test on APM X-Gene Date: Thu, 13 Jul 2017 21:20:08 +0200 Message-ID: <20170713192009.10069-3-cdall@linaro.org> References: <20170713192009.10069-1-cdall@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Christoffer Dall , Marc Zyngier , Paolo Bonzini To: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu Return-path: In-Reply-To: <20170713192009.10069-1-cdall@linaro.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu List-Id: kvm.vger.kernel.org When running the vtimer test on an APM X-Gene, setting the timer value to (2^64 - 1) apparently results in the timer always firing, even thought the counter is mich lower than the cval. Since the idea of the code is to set everything up and schedule the timer for some time very far in the future, take a pragmatic approach and just add 10s worth of delay instead. Signed-off-by: Christoffer Dall --- arm/timer.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arm/timer.c b/arm/timer.c index 02d9e0a..77d257c 100644 --- a/arm/timer.c +++ b/arm/timer.c @@ -70,10 +70,14 @@ static bool test_cval_10msec(void) static void test_vtimer(void) { + u64 now = read_sysreg(cntvct_el0); + u64 time_10s = read_sysreg(cntfrq_el0) * 10; + u64 later = now + time_10s; + report_prefix_push("vtimer-busy-loop"); - /* Enable the timer */ - write_sysreg(~0, cntv_cval_el0); + /* Enable the timer, but schedule it for much later*/ + write_sysreg(later, cntv_cval_el0); isb(); write_sysreg(CNTV_CTL_ENABLE, cntv_ctl_el0); -- 2.9.0