From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id 25CAA1B395 for ; Fri, 13 Oct 2017 02:02:55 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id D1747219F6; Thu, 12 Oct 2017 20:02:54 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Thu, 12 Oct 2017 20:02:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=xGHIMddGdywOop ffZ7KxjMFDBZisEpI290TQdLdOU3g=; b=Ezhd8QsYqR4aUDBvj6u3Yabt6U2Y+D SWzxDCJZKBaev0RQ2T4f5SEyrLJmy0MAoqSkBpRXftPLVjdJRx+zxg2Yk3eaTBT7 C2JnfRzFpMIMijxB/R49aY/+4OKYXKCYV9sArJGF+WENmDonGGqgXZ7EkPbG4N+L J8/86n3qgDOJQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=xGHIMddGdywOopffZ7KxjMFDBZisEpI290TQdLdOU3g=; b=nkbS92de 2PdOzQUpWTMJWmB9gyWN5NlYTGB9Lb5w++V1es0ad+R+VroQjTAsNvAy+WxniMYv Qz+gYxjFVSCDVbWm7Z8yZTntYk0+kqcNX6hQ3u6CMcOLOSXqQ2OZy5QeI645fp+7 fpUroAJeu5Cbbdn+HkwIN+tZEUqfsiE+rAWxFkPaHh+NpbI8baQ3i3nPsrkanqWi +uGKXT+6CALxnMP+0psJM4Ry3HPPIFTu42Q8PaUW69Plot4+zEoptm7Clw/RSWZU Yo05skIPqOifHPlZeibZqC8pLtI+al8fenl9gZid337VQe0evCAJox01Bok2WlRV 9kW6ej6Oh9fvGA== X-ME-Sender: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id DA1D22489C; Thu, 12 Oct 2017 20:02:53 -0400 (EDT) From: Thomas Monjalon To: gowrishankar.m@linux.vnet.ibm.com, jerin.jacob@caviumnetworks.com, jianbo.liu@linaro.org, sergio.gonzalez.monroy@intel.com, bruce.richardson@intel.com Cc: dev@dpdk.org Date: Fri, 13 Oct 2017 02:02:45 +0200 Message-Id: <20171013000247.4158-3-thomas@monjalon.net> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171013000247.4158-1-thomas@monjalon.net> References: <20171013000247.4158-1-thomas@monjalon.net> Subject: [dpdk-dev] [PATCH 2/4] eal/armv8: implement arch-specific TSC freq query X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Oct 2017 00:02:55 -0000 From: Jerin Jacob Use cntvct_el0 system register to get the system counter frequency. If the system is configured with RTE_ARM_EAL_RDTSC_USE_PMU then return 0(let the common code calibrate the tsc frequency). Signed-off-by: Jerin Jacob Acked-by: Jianbo Liu --- lib/librte_eal/common/arch/arm/rte_cycles.c | 38 +++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/lib/librte_eal/common/arch/arm/rte_cycles.c b/lib/librte_eal/common/arch/arm/rte_cycles.c index 851fd0255..3e31e5be1 100644 --- a/lib/librte_eal/common/arch/arm/rte_cycles.c +++ b/lib/librte_eal/common/arch/arm/rte_cycles.c @@ -1,7 +1,45 @@ +/* + * BSD LICENSE + * + * Copyright (C) Cavium, Inc. 2015. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Cavium, Inc nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + #include "eal_private.h" uint64_t get_tsc_freq_arch(void) { +#if defined RTE_ARCH_ARM64 && !defined RTE_ARM_EAL_RDTSC_USE_PMU + uint64_t freq; + asm volatile("mrs %0, cntfrq_el0" : "=r" (freq)); + return freq; +#else return 0; +#endif } -- 2.14.1