From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: [PATCH 27/34] xen/arm: time: move ticks_to_ns and ns_to_ticks in asm/time.h Date: Tue, 25 Mar 2014 16:55:34 +0000 Message-ID: <1395766541-23979-28-git-send-email-julien.grall@linaro.org> References: <1395766541-23979-1-git-send-email-julien.grall@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WSUec-0000cF-5B for xen-devel@lists.xenproject.org; Tue, 25 Mar 2014 16:56:46 +0000 Received: by mail-ee0-f45.google.com with SMTP id d17so689034eek.4 for ; Tue, 25 Mar 2014 09:56:44 -0700 (PDT) In-Reply-To: <1395766541-23979-1-git-send-email-julien.grall@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: stefano.stabellini@citrix.com, Julien Grall , tim@xen.org, ian.campbell@citrix.com List-Id: xen-devel@lists.xenproject.org Both ticks_to_ns and ns_to_ticks are wrapper to a division. Move it into asm/time.h to let the compiler inlines them. Signed-off-by: Julien Grall Cc: Ian Campbell Cc: Stefano Stabellini Cc: Tim Deegan --- xen/arch/arm/time.c | 10 ---------- xen/arch/arm/vtimer.c | 3 --- xen/include/asm-arm/time.h | 13 +++++++++++++ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c index 8dd4bea..7f4f2b4 100644 --- a/xen/arch/arm/time.c +++ b/xen/arch/arm/time.c @@ -57,16 +57,6 @@ const struct dt_irq *timer_dt_irq(enum timer_ppi ppi) return &timer_irq[ppi]; } -/*static inline*/ s_time_t ticks_to_ns(uint64_t ticks) -{ - return muldiv64(ticks, SECONDS(1), 1000 * cpu_khz); -} - -/*static inline*/ uint64_t ns_to_ticks(s_time_t ns) -{ - return muldiv64(ns, 1000 * cpu_khz, SECONDS(1)); -} - /* TODO: On a real system the firmware would have set the frequency in the CNTFRQ register. Also we'd need to use devicetree to find the RTC. When we've seen some real systems, we can delete this. diff --git a/xen/arch/arm/vtimer.c b/xen/arch/arm/vtimer.c index 3d6a721..83f4c0f 100644 --- a/xen/arch/arm/vtimer.c +++ b/xen/arch/arm/vtimer.c @@ -26,9 +26,6 @@ #include #include -extern s_time_t ticks_to_ns(uint64_t ticks); -extern uint64_t ns_to_ticks(s_time_t ns); - static void phys_timer_expired(void *data) { struct vtimer *t = data; diff --git a/xen/include/asm-arm/time.h b/xen/include/asm-arm/time.h index d10c737..31dab85 100644 --- a/xen/include/asm-arm/time.h +++ b/xen/include/asm-arm/time.h @@ -5,6 +5,8 @@ DT_MATCH_COMPATIBLE("arm,armv7-timer"), \ DT_MATCH_COMPATIBLE("arm,armv8-timer") +#include + typedef unsigned long cycles_t; static inline cycles_t get_cycles (void) @@ -34,6 +36,17 @@ extern void __cpuinit init_timer_interrupt(void); /* Counter value at boot time */ extern uint64_t boot_count; +/* Helpers to convert ticks <=> ns */ +static inline s_time_t ticks_to_ns(uint64_t ticks) +{ + return muldiv64(ticks, SECONDS(1), 1000 * cpu_khz); +} + +static inline uint64_t ns_to_ticks(s_time_t ns) +{ + return muldiv64(ns, 1000 * cpu_khz, SECONDS(1)); +} + #endif /* __ARM_TIME_H__ */ /* * Local variables: -- 1.7.10.4