From patchwork Tue Mar 25 16:55:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 27065 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f198.google.com (mail-pd0-f198.google.com [209.85.192.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 661D120539 for ; Tue, 25 Mar 2014 16:58:11 +0000 (UTC) Received: by mail-pd0-f198.google.com with SMTP id fp1sf1684577pdb.5 for ; Tue, 25 Mar 2014 09:58:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :list-archive:content-type:content-transfer-encoding; bh=zLxAJ+ITvo560QEhIdoonRGX4vGoKxHIemCNF90nNTw=; b=MnJbmwwMFWeFn6mC9QZcT/kgw9sTDgcWWN1YduTbd5oorAZB7+5el3mmdappLleHhS xx7/i48CAqAZgJEqXkBDhIzMC0X4FnRXBehuuEIuxpmgw8/vXykHCs5JdOiFApvmSSpI QRtNT3mekEHxImuKFixvEpV7Ijp3pMFCyLIPGhOAee5RMO0QVZhDynUnhG12oHrBVvxq /ZRxx9YTWOiDpDPAnpRk9Wrp/aYLWpe+rl4KMLqJ6E6pWU6/rtf2WlHJCJNHlfn0uarI ZwTmaJB8LJGLjGUVRxkCLsQ+VOJUV0dGHuJ04mvSnq+yAhs9/D03NdKwtmar/y8OZLwM I7ow== X-Gm-Message-State: ALoCoQlIPQju8pz1ji5ziqqv/sVeZ7i974RTsSfTWN9BAQQWA/J9AXErgWUVXq3MzxOFQ/2rRP0Q X-Received: by 10.66.150.106 with SMTP id uh10mr28482733pab.13.1395766690612; Tue, 25 Mar 2014 09:58:10 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.105.197 with SMTP id c63ls278080qgf.3.gmail; Tue, 25 Mar 2014 09:58:10 -0700 (PDT) X-Received: by 10.58.57.42 with SMTP id f10mr56567399veq.1.1395766690504; Tue, 25 Mar 2014 09:58:10 -0700 (PDT) Received: from mail-ve0-f175.google.com (mail-ve0-f175.google.com [209.85.128.175]) by mx.google.com with ESMTPS id la9si3867563veb.38.2014.03.25.09.58.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 09:58:10 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.175; Received: by mail-ve0-f175.google.com with SMTP id oz11so872972veb.34 for ; Tue, 25 Mar 2014 09:58:10 -0700 (PDT) X-Received: by 10.52.34.4 with SMTP id v4mr771273vdi.42.1395766690436; Tue, 25 Mar 2014 09:58:10 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp320385vck; Tue, 25 Mar 2014 09:58:10 -0700 (PDT) X-Received: by 10.52.51.226 with SMTP id n2mr417074vdo.57.1395766689070; Tue, 25 Mar 2014 09:58:09 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id cp10si3867394ved.20.2014.03.25.09.58.08 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 25 Mar 2014 09:58:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WSUei-0000pf-NH; Tue, 25 Mar 2014 16:56:52 +0000 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: from [193.109.254.147:23978] by server-3.bemta-14.messagelabs.com id 6D/D1-22179-D45B1335; Tue, 25 Mar 2014 16:56:45 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-7.tower-27.messagelabs.com!1395766604!4083631!1 X-Originating-IP: [74.125.83.45] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.11.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 25650 invoked from network); 25 Mar 2014 16:56:44 -0000 Received: from mail-ee0-f45.google.com (HELO mail-ee0-f45.google.com) (74.125.83.45) by server-7.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 25 Mar 2014 16:56:44 -0000 Received: by mail-ee0-f45.google.com with SMTP id d17so689034eek.4 for ; Tue, 25 Mar 2014 09:56:44 -0700 (PDT) X-Received: by 10.15.31.70 with SMTP id x46mr6541800eeu.26.1395766604339; Tue, 25 Mar 2014 09:56:44 -0700 (PDT) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id h47sm33377501eey.13.2014.03.25.09.56.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Mar 2014 09:56:43 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 25 Mar 2014 16:55:34 +0000 Message-Id: <1395766541-23979-28-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1395766541-23979-1-git-send-email-julien.grall@linaro.org> References: <1395766541-23979-1-git-send-email-julien.grall@linaro.org> Cc: stefano.stabellini@citrix.com, Julien Grall , tim@xen.org, ian.campbell@citrix.com Subject: [Xen-devel] [PATCH 27/34] xen/arm: time: move ticks_to_ns and ns_to_ticks in asm/time.h X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: 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 Acked-by: Ian Campbell --- 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: