From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
To: Alistair Francis <alistair.francis@xilinx.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
Christopher Covington <cov@codeaurora.org>
Subject: Re: [Qemu-devel] [PATCH v2 5/7] target-arm: Remove old code and replace with new functions
Date: Thu, 26 Jun 2014 21:38:00 +1000 [thread overview]
Message-ID: <CAEgOgz77iR+Ny9Ak5YgLEO92ctmmcg0507oFrvC6MM+WcpB+cw@mail.gmail.com> (raw)
In-Reply-To: <a2eb12bf4edf83ef6fbfef75e1766619071dd278.1403757527.git.alistair.francis@xilinx.com>
On Thu, Jun 26, 2014 at 3:02 PM, Alistair Francis
<alistair.francis@xilinx.com> wrote:
> Remove the old PMCCNTR code and replace it with calls to the new
> pmccntr_sync() function and the CCNT_ENABLED macro
arm_ccnt_enabled() function.
>
> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
> ---
>
> target-arm/helper.c | 27 ++++-----------------------
> 1 files changed, 4 insertions(+), 23 deletions(-)
>
> diff --git a/target-arm/helper.c b/target-arm/helper.c
> index 016fe47..0bd00cb 100644
> --- a/target-arm/helper.c
> +++ b/target-arm/helper.c
> @@ -609,20 +609,7 @@ void pmccntr_sync(CPUARMState *env)
> static void pmcr_write(CPUARMState *env, const ARMCPRegInfo *ri,
> uint64_t value)
> {
> - uint64_t temp_ticks;
> -
> - temp_ticks = muldiv64(qemu_clock_get_us(QEMU_CLOCK_VIRTUAL),
> - get_ticks_per_sec(), 1000000);
> -
> - if (env->cp15.c9_pmcr & PMCRE) {
> - /* If the counter is enabled */
> - if (env->cp15.c9_pmcr & PMCRD) {
> - /* Increment once every 64 processor clock cycles */
> - env->cp15.c15_ccnt = (temp_ticks/64) - env->cp15.c15_ccnt;
> - } else {
> - env->cp15.c15_ccnt = temp_ticks - env->cp15.c15_ccnt;
> - }
> - }
> + pmccntr_sync(env);
>
> if (value & PMCRC) {
> /* The counter has been reset */
> @@ -633,20 +620,14 @@ static void pmcr_write(CPUARMState *env, const ARMCPRegInfo *ri,
> env->cp15.c9_pmcr &= ~0x39;
> env->cp15.c9_pmcr |= (value & 0x39);
>
> - if (env->cp15.c9_pmcr & PMCRE) {
> - if (env->cp15.c9_pmcr & PMCRD) {
> - /* Increment once every 64 processor clock cycles */
> - temp_ticks /= 64;
> - }
> - env->cp15.c15_ccnt = temp_ticks - env->cp15.c15_ccnt;
> - }
> + pmccntr_sync(env);
> }
>
> static uint64_t pmccntr_read(CPUARMState *env, const ARMCPRegInfo *ri)
> {
> uint64_t total_ticks;
>
> - if (!(env->cp15.c9_pmcr & PMCRE)) {
> + if (!arm_ccnt_enabled(env)) {
> /* Counter is disabled, do not change value */
> return env->cp15.c15_ccnt;
> }
> @@ -666,7 +647,7 @@ static void pmccntr_write(CPUARMState *env, const ARMCPRegInfo *ri,
> {
> uint64_t total_ticks;
>
> - if (!(env->cp15.c9_pmcr & PMCRE)) {
> + if (!arm_ccnt_enabled(env)) {
Is it valid to write to the running counter?
If so you can sync(), update sync() to implement easily now and drop the if.
Regards,
Peter
> /* Counter is disabled, set the absolute value */
> env->cp15.c15_ccnt = value;
> return;
> --
> 1.7.1
>
>
next prev parent reply other threads:[~2014-06-26 11:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-26 5:01 [Qemu-devel] [PATCH v2 0/7] target-arm: Extend PMCCNTR for ARMv8 Alistair Francis
2014-06-26 5:01 ` [Qemu-devel] [PATCH v2 1/7] target-arm: Make the ARM PMCCNTR register 64-bit Alistair Francis
2014-06-26 5:02 ` [Qemu-devel] [PATCH v2 2/7] target-arm: Implement PMCCNTR_EL0 and related registers Alistair Francis
2014-08-01 15:28 ` Peter Maydell
2014-08-18 3:38 ` Peter Crosthwaite
2014-08-18 7:31 ` Peter Maydell
2014-06-26 5:02 ` [Qemu-devel] [PATCH v2 3/7] target-arm: Add arm_ccnt_enabled function Alistair Francis
2014-06-26 11:28 ` Peter Crosthwaite
2014-08-18 3:48 ` Peter Crosthwaite
2014-06-26 5:02 ` [Qemu-devel] [PATCH v2 4/7] target-arm: Implement pmccntr_sync function Alistair Francis
2014-06-26 5:02 ` [Qemu-devel] [PATCH v2 5/7] target-arm: Remove old code and replace with new functions Alistair Francis
2014-06-26 11:38 ` Peter Crosthwaite [this message]
2014-06-27 0:22 ` Alistair Francis
2014-06-26 5:02 ` [Qemu-devel] [PATCH v2 6/7] target-arm: Implement pmccfiltr_write function Alistair Francis
2014-06-26 5:02 ` [Qemu-devel] [PATCH v2 7/7] target-arm: Call the pmccntr_sync function when swapping ELs Alistair Francis
2014-08-01 15:35 ` Peter Maydell
2014-08-01 23:27 ` Peter Crosthwaite
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=CAEgOgz77iR+Ny9Ak5YgLEO92ctmmcg0507oFrvC6MM+WcpB+cw@mail.gmail.com \
--to=peter.crosthwaite@xilinx.com \
--cc=alistair.francis@xilinx.com \
--cc=cov@codeaurora.org \
--cc=peter.maydell@linaro.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).