[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] target-arm: Use common CPU cycle infrastructure
From: |
Alistair Francis |
Subject: |
Re: [Qemu-devel] [PATCH] target-arm: Use common CPU cycle infrastructure |
Date: |
Mon, 28 Sep 2015 15:05:47 -0700 |
On Thu, Sep 24, 2015 at 12:43 PM, Christopher Covington
<address@hidden> wrote:
> cpu_get_ticks() provides a common interface across targets for
> calculating CPU cycles. Using this fixes PMCCNTR reads when -icount
> is specified (previously a non-increasing value was returned).
>
> Signed-off-by: Christopher Covington <address@hidden>
> ---
> target-arm/helper.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/target-arm/helper.c b/target-arm/helper.c
> index 7dc49cb..32923fb 100644
> --- a/target-arm/helper.c
> +++ b/target-arm/helper.c
> @@ -729,8 +729,7 @@ void pmccntr_sync(CPUARMState *env)
> {
> uint64_t temp_ticks;
>
> - temp_ticks = muldiv64(qemu_clock_get_us(QEMU_CLOCK_VIRTUAL),
> - get_ticks_per_sec(), 1000000);
> + temp_ticks = cpu_get_ticks();
This patch doesn't apply anymore, you will need to rebase it.
Also I don't think this is correct. cpu_get_ticks() returns the host
CPU cycle counter, when in this case we want the guest cycles.
Thanks,
Alistair
>
> if (env->cp15.c9_pmcr & PMCRD) {
> /* Increment once every 64 processor clock cycles */
> @@ -768,8 +767,7 @@ static uint64_t pmccntr_read(CPUARMState *env, const
> ARMCPRegInfo *ri)
> return env->cp15.c15_ccnt;
> }
>
> - total_ticks = muldiv64(qemu_clock_get_us(QEMU_CLOCK_VIRTUAL),
> - get_ticks_per_sec(), 1000000);
> + total_ticks = cpu_get_ticks();
>
> if (env->cp15.c9_pmcr & PMCRD) {
> /* Increment once every 64 processor clock cycles */
> @@ -789,8 +787,7 @@ static void pmccntr_write(CPUARMState *env, const
> ARMCPRegInfo *ri,
> return;
> }
>
> - total_ticks = muldiv64(qemu_clock_get_us(QEMU_CLOCK_VIRTUAL),
> - get_ticks_per_sec(), 1000000);
> + total_ticks = cpu_get_ticks();
>
> if (env->cp15.c9_pmcr & PMCRD) {
> /* Increment once every 64 processor clock cycles */
> --
> Qualcomm Innovation Center, Inc.
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>
>