From patchwork Tue Jul 26 02:56:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Brooks X-Patchwork-Id: 72760 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1456153qga; Mon, 25 Jul 2016 20:01:59 -0700 (PDT) X-Received: by 10.55.182.135 with SMTP id g129mr26038257qkf.94.1469502119732; Mon, 25 Jul 2016 20:01:59 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id b194si19726790qkc.44.2016.07.25.20.01.59; Mon, 25 Jul 2016 20:01:59 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 589606805D; Tue, 26 Jul 2016 03:01:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 74FE06855D; Tue, 26 Jul 2016 02:57:46 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 792CF684CD; Tue, 26 Jul 2016 02:57:43 +0000 (UTC) Received: from mail-io0-f171.google.com (mail-io0-f171.google.com [209.85.223.171]) by lists.linaro.org (Postfix) with ESMTPS id B3C33686B7 for ; Tue, 26 Jul 2016 02:56:40 +0000 (UTC) Received: by mail-io0-f171.google.com with SMTP id b62so190394822iod.3 for ; Mon, 25 Jul 2016 19:56:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HmreyOy999RntyXaYHIIx3E/eFq8QhIeAwm/CdtWddc=; b=lMPSei+/9j73Ax3LOmYEs+BQoDDZ+EaFGlb7Mz4wlTniyGghb82jc9mH4w3+oxJo2h vXBGKFe1hMXo3Dswq5CQBy7AV44kBopSPawWd9ZWp5FTfsuGB8aQlJcUxzv3HoH/ESv/ X9g5Wc/09AiuWlc4Q2/3cgx5aM439iUNKRiGLZ9b6UGooNUe3LPejPSK34LCuNlFtGeL HGVb63i+RQ9+esv2F2Kb0n6WgdSiVMfvvjqzRYA8qwDuAIPUSDxmsytia0P+ao5Px+pT VhkVl/6MvsUAL+GXTqbG0fLZS8A2mdz5lEH5RdNsWAnhd7qc/gqInPC7gGLWSBZYV6by PrAg== X-Gm-Message-State: AEkoouuZdstUMrYvh4HkKbq6UFgBCOG9pJDMcfs62/h00NjN9vonrGPPCMbXz0AGr9MVSIF6H/8= X-Received: by 10.202.228.69 with SMTP id b66mr11929319oih.168.1469501800322; Mon, 25 Jul 2016 19:56:40 -0700 (PDT) Received: from localhost.localdomain (68-248-140-212.lightspeed.austtx.sbcglobal.net. [68.248.140.212]) by smtp.gmail.com with ESMTPSA id z189sm12624679oig.29.2016.07.25.19.56.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jul 2016 19:56:39 -0700 (PDT) From: Brian Brooks To: lng-odp@lists.linaro.org Date: Mon, 25 Jul 2016 21:56:21 -0500 Message-Id: <20160726025625.7343-9-brian.brooks@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160726025625.7343-1-brian.brooks@linaro.org> References: <20160726025625.7343-1-brian.brooks@linaro.org> X-Topics: Architecture patch Subject: [lng-odp] [PATCH v3 08/12] arm: odp_cpu_cycles() for aarch64 X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Signed-off-by: Brian Brooks --- platform/linux-generic/arch/arm/odp_cpu_arch.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) -- 2.9.0 diff --git a/platform/linux-generic/arch/arm/odp_cpu_arch.c b/platform/linux-generic/arch/arm/odp_cpu_arch.c index 109dd93..0ae3e0e 100644 --- a/platform/linux-generic/arch/arm/odp_cpu_arch.c +++ b/platform/linux-generic/arch/arm/odp_cpu_arch.c @@ -14,25 +14,12 @@ #include #include -#define GIGA 1000000000 - uint64_t odp_cpu_cycles(void) { - struct timespec time; - uint64_t sec, ns, hz, cycles; - int ret; - - ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time); - - if (ret != 0) - ODP_ABORT("clock_gettime failed\n"); - - hz = odp_cpu_hz_max(); - sec = (uint64_t)time.tv_sec; - ns = (uint64_t)time.tv_nsec; - - cycles = sec * hz; - cycles += (ns * hz) / GIGA; - - return cycles; +#if defined(__aarch64__) + uint64_t vct; + __asm__ volatile("isb" : : : "memory"); + __asm__ volatile("mrs %0, cntvct_el0" : "=r" (vct)); + return vct; +#endif }