From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0049.outbound.protection.outlook.com [104.47.33.49]) by dpdk.org (Postfix) with ESMTP id BC7AEF93C for ; Tue, 27 Dec 2016 10:51:35 +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=kSd0o8jedDsThZN7jP1PyBxcW91HlsM4/+ZTUql37sYhbuNR+dkHRAm+cG0/EWc156dwXxCl1YGRGzXO/jvGu0lsJcBcH7oWAUlrEjrLLA1PZa22FeQFQfJ2ABmLh/ga7eAJis8sBy8UmU+QFNJISCLJ8aPEgGTIM/RBtE6C/lw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from localhost.localdomain.localdomain (202.83.56.97) by BLUPR0701MB1713.namprd07.prod.outlook.com (10.163.85.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.803.11; Tue, 27 Dec 2016 09:51:31 +0000 From: Jerin Jacob To: CC: , , , , , , Jerin Jacob Date: Tue, 27 Dec 2016 15:19:19 +0530 Message-ID: <1482832175-27199-14-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1482832175-27199-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1481680558-4003-1-git-send-email-jerin.jacob@caviumnetworks.com> <1482832175-27199-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [202.83.56.97] X-ClientProxiedBy: PN1PR01CA0001.INDPRD01.PROD.OUTLOOK.COM (10.164.137.8) To BLUPR0701MB1713.namprd07.prod.outlook.com (10.163.85.14) X-MS-Office365-Filtering-Correlation-Id: 2b7ee1ae-77f1-46cf-d38a-08d42e3df12a X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BLUPR0701MB1713; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1713; 3:AUXPx+6ebmUSrCEHferxkZ/fWo08yWfTy0D65o0FQJbU9Xt2eWVDezTo3mIDz8Yk2+dz785ufTkLf4Av4Hz7CwSjxmvwUIHwbqEe/IlAT7ScgqqjST3pO4eEJMD8MwYBcjJSHatbOk/6GLKmgy1u8QxAeeoD/Eqn2N1UWTDba0K1J8YojF5/zo53h98Tu2x0dn9IfX8ArSOgE6hitByJCE/p7ItismS55RW+O1o6M10N3IFIlY1DGutJfa9/PR4joNaNVjCPf3WHyhCYtNncvg== X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1713; 25:CEvQnHBtb+J2Asiux1cbqVRP/LhbuIkCIf8vtl54x5FVMrFOh67Xh2Ghqelp1Xg5R0Flp0QqXwZefzpkm8M+ICRNEak5ES70YfAkVBKaWABxngTHh5pXFLqYmVUja7eHAFRnXAKvlsDxndPrFZCrfKul0gbDEGGc8AIA2p0q8WOaNgnZAiJ3p4X+k+OsGFty51bVRK7J7wMQHDGVhnKr9HfstBCZeoMjEx0nqB3H8VBiAYiZl2JxKdPW3x50cG/jTa2JT2nkLwLuZX7qeykMpziYHp4sNGjOKb6n41wHH0+6zMzSTOwzfOxvMt8cS8gLnnRyqhUwMJOJoqw7lEwQkx4kUERbXjdxzf7erP+xeTrb2e4BJEg3bbW5+BuzXBh/NNueoJ6rIwp/uLJLg+eOapzkZ6GyXM7lceyDOkqQS6KcqZgJThOzR5k3mqIpG970NdDIIGOvYcOqiAxnTZKqnSPCd7/dGVGHyLMLYDxKsmLArWpElt0E73Hb06L3B4TcbJq7PZ61dYH15nf2oAx+8ZNz1i39QGPDBSwbcMCLqfIS1w9xORYMV6TxbExZuOn3q0FE7Se3AfUbwtlHqq6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cspl0CJcsmqaVKPRgr49HQYB30Mw8nogAEHJrdPY4lAHs9uApYEBzo0MmnkwHq6xNA+jB3Wpf7AM4Kzw4ioy/cLS1io= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6041248)(20161123555025)(20161123560025)(20161123558021)(20161123564025)(20161123562025)(6072148); SRVR:BLUPR0701MB1713; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1713; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1713; 4:7Dux4BkZwLNwVKdFBHU0abYvArE3mq/5KPE0aZoBNpHK2v5A8iUkJD3VKeclkBF5UAvuL20Cn19FCiVvwB+dWTb5RNM/b/7c3pvlXXSbSeUH1RHOO7Uh+5bg1VRrsxapc40n8/nLBBb+ZiHWoGJNn2B8dLP8Q2DGHwMvYLXTtTvmzG9qHhd28RUl2R6ZjCt3Y8sUGrhyI2vbLHdcbarCNOnDZ3w1uFAaPCR9uT8N7ruVIjNKRi19lljUM6LbQ8HdQLFfP0IsG9Knh1uRhy633//Y93XxUXRCqfQMW87sZqr4UQsGkOOQD7ZrEpnJMGSoG7lKUQtBbtUIa38ofQdTIrBoKhOnPNvOFCbAVuvH/WtOV+3kFAhy/3/kMUDCdTymVreASRBsm4hh3+VFAoKtdTS637b7fQql3kcW+Zr2VraqbmaLx+a9GHcHK+gYnDgfLIlJ7e4VLLxbe6SXW4NR5EAkXyyCUv/syNDD8iYs4U3pP07boDBSt4slecDLwEUl6ZdifaJ9a0q/KDG4KcwLcu/b0ZmU/q1EJ1YIoRCdF19lIsBcLLvGGsCmin9+3thScoBM/EOBumRuCXzjNxdg80SRryKC3EbnyUoZSLeb7oE= X-Forefront-PRVS: 0169092318 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(39450400003)(199003)(189002)(4001430100002)(3846002)(4326007)(6116002)(50986999)(76176999)(5003940100001)(6506006)(6512006)(6486002)(92566002)(2351001)(50466002)(110136003)(305945005)(8676002)(66066001)(2906002)(101416001)(81156014)(81166006)(42186005)(50226002)(68736007)(106356001)(36756003)(97736004)(33646002)(107886002)(48376002)(105586002)(38730400001)(7736002)(6916009)(5660300001)(42882006)(47776003)(25786008)(189998001)(2950100002)(6666003); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1713; H:localhost.localdomain.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; BLUPR0701MB1713; 23:bBvERr5IIW5GZJhUzu0PWZe9Vtk3zJpZsFUyC72?= =?us-ascii?Q?JUxaVuhKpocNS/FIMQTvohAkIDUOMc1wgsPhjJvjmwJis1G5PloiKjq0tZQ8?= =?us-ascii?Q?rDmK0CZuk23LAuIeIt+q87/ykZfxlnzKd85jvoUWEX0NbGW1+ERZ72cuJMNX?= =?us-ascii?Q?FdumykVDF1Zi6HBCnDGeQzaVuPlTdJ4HBD0+smGtnGwwO1BkeeWzDfBC6yKc?= =?us-ascii?Q?SH0MUGx7+Ac0PoJE9+fH+/Ram8vr9j4ccml7CCPkdu6k3q3x7Cfrjjim2SeB?= =?us-ascii?Q?4Fy3QuDfQlI+0Q63KAHbmmDZtThU3Yx/eicmCiDf0ztKwba1jROrJWsg1L2t?= =?us-ascii?Q?T3fsdjkGLkyKC8y1pkcVBRkYdpY7VUSUZBVYEuM0iu1CoO4juNUVe35lUcJj?= =?us-ascii?Q?c3sEDkx3l4aqEe01STiEEevLRZoECq7rGpoVgM+w7nbtQ8Hlg97On0fwMzLx?= =?us-ascii?Q?c5sBREKcqB1lifmQv5G64o54GcUpUXTr6Vj0N4fhMcPiQDgE3VXtfE2TraTr?= =?us-ascii?Q?YiT0YJTaG6d/6atcPc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+Vh2VveRtu28niG7ZbvMSO1FZH3EhvNAMAcOPmZIO5JYAuqF1jiWR/QIn/9BuTR6ZQF66cW5kjXjzHhokuBlHYJAJiaKyY+VfRN4YPmGxg5UGCCl01EqS1tR4ehcaebbgapl81CuoGYPYb4i8j1veCJT2n9TXn4lOjUKWXLId1DBEMtApyI=; 5:/0RSwLDFjbozOHWey4k/e4og7xccNl+blurNBe2kLgR5+jbbHhAGL2dQWXiLZbr2lZeF4aeU47q3bY3qg9CFZiNqf++UfFfsI3AzZu8/ivgRg8AIMR9LdtlHag00tq9XZRVP3MEe64Z421J5PM7tnQ==; 24:oqoBH2cva/nUdn6nqCMnO0jXr8sUruaVYL154VeG5f20XENatVRGkhaXiKpFyXUM+RCHeZzX3MpVK7jL2s8zvRXpWv6ngF5uUevjHoCRywc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1713; 7:m4OaZgOs1a2sGpEKmvTyptr7bEmffu9eae6sIxJhCJGApyAjfJ11m9D5yD+YaotplqhqAQsZbK/2UFoZuO5fUwK1+2Ngb4ooixV1MzNCOBLDzxoIGYOnLWXx5MSj92lTd0OFVqDuEvx+lDVX+WS7RnBK2qCxZOp8QRoiPOorq3kA24qlqD7f+104s/fHDZ7bHzjnz74xp/a1/Rlckqio9qy/NyydBLf4tBmK53cWODRoX03582V04EfDkndYdCgUHcIguafW4aNgabYnU/SF8wYEEDk/IZ47hPkM028I568D6WFs4oEZwLW+PsNmle8qDr/dylHIknQAkA6ZgPwCAJb+Sjfs8H2V6rWxR7bHB3Jho8yI941m3ZSDAhR4lcWyfz2fQFe7/YqBgOOPFMuwFYYryyb4ddK4DXTV90Bp4pu1pV/gOzThzXUTYkGW/daoM+mjOZ4lsC4J67J6SH/u7A== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2016 09:51:31.2916 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1713 Subject: [dpdk-dev] [PATCH v2 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: Tue, 27 Dec 2016 09:51:36 -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