From patchwork Wed Jan 18 01:21:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerin Jacob X-Patchwork-Id: 19667 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 63C47F95F; Wed, 18 Jan 2017 02:23:10 +0100 (CET) Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0073.outbound.protection.outlook.com [104.47.34.73]) by dpdk.org (Postfix) with ESMTP id C79675589 for ; Wed, 18 Jan 2017 02:22:52 +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=RdpoeNlwxSm9NFdiPlUaqrzFGg9PNTtZOMNiYzEuxPc=; b=Uhpnj58icjnCOjLdegAEZV94C9LvyIGAzU1Mh6E3s1A6fkA+XSyMll87g6qEbowc5Cw1mFwWEBBekCJqHTwmToE7rC6I6isXQ3/ey6HzQ8xi/rYzGfptA6awWlqAVTAL8mGqW4r+plsxkPgru/70TcTBp7M8kYqBeFu6ZJAQ4cc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from jerin.caveonetworks.com (111.93.218.67) by BY1PR0701MB1721.namprd07.prod.outlook.com (10.162.111.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.845.12; Wed, 18 Jan 2017 01:22:48 +0000 From: Jerin Jacob To: CC: , , , , , , Jerin Jacob Date: Wed, 18 Jan 2017 06:51:23 +0530 Message-ID: <1484702502-25451-11-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1484702502-25451-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1484637244-7548-1-git-send-email-jerin.jacob@caviumnetworks.com> <1484702502-25451-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MA1PR01CA0115.INDPRD01.PROD.OUTLOOK.COM (10.174.56.159) To BY1PR0701MB1721.namprd07.prod.outlook.com (10.162.111.140) X-MS-Office365-Filtering-Correlation-Id: 9e83a2ab-1978-455f-0706-08d43f408538 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BY1PR0701MB1721; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1721; 3:S7Ki8Cnncnlt3Dp99HxmazRGUFSQRQhrH+EQNGzwdoNP2oHoR3NgzSUiOgA5KHF1MmshwBdJI8O1ekSqNlDq+QO+ploh7HmcYD6pY3YmHGGIj3uI8Mw/6cFecVNoLGkU8fHx0f30WvQYEdjdi5pOCZtEoubhCR8EWwssqrUhBSZUULNBpgH9kuVN5W87J+2bRyurW0EbrVt1fHiZdJSHyyy0XqdWBMstnBX/NzNUnHfl1GvIFXgQzIamCGxtFe9iyYsPgNUYfTqO1nfKh66iLA== X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1721; 25:YhFGrsaDpfqpqZzna6H6+wC4lAGmBsoiRhJy/itaiEUJU+FM13c4MohMsMYj7I2AQUqJqhTUSx7EM9Ektuml+lo3Vb+Gu2G3JppwanyGVdxjdNXVzjnMgHX6V4c6c2fww5Xjb0JhvzePuE/RFZKGNZnYH8siHUVB91WKGv/Z6g0Ep4L9VG+Z96MNis//Bxb1c6gvAs+OE0uIMluFnuPALNd8XU0X3BH9IQPfik8abmr+EkRBsZH1VCz8bO1eQ6VKlJdxOT2K1cE62h4nhcSEXd5t7oSbDOaiDgw2RY8wTy0zzLzSa1QQxlryrZxGdQUYHdPMmU8nnJgR3HLM8EhfBmfu7Z9nwbsn/EYt/NA54UPbvJW0IdLEFUeDvYND0iIlmw03SbWLnAqI/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Eg1zLjx0m40WIUec938AkyR3NemFO8LnLnNDN7ku2h6yWrIl6rS4Dy+MaEGnVVEuTkjMswxD/pyWm+TZXsum6lH3hcoy/lQbHRYOPZk5cG1bakEPMOcoKSH557dZv4wX7uZWppodYwYtqKc4hR3ty9gVuNmsSGXYi4c+ngDyhGVKczgLK31ESNIN5Adf2xS/LKAwOYIYQLMWvz0xVMxvz4aYkqRcRZlurz7hAbPraWQKr1Q4sA55cB/5Q4A5JklrsTnNXMLotnBOsqLQ= 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)(3002001)(10201501046)(6041248)(20161123560025)(20161123564025)(20161123555025)(20161123562025)(6072148); SRVR:BY1PR0701MB1721; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1721; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1721; 4:BUgKf02SuQ33SY0MlgW5z8g0SP21SeBQqt5rAlMV0v1vEJ6vZVLOqeAp7B1UH/sWHAGXAqEs7z6bIlspwyp5w93HmWeuVC9oYzL0mRwKlsSPelYKhrRx5T483TErd4pNKi21fbOmanSj7jTO9kMkrYcdSyCqUBbZwhbYiu8YFHUXUwvpGElcPcm794Qh8KtVV+cQ2gjSZlwfr6gfDeV7KT6fsh65mZ+DUI064+0tQxF776s2iJLLyVddgTy8rEB1jeUBDsCRe/cOatMukj//xN7U0e/MKhQYrj0PD/3TOc8AYh+dsupr+qGajJYFdqr3fu6BF+eed1j9QxajPOfRxMt6lBfjOsINr8j1P/BplPL3si+5totysPiqSbT5rPiPBqka05F5KIHsAZpB8QMuz1wn1eq4FKj1qaGDmVJuVJzGR2lFM5tpHPpFHQXiIMlVt8GGndb7nRM4ieNtf6RF4/SNYuKWWAJ6nQBL92/+3Pyh0JFQ+AJBrWnU/Je+2RbtHqNGMEz7C7kzT+OOqwpq4XtqDGm+yLh5cJwSzd+4wPvNUE2DIGIa3Gok/WTV8ZyBCd2cbmzdyMESH0uyw08dSA== X-Forefront-PRVS: 01917B1794 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(199003)(189002)(4326007)(6506006)(50986999)(97736004)(47776003)(107886002)(25786008)(189998001)(54906002)(66066001)(92566002)(101416001)(38730400001)(81156014)(81166006)(6486002)(2906002)(42186005)(53936002)(50226002)(8676002)(2351001)(68736007)(305945005)(53416004)(3846002)(50466002)(6666003)(105586002)(33646002)(6116002)(4001430100002)(5660300001)(6512007)(48376002)(69596002)(76176999)(42882006)(5003940100001)(5009440100003)(36756003)(7736002)(110136003)(6916009)(106356001)(2950100002)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0701MB1721; H:jerin.caveonetworks.com; 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; BY1PR0701MB1721; 23:G+xy27nPkMgnMmlTm6PdqnFKo5RjB8zSB7uHRp2?= qPaZAR6VnCDuptDhdVh67k54JgiDJYDBEkVpZePieEhEBGc5S9EIPqnkY03Ib1Ata2fjoP4MDnp/D3wXWDsVT9oN46xJv328YTGBvvFZASnCe+kwkVD8XxlCNu9j4uyN6lEDip9uORbNbBvfoMBDodw7qHzC882DZXyfyU9RkoFijHTJDOeEaJFDQwVjTSt2a/Gqh1ttn+Fg7szEJJjuYROvWZ9gQeE/jjZTn7LWej3kIjrj8etXaAonMsIjo4ZYZbSlpMze/kEo4Iggn6PsLLP3WUIEtw52aRbigCzILxAd39UMvzJGJTIVC+bhs5WmW3Q5GlvJeGJLk2+ql0sePOXKb+fI5BEwuMIoAQAH7Rgy55g4ixuAtzeX20vkV9sNxaSv8uHQsiFtnhEhfFbpwr1MBkSyIXs4YR6/X9J/99zS0MlQEwChlJhqo+noBxjrBVRgpU2NdV4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ddOnNhJ6H+qMlGcrcSsAiIg7rZrGqjLrmmnRu0L7Wr4T/euFOwo+mfUWY7BSdE3MPgsHwni/ST3P2xhPPata062NJcH4zrq93/lAlX/LScZfsNgSehyjLH6rG/nLD9GKmw8g9DSmruw7K7kkUGdImlbcbPsJXvmwyrX9QG7I4ITMFvyn0JfjnJng/2eEWeNHGgzk13zHXmI=; 5:wDSf36EiHsM9woCQXvsnKL9sYeMiK+zlMsIvIOA5fW5/LGeyBC6OT8906LjkG5OcpgYtfDxsvu5D/Nzwd+rLgSlcDT1YOW5Gcs0B6YC/n1sw+Nv41yKJPEXnURQ5vm0fBCWGdZSc7zvGC4fozZhyuCJpSHT0o8GeKQmI51k/U4E=; 24:lzwuG43tTM2oXWO/f8cyN39m8wxOKs597axZFMHcqv9SOCRu5P2QfFfGv4AY4ObP8cyjzrylPPPeOD+d3iZrNc9vJdGEOud7N2zfhTNO2x4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1721; 7:cEaJC/0Z52bmXQJLz8+5SM7xVBJYT+qrTMhhRtKeDD47u1iGdi+FTx6Gd7bNT6I7IMdWSIzRKUH/bDakSmTzvu+lVKFfMdBq6l5rpSaJlY+d2B8H61YlX9PYbStoX11iJD5FDyMXcytyf4/g2MoYpARJ5FQGLQ4pAb4mCP4K2PmZpAwn0NdtaXJphGu6cpOYbQ4zEMBPv82aXp0PboFZ0vTdKP9NPtbNCOPuCpJtRt6ZUZRMjlWMWWp257L32A2aXYMWLmaj9bqrD89V7QmPkSBDwVbEulD8FUzAAzVd48CdoDRonxi4TAt9ituysjZzH8lWTs5R4tJzplYWw6hpxy1Yy8aMkBvqYEftAgKNMf3XkAsVnzMGne4PDBzWJiYNg7VrbjUoh1L9SeGfnMREWSn0okrgVLdwmX5zMy0ejMV7UoCXjf7/xorwaEt/Fm8gj7yid0MNVX/qzpka9sQovw== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2017 01:22:48.4198 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1721 Subject: [dpdk-dev] [PATCH v5 10/29] eal: introduce I/O device memory read/write operations 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This commit introduces 8-bit, 16-bit, 32bit, 64bit I/O device memory read/write operations along with the relaxed versions. The weakly-ordered machine like ARM needs additional I/O barrier for device memory read/write access over PCI bus. By introducing the eal abstraction for I/O device memory read/write access, The drivers can access I/O device memory in architecture agnostic manner. The relaxed version does not have additional I/O memory barrier, useful in accessing the device registers of integrated controllers which implicitly strongly ordered with respect to memory access. Signed-off-by: Jerin Jacob --- doc/api/doxy-api-index.md | 3 +- lib/librte_eal/common/Makefile | 3 +- lib/librte_eal/common/include/generic/rte_io.h | 263 +++++++++++++++++++++++++ 3 files changed, 267 insertions(+), 2 deletions(-) create mode 100644 lib/librte_eal/common/include/generic/rte_io.h diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index d26d984..8b3b426 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -71,7 +71,8 @@ There are many libraries, so their headers may be grouped by topics: [cache prefetch] (@ref rte_prefetch.h), [SIMD] (@ref rte_vect.h), [byte order] (@ref rte_byteorder.h), - [CPU flags] (@ref rte_cpuflags.h) + [CPU flags] (@ref rte_cpuflags.h), + [I/O access] (@ref rte_io.h) - **CPU multicore**: [interrupts] (@ref rte_interrupts.h), diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile index 09a3d3a..b34dce9 100644 --- a/lib/librte_eal/common/Makefile +++ b/lib/librte_eal/common/Makefile @@ -44,7 +44,8 @@ INC += rte_malloc.h rte_keepalive.h rte_time.h GENERIC_INC := rte_atomic.h rte_byteorder.h rte_cycles.h rte_prefetch.h GENERIC_INC += rte_spinlock.h rte_memcpy.h rte_cpuflags.h rte_rwlock.h -GENERIC_INC += rte_vect.h +GENERIC_INC += rte_vect.h rte_io.h + # defined in mk/arch/$(RTE_ARCH)/rte.vars.mk ARCH_DIR ?= $(RTE_ARCH) ARCH_INC := $(notdir $(wildcard $(RTE_SDK)/lib/librte_eal/common/include/arch/$(ARCH_DIR)/*.h)) diff --git a/lib/librte_eal/common/include/generic/rte_io.h b/lib/librte_eal/common/include/generic/rte_io.h new file mode 100644 index 0000000..edfebf8 --- /dev/null +++ b/lib/librte_eal/common/include/generic/rte_io.h @@ -0,0 +1,263 @@ +/* + * BSD LICENSE + * + * Copyright(c) 2016 Cavium networks. All rights reserved. + * All rights reserved. + * + * 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_H_ +#define _RTE_IO_H_ + +/** + * @file + * I/O device memory operations + * + * This file defines the generic API for I/O device memory read/write operations + */ + +#include +#include +#include + +#ifdef __DOXYGEN__ + +/** + * Read a 8-bit value from I/O device memory address *addr*. + * + * The relaxed version does not have additional I/O memory barrier, useful in + * accessing the device registers of integrated controllers which implicitly + * strongly ordered with respect to memory access. + * + * @param addr + * I/O memory address to read the value from + * @return + * read value + */ +static inline uint8_t +rte_read8_relaxed(const volatile void *addr); + +/** + * Read a 16-bit value from I/O device memory address *addr*. + * + * The relaxed version does not have additional I/O memory barrier, useful in + * accessing the device registers of integrated controllers which implicitly + * strongly ordered with respect to memory access. + * + * @param addr + * I/O memory address to read the value from + * @return + * read value + */ +static inline uint16_t +rte_read16_relaxed(const volatile void *addr); + +/** + * Read a 32-bit value from I/O device memory address *addr*. + * + * The relaxed version does not have additional I/O memory barrier, useful in + * accessing the device registers of integrated controllers which implicitly + * strongly ordered with respect to memory access. + * + * @param addr + * I/O memory address to read the value from + * @return + * read value + */ +static inline uint32_t +rte_read32_relaxed(const volatile void *addr); + +/** + * Read a 64-bit value from I/O device memory address *addr*. + * + * The relaxed version does not have additional I/O memory barrier, useful in + * accessing the device registers of integrated controllers which implicitly + * strongly ordered with respect to memory access. + * + * @param addr + * I/O memory address to read the value from + * @return + * read value + */ +static inline uint64_t +rte_read64_relaxed(const volatile void *addr); + +/** + * Write a 8-bit value to I/O device memory address *addr*. + * + * The relaxed version does not have additional I/O memory barrier, useful in + * accessing the device registers of integrated controllers which implicitly + * strongly ordered with respect to memory access. + * + * @param value + * Value to write + * @param addr + * I/O memory address to write the value to + */ + +static inline void +rte_write8_relaxed(uint8_t value, volatile void *addr); + +/** + * Write a 16-bit value to I/O device memory address *addr*. + * + * The relaxed version does not have additional I/O memory barrier, useful in + * accessing the device registers of integrated controllers which implicitly + * strongly ordered with respect to memory access. + * + * @param value + * Value to write + * @param addr + * I/O memory address to write the value to + */ +static inline void +rte_write16_relaxed(uint16_t value, volatile void *addr); + +/** + * Write a 32-bit value to I/O device memory address *addr*. + * + * The relaxed version does not have additional I/O memory barrier, useful in + * accessing the device registers of integrated controllers which implicitly + * strongly ordered with respect to memory access. + * + * @param value + * Value to write + * @param addr + * I/O memory address to write the value to + */ +static inline void +rte_write32_relaxed(uint32_t value, volatile void *addr); + +/** + * Write a 64-bit value to I/O device memory address *addr*. + * + * The relaxed version does not have additional I/O memory barrier, useful in + * accessing the device registers of integrated controllers which implicitly + * strongly ordered with respect to memory access. + * + * @param value + * Value to write + * @param addr + * I/O memory address to write the value to + */ +static inline void +rte_write64_relaxed(uint64_t value, volatile void *addr); + +/** + * Read a 8-bit value from I/O device memory address *addr*. + * + * @param addr + * I/O memory address to read the value from + * @return + * read value + */ +static inline uint8_t +rte_read8(const volatile void *addr); + +/** + * Read a 16-bit value from I/O device memory address *addr*. + * + * + * @param addr + * I/O memory address to read the value from + * @return + * read value + */ +static inline uint16_t +rte_read16(const volatile void *addr); + +/** + * Read a 32-bit value from I/O device memory address *addr*. + * + * @param addr + * I/O memory address to read the value from + * @return + * read value + */ +static inline uint32_t +rte_read32(const volatile void *addr); + +/** + * Read a 64-bit value from I/O device memory address *addr*. + * + * @param addr + * I/O memory address to read the value from + * @return + * read value + */ +static inline uint64_t +rte_read64(const volatile void *addr); + +/** + * Write a 8-bit value to I/O device memory address *addr*. + * + * @param value + * Value to write + * @param addr + * I/O memory address to write the value to + */ + +static inline void +rte_write8(uint8_t value, volatile void *addr); + +/** + * Write a 16-bit value to I/O device memory address *addr*. + * + * @param value + * Value to write + * @param addr + * I/O memory address to write the value to + */ +static inline void +rte_write16(uint16_t value, volatile void *addr); + +/** + * Write a 32-bit value to I/O device memory address *addr*. + * + * @param value + * Value to write + * @param addr + * I/O memory address to write the value to + */ +static inline void +rte_write32(uint32_t value, volatile void *addr); + +/** + * Write a 64-bit value to I/O device memory address *addr*. + * + * @param value + * Value to write + * @param addr + * I/O memory address to write the value to + */ +static inline void +rte_write64(uint64_t value, volatile void *addr); + +#endif /* __DOXYGEN__ */ + +#endif /* _RTE_IO_H_ */