aboutsummaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorAndrew Jeffery <andrew@aj.id.au>2019-12-20 14:02:59 +0000
committerPeter Maydell <peter.maydell@linaro.org>2019-12-20 14:02:59 +0000
commit4a0245b62502ee9ca7774712de4bb05d9bf47152 (patch)
tree53589146972e5fd65d7cc7bad9e88521c5ef75be /target
parent8e5943260a8f765216674ee87ce8588cc4e7463e (diff)
target/arm: Remove redundant scaling of nexttick
The corner-case codepath was adjusting nexttick such that overflow wouldn't occur when timer_mod() scaled the value back up. Remove a use of GTIMER_SCALE and avoid unnecessary operations by calling timer_mod_ns() directly. Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Cédric Le Goater <clg@kaod.org> Message-id: f8c680720e3abe55476e6d9cb604ad27fdbeb2e0.1576215453.git-series.andrew@aj.id.au Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target')
-rw-r--r--target/arm/helper.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 5074b5f69c..31fab098c5 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -2486,9 +2486,10 @@ static void gt_recalc_timer(ARMCPU *cpu, int timeridx)
* timer expires we will reset the timer for any remaining period.
*/
if (nexttick > INT64_MAX / GTIMER_SCALE) {
- nexttick = INT64_MAX / GTIMER_SCALE;
+ timer_mod_ns(cpu->gt_timer[timeridx], INT64_MAX);
+ } else {
+ timer_mod(cpu->gt_timer[timeridx], nexttick);
}
- timer_mod(cpu->gt_timer[timeridx], nexttick);
trace_arm_gt_recalc(timeridx, irqstate, nexttick);
} else {
/* Timer disabled: ISTATUS and timer output always clear */