From: Andrew Jeffery <andrew@aj.id.au>
To: qemu-arm@nongnu.org
Cc: qemu-devel@nongnu.org, peter.maydell@linaro.org, clg@kaod.org,
joel@jms.id.au
Subject: [PATCH 1/4] target/arm: Remove redundant scaling of nexttick
Date: Thu, 28 Nov 2019 16:15:24 +1030 [thread overview]
Message-ID: <20191128054527.25450-2-andrew@aj.id.au> (raw)
In-Reply-To: <20191128054527.25450-1-andrew@aj.id.au>
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>
---
target/arm/helper.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/target/arm/helper.c b/target/arm/helper.c
index a089fb5a6909..65c4441a3896 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -2446,9 +2446,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 */
--
2.20.1
next prev parent reply other threads:[~2019-11-28 5:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-28 5:45 [PATCH 0/4] Expose GT CNTFRQ as a CPU property to support AST2600 Andrew Jeffery
2019-11-28 5:45 ` Andrew Jeffery [this message]
2019-11-28 8:47 ` [PATCH 1/4] target/arm: Remove redundant scaling of nexttick Cédric Le Goater
2019-11-28 5:45 ` [PATCH 2/4] target/arm: Abstract the generic timer frequency Andrew Jeffery
2019-11-28 8:46 ` Cédric Le Goater
2019-11-28 22:29 ` Andrew Jeffery
2019-12-02 18:12 ` Peter Maydell
2019-12-02 23:48 ` Andrew Jeffery
2019-11-28 5:45 ` [PATCH 3/4] target/arm: Prepare generic timer for per-platform CNTFRQ Andrew Jeffery
2019-11-28 5:45 ` [PATCH 4/4] ast2600: Configure CNTFRQ at 1125MHz Andrew Jeffery
2019-11-28 8:47 ` Cédric Le Goater
2019-12-02 18:09 ` [PATCH 0/4] Expose GT CNTFRQ as a CPU property to support AST2600 Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191128054527.25450-2-andrew@aj.id.au \
--to=andrew@aj.id.au \
--cc=clg@kaod.org \
--cc=joel@jms.id.au \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).