qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 4/7] arm: remove muldiv64()


From: Peter Crosthwaite
Subject: Re: [Qemu-devel] [PATCH 4/7] arm: remove muldiv64()
Date: Tue, 25 Aug 2015 14:11:42 -0700

On Tue, Aug 25, 2015 at 1:44 PM, Laurent Vivier <address@hidden> wrote:
> muldiv64() is used to convert microseconds to nanoseconds.
>
> Use qemu_clock_get_ns() instead of qemu_clock_get_us()
> to avoid this operation.
>
> Signed-off-by: Laurent Vivier <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 1568aa6..f5e8fd8 100644
> --- a/target-arm/helper.c
> +++ b/target-arm/helper.c
> @@ -678,8 +678,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 = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
>
>      if (env->cp15.c9_pmcr & PMCRD) {
>          /* Increment once every 64 processor clock cycles */
> @@ -717,8 +716,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 = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
>

The long term goal here was to replace get_ticks_per_sec with a
parameterizable CPU frequency so ideally the math should remain. The
ARM CPU frequency == get_ticks_per_sec is the bigger issue.

Regards,
Peter

>      if (env->cp15.c9_pmcr & PMCRD) {
>          /* Increment once every 64 processor clock cycles */
> @@ -738,8 +736,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 = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
>
>      if (env->cp15.c9_pmcr & PMCRD) {
>          /* Increment once every 64 processor clock cycles */
> --
> 2.1.0
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]