From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0085.outbound.protection.outlook.com [104.47.42.85]) by dpdk.org (Postfix) with ESMTP id 9B9A1F92C for ; Thu, 12 Jan 2017 10:19:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=u3BezhZezMwDJDdTWyL6xIqXq0+P/BRuPr+dAdLLE/Q=; b=XrJcEk+SYVSB5KSvkpWIXUMHaxxUPLzOFpSqT3kNvTf7t+BV5UKcfwvyvOGe7lt5Rthcs6gW2sGCutAXrgZZZeGj/i0T7RrOXQKtEtncjuKOvLlPd/c6lyS1ebTgm5VU5MmTncopO4BfmA/hXkqhJ8+5TtRtB2YxK6z5cpScLyQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from localhost.caveonetworks.com (111.93.218.67) by BLUPR0701MB1714.namprd07.prod.outlook.com (10.163.85.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.845.12; Thu, 12 Jan 2017 09:19:18 +0000 From: Jerin Jacob To: CC: , , , , , , Jerin Jacob Date: Thu, 12 Jan 2017 14:47:10 +0530 Message-ID: <1484212646-10338-14-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1484212646-10338-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1482832175-27199-1-git-send-email-jerin.jacob@caviumnetworks.com> <1484212646-10338-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BY2PR06CA0007.namprd06.prod.outlook.com (10.166.106.145) To BLUPR0701MB1714.namprd07.prod.outlook.com (10.163.85.140) X-MS-Office365-Filtering-Correlation-Id: 55e77b07-a6d4-4833-b706-08d43acc1808 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BLUPR0701MB1714; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 3:0l87fCfdzV0yk6mpMMYwPYxiOc9dE86c5UMdS6dPjsmUjFL/JKt1ycoQUz4xapf8oHjrCujWkbgvpdKDG0Dzjq0yMC7a8kyL9h0yPlvzM4WdWDhW6acH91fhmtZWruzDqxhFsxOKZyb64inndiS3xZRWHjE486kd3GrqQhIcbYrzbc/57dltxyDzWJTr7xBld0MHm9xZby/dEPukljogDzC3ouX9uC/KTWQ/kdKqWCIw+7SdLnu7Z+eDecZa2+YmL5eQdsvZ40SmCAoY/wH/EA==; 25:5ny67uXr9uwyVNdlUEdcF/PpD7zk4GBvIrbDCJ5gjEgdLB+8vUToc0Cf7vCFg4DYY5Gph5XUslzDG+JfVSFOObOdz5XAfCrjlT4NDs/E+pqV48mpQ3vt6uGQwtxqvZe6MBR1rzcDLQQMAuH+ser0H8Y7jGLq2/o9ysI51DFvjd3Vhsrc9k/9BalECUMwubsPPz8KaDRgYVbrsB2iNs4zc2etTsSGXwXr75wE08Y6kEhkvv/pqrFT5W0Q2JBOySkyu8/Md9v8y8TlaoMA3SlSPJv3etZ1rMTIoBFqbvEQ59ZQqzR7g4UF2mDf5ITULwhWrnaj56ZyUznbGkUQ516A2q6b7Q7J9sKK9nTT0k83V7DhQCkmS50vceiu0qL+WR++A1NUtrBHeZT7sdl609K+xJ7oVtLPyfQjjzYHYtv7Exw0La8SDmS+DNoI+CwoTlIHYWUQ4n2HNuYEuv3ZSsHFMQ== X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 31:dl43qJO/SNvg1Rvakz6ksEUSlLZrhGanAehddXZn1fVZCAIvffMya94qMd/bLgI86OwikHxEJ0ywwnNhgboYXQ0t20v56fJMxxXnomwqqBhhIE2QPR1+XVjbMlxxLcbyIZQ8frXE/qTENX6wYcu7AQHJGUDXB1jcTiqhVdlzzzr/7ZhJBdjrbUpzTLpnefaGfpGfBHGzLCN3IT7wQtyEHymQJcW6witRGtdcOCmTYorKIVoMljhllhmOeipuqhUM; 20:ryIiT/5lDhbcD+FEcocoIbWGKSq//wMDUY0HiX2t8MMtdR/EZAdzQRNBqQqaLQgYBOG+kBPESK6yqhiHCHrI74j70MZWC/GSeB+DULgvh0ahBFLNF6id42ryZG/o+pODBjW7gc0HRyE+VRhfFzolXrlf9PQbwOnEIuf0koUXfGnw3zAtMxkCBwrY6MU/++o1CfF9v/shl3VrZNZmJ5TAF+nnHsfgPkjGKLqxLdyASpA8PQBM1yltgbf0KRHNHLHhwLPMjh4ip4KD9kJi/aQWc6Zn6I126iTaSz5qZIZtkJQUOl32sNUH08vLEmHCHBf+A9WNqFv9jEOWEO9sA44YiaEDt74Jerkh2VB3I98zymUDarYoZFTiJF3fTNv+AS7CsKHBI+w7CAW6prz+lv+xwCzWXioO90zRK2pcnj6XzMrk0AjlS8OJaTgbrZZFasOhnKTjMCes/8X28iVHp5fSaUtu7i+j6o5/Sz+3WBNuJ3lU1vhPocZYm8ffETcXA6ui891vJWKaWW+VxQ0k4OFVmNcHm/jcEbsdI7oCG2OLhXaPUH4D87QHL8uTxu1lMWmajEughwBvMrURyREZBiAxPwm7c2erA58cssQclAwvfUc= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6041248)(20161123555025)(20161123562025)(20161123560025)(20161123564025)(6072148); SRVR:BLUPR0701MB1714; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1714; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 4:bwB3GG6d0/4ZirHdiW3LHJn3t85U/ZmGjyE86sagn3hnkiD/P48+ABqxY3bPm4NlK2kGO2EZtbWbXqsS3JBIC773FZwCgvU9WxbsDVG1OocZf4lVmt3XLefriWK1dH4DKh/PKVnPpCKfFD7LeiWX+fJVCvMEhTRS4ZrO41bWgKpwZKA+f8s8uk8HAIP0kRpTEZH09CUQEAlhp3I5KsChcqCcKeYyOr3zqz6WDZjw1y5SP5XWqr3LxForpS/L1O3gJUuVg5sHNNThMvkXnsUpGhS9JZWTOarbxm57T+Q6ufrWq4gHkFzGGBSFW4GQ6uaqe9s984ZagtbUEgWbWhAPd2ULYnYYEraG8rEQ7wHEAulszWjGY45Afl2fxSfARL1ENAMDnqtidP1QcNXI1U0YDJ6dfypS2KCahXEVFL/c7hRcP/H1ssPld55MRTimvMZhWYo/oC6nYjrWOVcQ8imdWIbKOwWyQ97+MPTgyUcBULEqEMMaV0l3wpIGNTdla4ZIm3ZDpVtrhPnQ6R/axwtPT0hFh552xQJWkHn2wzgXPCbIpORg+YfQX3Bzo7HK9ELOu9oQZV1qPqr8qyz0qBImPQ== X-Forefront-PRVS: 018577E36E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(39450400003)(189002)(199003)(2950100002)(53416004)(76506005)(92566002)(105586002)(69596002)(2351001)(42186005)(68736007)(106356001)(42882006)(6916009)(305945005)(2906002)(7736002)(50466002)(48376002)(36756003)(5660300001)(110136003)(4326007)(97736004)(107886002)(189998001)(50226002)(6666003)(6506006)(38730400001)(101416001)(54906002)(33646002)(5009440100003)(4001430100002)(6486002)(66066001)(5003940100001)(6116002)(3846002)(47776003)(25786008)(81166006)(6512007)(81156014)(76176999)(50986999)(8676002)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1714; H:localhost.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1714; 23:erhJJhuBmUOj6Q6z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ZkOkUi33jsgudTDxNigzXp21N6/4XT4xZfdC2vCLZ0Mh4atziaJ5iLHFwYQHtf57Z7/LCZKRtoQUJialwHLdZ+bDjirPvSRX5HGco5PA==; 24:Qwzt+OaRk+lnDLHm0K1pLd1TNVAyDL5XZn3nLVdWfAGwqB84jCn6kfca7+F7I2GT6gbs3YKUCA8QIlwTPGurjwsnXsJn6PnMIuCbJqWQR8I= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 7:7uMv4XxJ7QX2sy/X0m4rMX+zaaeiDTOvvkdG7UP888FcPEUuKP9Z11bf+/KAUU0mpnXQRYi32A6x7EF8g+XzoqpmUJqlkLPVeZ+KnujCtSS60YTR8xLF0JFQJJgB/pFNkP/qYrRGTYSw/190rfZCBWb/q0tVvAgFf+ZnI384J2iza/aEFh6LOS7EC182y5WIysH9ZzUivSEsFjklBrGG/JLCYYP858LGrNo5KaAwwfrthKF3TaiABHEjNIFIV1nh2Swa9cNpNmVAjCi3Wia3gFwCrQvtUM1+QbXXMcGi6rV4ibl+JwDEKYGCz/e2YejS8ba6iekQQPRIS9eq7Y7YfpSiYkYHnhpG6gP/Ls2n6qQ5PqtRTMDbs/xxfsczpSrJPIGAkFzTx9C9Kh+YJtIiXx1MZBricHKFlBRvYi6aqNdYUaHwIX88CAeiIlhsdP2uMRPj44qJJ8GPpMV88+Ne1Q== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2017 09:19:18.0900 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1714 Subject: [dpdk-dev] [PATCH v3 13/29] eal/arm64: override I/O device read/write access for arm64 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: Thu, 12 Jan 2017 09:19:24 -0000 Override the generic I/O device memory read/write access and implement it using armv8 instructions for arm64. Signed-off-by: Jerin Jacob --- lib/librte_eal/common/include/arch/arm/rte_io.h | 4 + lib/librte_eal/common/include/arch/arm/rte_io_64.h | 159 +++++++++++++++++++++ 2 files changed, 163 insertions(+) create mode 100644 lib/librte_eal/common/include/arch/arm/rte_io_64.h diff --git a/lib/librte_eal/common/include/arch/arm/rte_io.h b/lib/librte_eal/common/include/arch/arm/rte_io.h index 74c1f2c..9593b42 100644 --- a/lib/librte_eal/common/include/arch/arm/rte_io.h +++ b/lib/librte_eal/common/include/arch/arm/rte_io.h @@ -38,7 +38,11 @@ extern "C" { #endif +#ifdef RTE_ARCH_64 +#include "rte_io_64.h" +#else #include "generic/rte_io.h" +#endif #ifdef __cplusplus } diff --git a/lib/librte_eal/common/include/arch/arm/rte_io_64.h b/lib/librte_eal/common/include/arch/arm/rte_io_64.h new file mode 100644 index 0000000..7759595 --- /dev/null +++ b/lib/librte_eal/common/include/arch/arm/rte_io_64.h @@ -0,0 +1,159 @@ +/* + * BSD LICENSE + * + * Copyright (C) Cavium networks Ltd. 2016. + * + * 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_IO_ARM64_H_ +#define _RTE_IO_ARM64_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define RTE_OVERRIDE_IO_H + +#include "generic/rte_io.h" +#include "rte_atomic_64.h" + +static inline __attribute__((always_inline)) uint8_t +rte_read8_relaxed(const volatile void *addr) +{ + uint8_t val; + + asm volatile( + "ldrb %w[val], [%x[addr]]" + : [val] "=r" (val) + : [addr] "r" (addr)); + return val; +} + +static inline __attribute__((always_inline)) uint16_t +rte_read16_relaxed(const volatile void *addr) +{ + uint16_t val; + + asm volatile( + "ldrh %w[val], [%x[addr]]" + : [val] "=r" (val) + : [addr] "r" (addr)); + return val; +} + +static inline __attribute__((always_inline)) uint32_t +rte_read32_relaxed(const volatile void *addr) +{ + uint32_t val; + + asm volatile( + "ldr %w[val], [%x[addr]]" + : [val] "=r" (val) + : [addr] "r" (addr)); + return val; +} + +static inline __attribute__((always_inline)) uint64_t +rte_read64_relaxed(const volatile void *addr) +{ + uint64_t val; + + asm volatile( + "ldr %x[val], [%x[addr]]" + : [val] "=r" (val) + : [addr] "r" (addr)); + return val; +} + +static inline __attribute__((always_inline)) void +rte_write8_relaxed(uint8_t val, volatile void *addr) +{ + asm volatile( + "strb %w[val], [%x[addr]]" + : + : [val] "r" (val), [addr] "r" (addr)); +} + +static inline __attribute__((always_inline)) void +rte_write16_relaxed(uint16_t val, volatile void *addr) +{ + asm volatile( + "strh %w[val], [%x[addr]]" + : + : [val] "r" (val), [addr] "r" (addr)); +} + +static inline __attribute__((always_inline)) void +rte_write32_relaxed(uint32_t val, volatile void *addr) +{ + asm volatile( + "str %w[val], [%x[addr]]" + : + : [val] "r" (val), [addr] "r" (addr)); +} + +static inline __attribute__((always_inline)) void +rte_write64_relaxed(uint64_t val, volatile void *addr) +{ + asm volatile( + "str %x[val], [%x[addr]]" + : + : [val] "r" (val), [addr] "r" (addr)); +} + +#define rte_read8(addr) \ + ({ uint8_t __v = rte_read8_relaxed(addr); rte_io_rmb(); __v; }) + +#define rte_read16(addr) \ + ({ uint16_t __v = rte_read16_relaxed(addr); rte_io_rmb(); __v; }) + +#define rte_read32(addr) \ + ({ uint32_t __v = rte_read32_relaxed(addr); rte_io_rmb(); __v; }) + +#define rte_read64(addr) \ + ({ uint64_t __v = rte_read64_relaxed(addr); rte_io_rmb(); __v; }) + +#define rte_write8(value, addr) \ + ({ rte_io_wmb(); rte_write8_relaxed(value, addr); }) + +#define rte_write16(value, addr) \ + ({ rte_io_wmb(); rte_write16_relaxed(value, addr); }) + +#define rte_write32(value, addr) \ + ({ rte_io_wmb(); rte_write32_relaxed(value, addr); }) + +#define rte_write64(value, addr) \ + ({ rte_io_wmb(); rte_write64_relaxed(value, addr); }) + +#ifdef __cplusplus +} +#endif + +#endif /* _RTE_IO_ARM64_H_ */ -- 2.5.5