qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
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 3/7] target-arm: Add arm_ccnt_enabled function
Date: Mon, 18 Aug 2014 13:48:42 +1000	[thread overview]
Message-ID: <CAEgOgz43He7AztgmdjiGh_wry=QvjL-MY2cZCVGO8aSYR58J2g@mail.gmail.com> (raw)
In-Reply-To: <CAEgOgz7+ifve3bvu3q1qYTPRP5TEkRVH7pUEYROUe7-d=U94EQ@mail.gmail.com>

On Thu, Jun 26, 2014 at 9:28 PM, Peter Crosthwaite
<peter.crosthwaite@xilinx.com> wrote:
> On Thu, Jun 26, 2014 at 3:02 PM, Alistair Francis
> <alistair.francis@xilinx.com> wrote:
>> Include a helper function to determine if the CCNT counter
>> is enabled as well as the constants used to mask the pmccfiltr_el0
>> and c9_pmxevtyper registers.
>>
>> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
>> ---
>>
>>  target-arm/helper.c |   40 ++++++++++++++++++++++++++++++++++++++++
>>  1 files changed, 40 insertions(+), 0 deletions(-)
>>
>> diff --git a/target-arm/helper.c b/target-arm/helper.c
>> index ce986ee..141e252 100644
>> --- a/target-arm/helper.c
>> +++ b/target-arm/helper.c
>> @@ -547,6 +547,46 @@ static CPAccessResult pmreg_access(CPUARMState *env, const ARMCPRegInfo *ri)
>>  }
>>
>>  #ifndef CONFIG_USER_ONLY
>
> Blank line here for readability.
>
>> +#define PMCCFILTR_NSH 0x8000000
>> +#define PMCCFILTR_P 0x80000000
>> +#define PMCCFILTR_U 0x40000000
>> +
>> +#define PMXEVTYPER_P 0x80000000
>> +#define PMXEVTYPER_U 0x40000000
>> +
>> +static bool arm_ccnt_enabled(CPUARMState *env)
>> +{
>> +    /* This does not support checking for the secure/non-secure
>> +     * components of the PMCCFILTR_EL0 register
>> +     */
>> +
>> +    if (!(env->cp15.c9_pmcr & PMCRE)) {
>> +        return 0;
>> +    }
>> +
>> +    if (arm_current_pl(env) == 2) {
>
> switch(arm_current_pl(env))
>
>> +        if (!(env->cp15.pmccfiltr_el0 & PMCCFILTR_NSH)) {
>> +            return 0;
>
> Use "true" and "false" for boolean function return values.
>
>> +        }
>> +    } else if (arm_current_pl(env) == 1) {
>> +        if (env->cp15.pmccfiltr_el0 & PMCCFILTR_P) {
>> +            return 0;
>> +        } else if (env->cp15.c9_pmxevtyper & PMXEVTYPER_P) {
>
> use an || to merge the two if branches with same function body.
>
>> +            return 0;
>> +        }
>> +    } else if (arm_current_pl(env) == 0) {
>> +        if (env->cp15.pmccfiltr_el0 & PMCCFILTR_U) {
>> +            return 0;
>> +        } else if (env->cp15.c9_pmxevtyper & PMXEVTYPER_U) {
>> +            return 0;
>> +        }
>> +    }
>> +
>> +    return 1;
>> +}
>> +#endif
>> +
>> +#ifndef CONFIG_USER_ONLY
>
> Just drop the extra #endif #ifndef CONFIG_USER_ONLY.
>

All fixed (in a respun version I got from Alistair).

Regards,
Peter

> Regards,
> Peter
>
>>  static void pmcr_write(CPUARMState *env, const ARMCPRegInfo *ri,
>>                         uint64_t value)
>>  {
>> --
>> 1.7.1
>>
>>

  reply	other threads:[~2014-08-18  3:48 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 [this message]
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
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='CAEgOgz43He7AztgmdjiGh_wry=QvjL-MY2cZCVGO8aSYR58J2g@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).