From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bon0080.outbound.protection.outlook.com [157.56.111.80]) by dpdk.org (Postfix) with ESMTP id 42FDD91F8 for ; Tue, 3 Nov 2015 14:10:16 +0100 (CET) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@caviumnetworks.com; Received: from localhost.caveonetworks.com (111.93.218.67) by BY2PR0701MB1974.namprd07.prod.outlook.com (10.163.155.20) with Microsoft SMTP Server (TLS) id 15.1.312.18; Tue, 3 Nov 2015 13:10:13 +0000 From: Jerin Jacob To: Date: Tue, 3 Nov 2015 18:39:05 +0530 Message-ID: <1446556153-18845-5-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1446556153-18845-4-git-send-email-jerin.jacob@caviumnetworks.com> References: <1446556153-18845-1-git-send-email-jerin.jacob@caviumnetworks.com> <1446556153-18845-2-git-send-email-jerin.jacob@caviumnetworks.com> <1446556153-18845-3-git-send-email-jerin.jacob@caviumnetworks.com> <1446556153-18845-4-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MAXPR01CA0048.INDPRD01.PROD.OUTLOOK.COM (25.164.146.148) To BY2PR0701MB1974.namprd07.prod.outlook.com (25.163.155.20) X-Microsoft-Exchange-Diagnostics: 1; BY2PR0701MB1974; 2:LZHXwlxsToTGC2+yAoj4kwWjf7B+HxUIloIsBGS7iKzOXO7bF/SFPbRoa1AFDT+yalzIRwznoAX5EHQ1BLKhxAm7F2u5qymazM3gTOSoe0fzbGzcoYgKQDTdWwz5AM057SPbjWXYdZU793EnLRbW4DZrlQqe8f39qE6PhPN5DsU=; 3:PZDfBW8k43ZcQJ7kkD3pTAhacvT1CWMnSK1jp8KLo6z6Fvee7BqhnTugYzu971uvtw+74WxxcBrBEDU3mUutmuA+a6rTJsFJc7tBAPRUZFj6azSaliRuwTuOlv4FgNRNNB3A8pQ0EjXvSaRpwLBbiQ==; 25:Cxh0rw4GW+Xyy6E3y76kyhV13U7ENNHYRjgKHsmgbPyTlTDFIgQh6Eo/pA25cbDef8CQKx5HoYqryj0uNkdMxPTU0KGhdxVKZr7veWOVx+axxhVEEIz0Q41H04AFat0CHPYb2sfsPpbJyumsoIsiD+yBKW3EbKzYHct+KfbvecppQa+N9uVR+q2jddragSSvoKDu2Ya1FUNI7FCfj75D1baCs0Clc2IETTpAUrKUx0ZBdhUFza25ndPC7HloS9AmB6TZZRyNMAyMjjf5h++V3g== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0701MB1974; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0701MB1974; 20:1yDw/I10GzdFJth5FAiBdBWGPUc9vITEwo2H3bS6j4elhcBps6Z/K+vTrXXQ6pxcMWtomdDFndFrztWoa8v97KFcerTbUBh6438xXNFURq5AXf2o+Y42KihHYMi/B9NIsCtzNC6Bkj0ODMF7DVV6bLvyg2f9Rlge5+BbBoiGDy3UqxcptXONlbnlhfMOJ5Rbitx2SpLQo69iczy1bi7KeX7RJsmlza+BUZX/QdtGV7+pqGmXQsV6IgSMQo6/IMDypcTluHYMYSvIofgFtPJnMn9/a5PnzeFlwk3vApILdSwPAXqu4W94LzZuW3JR8gFKswcUdLX4+6LvP1wZWXN+aRl6mk7r0uPxGERT+9WSZdA5P9hyy8njyatwxeGi++xc+7iRDJsmhSKgNT2V3LFxas30qPiXLJLr9pmC0eLmWoCumVOH3r8VfKAcvK+Bw9SNdAaplscPnAAzUqq1vC/9ggLs1YoISkoXXPawxAde6aMo4C1iFDNiuddpWAf2p29sGOYNTBBYQ/wfsJhQ+o3nNXmsgohk2t3tP9yuVm8zMae2+9QgLPA5YYc8Tcq1f77XdhjfRc+W6LVyVV9U+sXtEyq+UHr5bKWZwf+jZpJeC04= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(236414709691187); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(520078)(10201501046)(3002001); SRVR:BY2PR0701MB1974; BCL:0; PCL:0; RULEID:; SRVR:BY2PR0701MB1974; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0701MB1974; 4:fEmG0euIs0KMqLGwRC/AspXZIABLI4p1AoiwN8YOIF92GJYdbnr8XiOfmkWadwUhE3c5p0s5xrajghMHeCdI/pevXJ0FmiJmjMPH7qsbMxiCKzLlplvHIcidTYBskndgy1AOIWk7TgqE/NioUsvI+lTYSlrPHd6fzreat1H4NmGJl8EJEJofBuGacQnUeBv/AsaGoVCwTB4sLYznjQ5dNctS56KQM6YDbrWWw1hDbcwR/aXT6l1CNfyKYXmsNuqH/vqKrLxLccpyYQgYJpiX6/i2q39QA7cbCBmEGxg9+prq4iiEz0X6CjUtvDA+EKNOQDDn4nzUFJMXGQpcUtS7XitcCmjcOpJCFbO6vgJ41m6PhXgBqjcU3Xdwq5atjcV3 X-Forefront-PRVS: 0749DC2CE6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6069001)(189002)(199003)(81156007)(5001960100002)(50226001)(50986999)(5004730100002)(2950100001)(110136002)(77096005)(107886002)(66066001)(47776003)(189998001)(5007970100001)(42186005)(19580395003)(86362001)(76506005)(87976001)(69596002)(97736004)(50466002)(101416001)(53416004)(48376002)(106356001)(105586002)(19580405001)(36756003)(5008740100001)(76176999)(40100003)(92566002)(4001430100002)(5009440100003)(93886004)(33646002)(122386002)(5003940100001)(229853001)(2351001)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0701MB1974; H:localhost.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: caviumnetworks.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR0701MB1974; 23:ub97TBp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3vwdoMDNRQ6xFFt2kJLl6jex2Qz2iG66fwXaBbW0Egac0ae230osw?= =?us-ascii?Q?e4B6qhp9NpPwDsfLv32ohvF4YXKVRTg5CJCJqd4omqf+EfYUceS0zBQMfGFb?= =?us-ascii?Q?CBC/JkPYFa1L0FOiA2wQ/Dlv8K8kAA5BtIuajA70A6nru+qb0PxT4eo6LPCw?= =?us-ascii?Q?V8mj1/J0YZDkbI9NUmE4ZVUcNsiJ8Zsi1x8B7PR6cpzKT6efIzL7rgcRLdXU?= =?us-ascii?Q?Kpd5K1FA4b7GOyFG9JtWbSE5MvJtVzMPcUi2jHCZZi15Ag2NMzR6aVnZ7tk8?= =?us-ascii?Q?EHaUZ9skAPl3UwW7D6AELV/Ba7SGyR7rEON6O?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR0701MB1974; 5:9cSltm+hXFIE1JB5Tjurv9VHJ/kMZqeAjGC4xKXjMLRHlcg2AIUMndOHbtJKwK7UwPEA8R8iftZSmtbUrmeg9XU/4MnS3guBpWqG3s4UeOr1ZqsMRp5bsF3YGwoCx3TBIyvNVYUa1PdP8B+J7BHKPA==; 24:fhrf3j9ZjVj2PspdUx+zOGQFKE6WaWAOwUMB0cjWfdv59jhMt/Lo/TVfD7mdt69xWbEFnAb3xGUVKX7k7rbmwdqPczf+1vwWsDz/NgjTVPI=; 20:pZYxQDl15DRxn6OPnqK/A/lrh4bSePdK1ZJhiB+omLab8nvkdHm4dSTTHKqjtkHDkbJRiE1CeCRx4KxN9Ud7Ew== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2015 13:10:13.2988 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0701MB1974 Subject: [dpdk-dev] [PATCH 04/12] eal: arm64: add armv8-a version of rte_cycles_64.h X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2015 13:10:16 -0000 cntcvt_el0 ticks are not based on cpu clk unlike rdtsc in x86. Its a fixed clock running based at constant speed. Though its a armv8-a implementer choice, typically it runs at 50 or 100 MHz Signed-off-by: Jerin Jacob --- .../common/include/arch/arm/rte_cycles.h | 4 ++ .../common/include/arch/arm/rte_cycles_64.h | 71 ++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 lib/librte_eal/common/include/arch/arm/rte_cycles_64.h diff --git a/lib/librte_eal/common/include/arch/arm/rte_cycles.h b/lib/librte_eal/common/include/arch/arm/rte_cycles.h index b2372fa..a8009a0 100644 --- a/lib/librte_eal/common/include/arch/arm/rte_cycles.h +++ b/lib/librte_eal/common/include/arch/arm/rte_cycles.h @@ -33,6 +33,10 @@ #ifndef _RTE_CYCLES_ARM_H_ #define _RTE_CYCLES_ARM_H_ +#ifdef RTE_ARCH_64 +#include +#else #include +#endif #endif /* _RTE_CYCLES_ARM_H_ */ diff --git a/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h b/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h new file mode 100644 index 0000000..14f2612 --- /dev/null +++ b/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h @@ -0,0 +1,71 @@ +/* + * BSD LICENSE + * + * Copyright (C) Cavium networks Ltd. 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 networks 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. +*/ + +#ifndef _RTE_CYCLES_ARM64_H_ +#define _RTE_CYCLES_ARM64_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "generic/rte_cycles.h" + +/** + * Read the time base register. + * + * @return + * The time base for this lcore. + */ +static inline uint64_t +rte_rdtsc(void) +{ + uint64_t tsc; + + asm volatile("mrs %0, cntvct_el0" : "=r" (tsc)); + return tsc; +} + +static inline uint64_t +rte_rdtsc_precise(void) +{ + rte_mb(); + return rte_rdtsc(); +} + +static inline uint64_t +rte_get_tsc_cycles(void) { return rte_rdtsc(); } + +#ifdef __cplusplus +} +#endif + +#endif /* _RTE_CYCLES_ARM64_H_ */ -- 2.1.0