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 <cd...@linaro.org>
---
 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

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

Reply via email to