From patchwork Fri Nov 30 17:06:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 10706847 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 91B1C13A4 for ; Fri, 30 Nov 2018 17:06:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7DAEE304BF for ; Fri, 30 Nov 2018 17:06:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 71A04304E4; Fri, 30 Nov 2018 17:06:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 017FF304BF for ; Fri, 30 Nov 2018 17:06:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A7AE06B5943; Fri, 30 Nov 2018 12:06:16 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 9419D6B5946; Fri, 30 Nov 2018 12:06:16 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 60BB66B5946; Fri, 30 Nov 2018 12:06:16 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) by kanga.kvack.org (Postfix) with ESMTP id 1AC2B6B5943 for ; Fri, 30 Nov 2018 12:06:16 -0500 (EST) Received: by mail-io1-f71.google.com with SMTP id u2so6043053iob.7 for ; Fri, 30 Nov 2018 09:06:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :date:message-id:in-reply-to:references:mime-version :content-transfer-encoding:subject; bh=VWinYsjQzvVJqpu4LggXenXz9nexykvqcUZD6g7FExM=; b=Qwel+u9ryJ75o8/ZtGhIJtreYwKMrI7h2xo0bZ3EyVmiu406Wb0zLRFn2w5B8lqyxl awCmIKE4++DbSmALM7+50RHR69qCLaMzrkwHKY5nur9T0IBuMVn4CWeB6Uh5AWbWjpnX cEB4zsNTjFuuhMrsAzWrCnVb2UkWhOXYIeoYhwtFOLvk64dJ1MM+2K1ySZlBxcF4Uy2E 8ca29gEvlD/H4orQfiBUCYdPP+sJuI/P2akaIaHn5SWJ82mVSfu/Xk6g+xeEoGrGksDr KGGf+3Y+DecJXqePT1xdF9y52iOpXNhozuvYcaCs3jgIdqcZ3Q2VWZFuehr+6Yf3GnTi XhOw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of gunthorp@deltatee.com designates 207.54.116.67 as permitted sender) smtp.mailfrom=gunthorp@deltatee.com X-Gm-Message-State: AA+aEWZfBPubiEGH/4w1fP8InVMNbm9Y3ZkPHzZZVNnyNi+z+6EmDt2s Muk+45MaxtK5hXL8AXg9O+l6Xh9R/lfkLcz/BkrskYaXnk55vvs7sAONmCrIstOpWbBggEyXA03 zCPZ8r69QsA95oJ80COfChOcyqpT/Hu4UbryRCwCY94iy8jn2TTUZx4hXM6Hw2XgImQ== X-Received: by 2002:a5e:9602:: with SMTP id a2mr5070820ioq.136.1543597575866; Fri, 30 Nov 2018 09:06:15 -0800 (PST) X-Google-Smtp-Source: AFSGD/W4SZ//GswgQNQlusErGbi3dCSdEofb2SpWVV+sYwDaQdNnPsVYB6ngrYnyOc8FWsmpICSe X-Received: by 2002:a5e:9602:: with SMTP id a2mr5070762ioq.136.1543597574843; Fri, 30 Nov 2018 09:06:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543597574; cv=none; d=google.com; s=arc-20160816; b=iuXVVbotb66SFiFHXDuS1SbOTm2jFAvR4+j3A9pUfxiEEij2dQ5xPRdUGqqaYcjTeR 7KAasv95yNgWtMKFgbWsOBKA5hvw5FENzK4DbKBBhXPUrHEVo+wwLRUWTJD3XbQPk7gb QQrq2bQDvdgLDIbOMD5H331ckvOwNMRzrf+XvImvmLnlO9FacdtDj0jsk4x8JFwzaoV9 VtpLs9caFrED4JGEvFk887DHvwG6ypffW1KthsyBNNoeQVtMTQSXMgw8Hxse7HNtLxLv 7zRXAzgsnSLp6phtwiaxgyL2IimaqeBMcj+IP+JV/AWGWDdGCzpUfhG/ihd2y1XrA5tL ciUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:cc:to:from; bh=VWinYsjQzvVJqpu4LggXenXz9nexykvqcUZD6g7FExM=; b=Fbs632p/z/J0e88VQM8CnZFDe7sWFKQQNdweRn5GLiMhjOoIliJ8+eIbPtvkJwr245 e0tUExvrz0d6D8VqX1Ps1AzivOscfQ++JYlUZ5RzSH5SlX3f5MhOzh6+tENqO/f65O+t XwLAt7Taf5q7/VKd6BbqdeHW7xryE/fb9Xt9caVR3HBgkSN4jFMluIsu+3shi6C5hqfv F9znHB7FvQViUhFqeUlEvYaosPWtA2CysCBHcdgbJ7NiHRYQbUbmdcNdtGau7Gxpv77s swbHQmQn+8oGsEW65WRygPe1Cyy2v9+wQ1vxmBK1gEuj3EKj+MFHvoQhMZ0brDnda1TF MX8Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gunthorp@deltatee.com designates 207.54.116.67 as permitted sender) smtp.mailfrom=gunthorp@deltatee.com Received: from ale.deltatee.com (ale.deltatee.com. [207.54.116.67]) by mx.google.com with ESMTPS id q6si3545085itj.38.2018.11.30.09.06.14 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 09:06:14 -0800 (PST) Received-SPF: pass (google.com: domain of gunthorp@deltatee.com designates 207.54.116.67 as permitted sender) client-ip=207.54.116.67; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gunthorp@deltatee.com designates 207.54.116.67 as permitted sender) smtp.mailfrom=gunthorp@deltatee.com Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gSmEz-0000qm-P2; Fri, 30 Nov 2018 10:06:12 -0700 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1gSmEx-0004V6-El; Fri, 30 Nov 2018 10:06:07 -0700 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-ntb@googlegroups.com, linux-crypto@vger.kernel.org, linux-mm@kvack.org, Andrew Morton Cc: Arnd Bergmann , Greg Kroah-Hartman , Andy Shevchenko , =?utf-8?q?Horia_Geant=C4=83?= , Logan Gunthorpe , Thomas Gleixner , Kate Stewart , Philippe Ombredanne Date: Fri, 30 Nov 2018 10:06:01 -0700 Message-Id: <20181130170606.17252-2-logang@deltatee.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181130170606.17252-1-logang@deltatee.com> References: <20181130170606.17252-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-crypto@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, arnd@arndb.de, andy.shevchenko@gmail.com, horia.geanta@nxp.com, logang@deltatee.com, tglx@linutronix.de, gregkh@linuxfoundation.org, kstewart@linuxfoundation.org, pombredanne@nexb.com X-SA-Exim-Mail-From: gunthorp@deltatee.com Subject: [PATCH v24 1/6] iomap: Use non-raw io functions for io{read|write}XXbe X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Fix an asymmetry in the io{read|write}XXbe functions in that the big-endian variants make use of the raw io accessors while the little-endian variants use the regular accessors. Some architectures implement barriers to order against both spinlocks and DMA accesses and for these case, the big-endian variant of the API would not be protected. Thus, change the mmio_XXXXbe macros to use the appropriate swab() function wrapping the regular accessor. This is similar to what was done for PIO. When this code was originally written, barriers in the IO accessors were not common and the accessors simply wrapped the raw functions in a conversion to CPU endianness. Since then, barriers have been added in some architectures and are now missing in the big endian variant of the API. This also manages to silence a few sparse warnings that check for using the correct endian types which the original code did not annotate correctly. Signed-off-by: Logan Gunthorpe Cc: Thomas Gleixner Cc: Kate Stewart Cc: Philippe Ombredanne Cc: Greg Kroah-Hartman Cc: Arnd Bergmann Link: http://lkml.kernel.org/r/CAK8P3a25zQDxyaY3iVv+JmSSzs7F6ssGc+HdBkGs54ZfViX+Fg@mail.gmail.com --- lib/iomap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/iomap.c b/lib/iomap.c index 541d926da95e..2c293b22569f 100644 --- a/lib/iomap.c +++ b/lib/iomap.c @@ -65,8 +65,8 @@ static void bad_io_access(unsigned long port, const char *access) #endif #ifndef mmio_read16be -#define mmio_read16be(addr) be16_to_cpu(__raw_readw(addr)) -#define mmio_read32be(addr) be32_to_cpu(__raw_readl(addr)) +#define mmio_read16be(addr) swab16(readw(addr)) +#define mmio_read32be(addr) swab32(readl(addr)) #endif unsigned int ioread8(void __iomem *addr) @@ -106,8 +106,8 @@ EXPORT_SYMBOL(ioread32be); #endif #ifndef mmio_write16be -#define mmio_write16be(val,port) __raw_writew(be16_to_cpu(val),port) -#define mmio_write32be(val,port) __raw_writel(be32_to_cpu(val),port) +#define mmio_write16be(val,port) writew(swab16(val),port) +#define mmio_write32be(val,port) writel(swab32(val),port) #endif void iowrite8(u8 val, void __iomem *addr) From patchwork Fri Nov 30 17:06:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 10706853 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1DAAC13A4 for ; Fri, 30 Nov 2018 17:06:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09543304BC for ; Fri, 30 Nov 2018 17:06:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F118A304EB; Fri, 30 Nov 2018 17:06:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28113304E1 for ; Fri, 30 Nov 2018 17:06:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 80BFD6B5944; Fri, 30 Nov 2018 12:06:17 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 793FD6B5946; Fri, 30 Nov 2018 12:06:17 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 612296B5947; Fri, 30 Nov 2018 12:06:17 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-it1-f198.google.com (mail-it1-f198.google.com [209.85.166.198]) by kanga.kvack.org (Postfix) with ESMTP id 26A566B5944 for ; Fri, 30 Nov 2018 12:06:17 -0500 (EST) Received: by mail-it1-f198.google.com with SMTP id x82so7598851ita.9 for ; Fri, 30 Nov 2018 09:06:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :date:message-id:in-reply-to:references:mime-version :content-transfer-encoding:subject; bh=4cj5G0KqKx3dYBBH8Jo8zgaYS4flmkYi8FcSSCqHLwU=; b=p8EFvvw8T/QeeRO3RWXH6uluKxI8RNadZP/K1VvzTy76t3XgpY3EkFEE0/fk5VRsSi KlhCE8xsvlWodEung4oIRkQ52dfa9djovmwd3wHakBePQ/iv+l5hUswarOKI1kdBHR3X 9HwCjSjqn24FTVTeKo4Z1Z1CReVF+HQhVPSTiY0Z8S+fVE51xEZ4Fm+MP+/PsxsJPQKZ 3dFPr9/4BB+ivQ9xQfpOnuKZnif13+fgtEbaAExKlTNkonIERxlAVvxZM71exCUYiuCw pxEQLty3fnRm3Wc+fMnJ+XSgy/vSDE/mZM+7Fseo5WcHy2PgYAVrXPFTOFZWg0OdQY53 hy6A== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of gunthorp@deltatee.com designates 207.54.116.67 as permitted sender) smtp.mailfrom=gunthorp@deltatee.com X-Gm-Message-State: AA+aEWb3jYIxG2UJ9UJWOgmktmVmt67JN8Y3UwLLrskuDSUXeHj9LVEX sWtRwRZzwfEZPgq9CjXpRYlAirnPsU6a1IWi3MAEJs/Ds6zhjUkFWODIcRMIev8ziz6wtJBMx3V R1wA2rVN06HKtdFtsaunrWrD9G3yU25LTmA1kyeQJ/oWQZ7QkAcdvXgHlRB/IFzI8Zg== X-Received: by 2002:a02:9870:: with SMTP id x45mr5322263jaj.41.1543597576858; Fri, 30 Nov 2018 09:06:16 -0800 (PST) X-Google-Smtp-Source: AFSGD/V62IPJCXtyRAz2S1wZLtIG9N6KUwOkYharyLfvKTccMqjOXwGFl8dYp5eouCPYaKJydZu2 X-Received: by 2002:a02:9870:: with SMTP id x45mr5322211jaj.41.1543597575992; Fri, 30 Nov 2018 09:06:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543597575; cv=none; d=google.com; s=arc-20160816; b=xrdrdC2vllrhZHCS/KPZVK4nKVQ7n98FRU/eJSSO1IUVJWZMYMkdDoh6SvZ8dVxYXr XCe2DmeViluML5IvSSaBgSr/P0Z3iCbY3MulSmtDkxQNC7J5uqCCQZHL0H9Jb6qb5if1 kCmb+i2wQRMsa/yuTi7cb5E281zZ+is0luToei+zS6Mal+tS5BbBoRHli5WXRLqW10sy ecj2/4plzNp2ZJn2b4MN0lDJXV7c+pji9KKS/Rntn6sbkazTkBkl9dlmwQfC19vA3Prj SZWM0LrFmfbMnRAKzYaJU+oxnRLw0CSJ6mVq+LI87ucyVsFciUgAiYyz5v2RrTA35EHb UKPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:cc:to:from; bh=4cj5G0KqKx3dYBBH8Jo8zgaYS4flmkYi8FcSSCqHLwU=; b=PMV+pMoRAXTvAXTHe+RWKa/0SlDNHXM/4JcD9EAz5eDzvywXQ2VgLltdAnkdstZQAN aMA/TBLgWdEBOUSelFkH+dhqTt4ouIktyvaveNzzX6p8XUn8OEO/eYbspx/sYQ7X7ytS +9K2sstiGniTpZTXvvmM/4EK1waNIk/OUboRyBRubnkepBOS3CxulQha+U7V6pYRTkSx +Oam+mAlxBvOhymb8zppC9qJLLG7KfovKOov3cQr+lvjK4lXgsUez3wW9o9y1XCB2KdU HFqoId8xUtiuwJgSN5/+IW0zt+IHyuWnJJ18tS7SL9PVdKqoyAvgCprrp4hoaHc/m+vx NM6w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gunthorp@deltatee.com designates 207.54.116.67 as permitted sender) smtp.mailfrom=gunthorp@deltatee.com Received: from ale.deltatee.com (ale.deltatee.com. [207.54.116.67]) by mx.google.com with ESMTPS id e8si3480698jaj.17.2018.11.30.09.06.15 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 09:06:15 -0800 (PST) Received-SPF: pass (google.com: domain of gunthorp@deltatee.com designates 207.54.116.67 as permitted sender) client-ip=207.54.116.67; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gunthorp@deltatee.com designates 207.54.116.67 as permitted sender) smtp.mailfrom=gunthorp@deltatee.com Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gSmEz-0000qn-Os; Fri, 30 Nov 2018 10:06:13 -0700 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1gSmEx-0004V9-JM; Fri, 30 Nov 2018 10:06:07 -0700 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-ntb@googlegroups.com, linux-crypto@vger.kernel.org, linux-mm@kvack.org, Andrew Morton Cc: Arnd Bergmann , Greg Kroah-Hartman , Andy Shevchenko , =?utf-8?q?Horia_Geant=C4=83?= , Logan Gunthorpe , "James E.J. Bottomley" , Philippe Ombredanne , Kate Stewart , Thomas Gleixner Date: Fri, 30 Nov 2018 10:06:02 -0700 Message-Id: <20181130170606.17252-3-logang@deltatee.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181130170606.17252-1-logang@deltatee.com> References: <20181130170606.17252-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-crypto@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, arnd@arndb.de, andy.shevchenko@gmail.com, horia.geanta@nxp.com, logang@deltatee.com, jejb@parisc-linux.org, pombredanne@nexb.com, gregkh@linuxfoundation.org, kstewart@linuxfoundation.org, tglx@linutronix.de X-SA-Exim-Mail-From: gunthorp@deltatee.com Subject: [PATCH v24 2/6] parisc: iomap: introduce io{read|write}64 X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Add support for io{read|write}64() functions in parisc architecture. These are pretty straightforward copies of similar functions which make use of readq and writeq. Also, indicate that the lo_hi and hi_lo variants of these functions are not provided by this architecture. Signed-off-by: Logan Gunthorpe Reviewed-by: Andy Shevchenko Acked-by: Helge Deller Cc: "James E.J. Bottomley" Cc: Greg Kroah-Hartman Cc: Philippe Ombredanne Cc: Kate Stewart Cc: Thomas Gleixner --- arch/parisc/include/asm/io.h | 9 +++++ arch/parisc/lib/iomap.c | 64 ++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) diff --git a/arch/parisc/include/asm/io.h b/arch/parisc/include/asm/io.h index afe493b23d04..30a8315d5c07 100644 --- a/arch/parisc/include/asm/io.h +++ b/arch/parisc/include/asm/io.h @@ -311,6 +311,15 @@ extern void outsl (unsigned long port, const void *src, unsigned long count); * value for either 32 or 64 bit mode */ #define F_EXTEND(x) ((unsigned long)((x) | (0xffffffff00000000ULL))) +#define ioread64 ioread64 +#define ioread64be ioread64be +#define iowrite64 iowrite64 +#define iowrite64be iowrite64be +extern u64 ioread64(void __iomem *addr); +extern u64 ioread64be(void __iomem *addr); +extern void iowrite64(u64 val, void __iomem *addr); +extern void iowrite64be(u64 val, void __iomem *addr); + #include /* diff --git a/arch/parisc/lib/iomap.c b/arch/parisc/lib/iomap.c index 4b19e6e64fb7..0195aec657e2 100644 --- a/arch/parisc/lib/iomap.c +++ b/arch/parisc/lib/iomap.c @@ -48,11 +48,15 @@ struct iomap_ops { unsigned int (*read16be)(void __iomem *); unsigned int (*read32)(void __iomem *); unsigned int (*read32be)(void __iomem *); + u64 (*read64)(void __iomem *); + u64 (*read64be)(void __iomem *); void (*write8)(u8, void __iomem *); void (*write16)(u16, void __iomem *); void (*write16be)(u16, void __iomem *); void (*write32)(u32, void __iomem *); void (*write32be)(u32, void __iomem *); + void (*write64)(u64, void __iomem *); + void (*write64be)(u64, void __iomem *); void (*read8r)(void __iomem *, void *, unsigned long); void (*read16r)(void __iomem *, void *, unsigned long); void (*read32r)(void __iomem *, void *, unsigned long); @@ -171,6 +175,16 @@ static unsigned int iomem_read32be(void __iomem *addr) return __raw_readl(addr); } +static u64 iomem_read64(void __iomem *addr) +{ + return readq(addr); +} + +static u64 iomem_read64be(void __iomem *addr) +{ + return __raw_readq(addr); +} + static void iomem_write8(u8 datum, void __iomem *addr) { writeb(datum, addr); @@ -196,6 +210,16 @@ static void iomem_write32be(u32 datum, void __iomem *addr) __raw_writel(datum, addr); } +static void iomem_write64(u64 datum, void __iomem *addr) +{ + writel(datum, addr); +} + +static void iomem_write64be(u64 datum, void __iomem *addr) +{ + __raw_writel(datum, addr); +} + static void iomem_read8r(void __iomem *addr, void *dst, unsigned long count) { while (count--) { @@ -250,11 +274,15 @@ static const struct iomap_ops iomem_ops = { .read16be = iomem_read16be, .read32 = iomem_read32, .read32be = iomem_read32be, + .read64 = iomem_read64, + .read64be = iomem_read64be, .write8 = iomem_write8, .write16 = iomem_write16, .write16be = iomem_write16be, .write32 = iomem_write32, .write32be = iomem_write32be, + .write64 = iomem_write64, + .write64be = iomem_write64be, .read8r = iomem_read8r, .read16r = iomem_read16r, .read32r = iomem_read32r, @@ -304,6 +332,20 @@ unsigned int ioread32be(void __iomem *addr) return *((u32 *)addr); } +u64 ioread64(void __iomem *addr) +{ + if (unlikely(INDIRECT_ADDR(addr))) + return iomap_ops[ADDR_TO_REGION(addr)]->read64(addr); + return le64_to_cpup((u64 *)addr); +} + +u64 ioread64be(void __iomem *addr) +{ + if (unlikely(INDIRECT_ADDR(addr))) + return iomap_ops[ADDR_TO_REGION(addr)]->read64be(addr); + return *((u64 *)addr); +} + void iowrite8(u8 datum, void __iomem *addr) { if (unlikely(INDIRECT_ADDR(addr))) { @@ -349,6 +391,24 @@ void iowrite32be(u32 datum, void __iomem *addr) } } +void iowrite64(u64 datum, void __iomem *addr) +{ + if (unlikely(INDIRECT_ADDR(addr))) { + iomap_ops[ADDR_TO_REGION(addr)]->write64(datum, addr); + } else { + *((u64 *)addr) = cpu_to_le64(datum); + } +} + +void iowrite64be(u64 datum, void __iomem *addr) +{ + if (unlikely(INDIRECT_ADDR(addr))) { + iomap_ops[ADDR_TO_REGION(addr)]->write64be(datum, addr); + } else { + *((u64 *)addr) = datum; + } +} + /* Repeating interfaces */ void ioread8_rep(void __iomem *addr, void *dst, unsigned long count) @@ -449,11 +509,15 @@ EXPORT_SYMBOL(ioread16); EXPORT_SYMBOL(ioread16be); EXPORT_SYMBOL(ioread32); EXPORT_SYMBOL(ioread32be); +EXPORT_SYMBOL(ioread64); +EXPORT_SYMBOL(ioread64be); EXPORT_SYMBOL(iowrite8); EXPORT_SYMBOL(iowrite16); EXPORT_SYMBOL(iowrite16be); EXPORT_SYMBOL(iowrite32); EXPORT_SYMBOL(iowrite32be); +EXPORT_SYMBOL(iowrite64); +EXPORT_SYMBOL(iowrite64be); EXPORT_SYMBOL(ioread8_rep); EXPORT_SYMBOL(ioread16_rep); EXPORT_SYMBOL(ioread32_rep); From patchwork Fri Nov 30 17:06:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 10706857 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CD83513A4 for ; Fri, 30 Nov 2018 17:06:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B7E37304E5 for ; Fri, 30 Nov 2018 17:06:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB8BD304E4; Fri, 30 Nov 2018 17:06:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02DC5304E5 for ; Fri, 30 Nov 2018 17:06:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 529606B5946; Fri, 30 Nov 2018 12:06:20 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 43BB06B5947; Fri, 30 Nov 2018 12:06:20 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 28D076B5949; Fri, 30 Nov 2018 12:06:20 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-io1-f69.google.com (mail-io1-f69.google.com [209.85.166.69]) by kanga.kvack.org (Postfix) with ESMTP id EEA026B5946 for ; Fri, 30 Nov 2018 12:06:19 -0500 (EST) Received: by mail-io1-f69.google.com with SMTP id k4so6081077ioc.10 for ; Fri, 30 Nov 2018 09:06:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :date:message-id:in-reply-to:references:mime-version :content-transfer-encoding:subject; bh=n6K3JZp3Sv6EziJOAs43HEtQARW9logLUVWDabZXNe8=; b=ZkW3uEC8m+5PpBGu+3PcH2uGBzkLLg4vd9YJFRQxKMw6vnHU7raqJb6Ls2zM1wvTXS CzNcCpxCWY8C2qgc2UYYkVkvjiBwebyL57csuM0tSzFu2UFXdsMmmvIMIFgQony17sVN wrHmmjZYCIzY1Y2M3Bd3C2eV+Ax+j2dAVnazydpxB+hxmg7p6UQf28xzdrQ0r2f9rf1R OmDA+HHbXuaYfDreQuVvkFZZPDK5yNdcK88hxf/PRxFqsJVuHrNjwxepkIKSM9JiAjVF K6aO7a7uENjwIpHvnbf8OwAOlZ+NiHLfRQ/ah1zsckqxpstCpzqWzyx1GLLdaDHOZMBL eY6w== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of gunthorp@deltatee.com designates 207.54.116.67 as permitted sender) smtp.mailfrom=gunthorp@deltatee.com X-Gm-Message-State: AA+aEWY97wFPA7uMxXFCy3ZsJ6/qWPC4III84WY7sZIAYhDJLECNrGkB HHiKGy8fYiuTn1mzqOY2jcq1xJm5DY1OoMhYROgjpj0smUVRjE5WLSP1pMepDWkIYexw5agSBBy x2DChzymjUr0QRgFNOAjCYPDOyAWL3baLqsoGm4d9uZa8e0hlQpwHkABggpdkxHBRwg== X-Received: by 2002:a24:a08a:: with SMTP id o132mr6037669ite.1.1543597579739; Fri, 30 Nov 2018 09:06:19 -0800 (PST) X-Google-Smtp-Source: AFSGD/XO5HfVQ7ErxhRsxP/uyPf+yiBO41jJ6NFusxjgZ3jkIoMTIWp88I/b7gIgAQ7LAGtf9vgC X-Received: by 2002:a24:a08a:: with SMTP id o132mr6037613ite.1.1543597578958; Fri, 30 Nov 2018 09:06:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543597578; cv=none; d=google.com; s=arc-20160816; b=KmX22eOcwrQJx7+EP1VG+ixac/jsLdkX0imMgzovn71txkrZPO7PPMW+yRQ6Y5F5OG u4nnRWnroUEeqj5x9HpTb6BFpDVc4nrMDBlke25+dMBkNldg15nXoTUa4+baRyxcMuJk sknSUDQvZQX3pUoRk7y3dwchX4tKx7JPglZgZhxfBGAHmwQD+Jiuu+GWLyATP6LoBrcJ u6iGBszm4ZdMaRrCm2JmYn3EoLAzuI+DWIqw8GL2YoCYj5KDP5yWe84JpiYRacxENjI8 40Z4S6B8hJL6m7fRgAjtrYqLg8cjfDcAc8c5FpIq3HRfJQe3G2XUdW05jCy1YIQNBtQE bhgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:cc:to:from; bh=n6K3JZp3Sv6EziJOAs43HEtQARW9logLUVWDabZXNe8=; b=qov4zTCHasJLhrwfxqNAu8TztEX+2hPlwPhk99/PK5YgO5oGV2dx4RneMeEgYzQK5M 7lnAlP62k02VbhIlTzyL1DMpy9z+a+ojcWEioj5xfClSLjLH+u333/Rxvv2m95dof0/P SHnH8tuqbU0SLxgkeFzaxuAWGirHn5OzaAewBD2Sn3Fqvep/LxF7M3IcfxNyDkmlUWJE 3NxXDimPDvXI0K1+BMwtkPMx+4nFXgpCCK44+mPtwxeqqNkyiwEogvv9tuCuBuGMC1oW PH2U3QnOP1kzsLoSDzeUsX3SZ6d2yvgDlUiSrsRIlQHFBeRl8DicFJIubajpX+vpHXjV /2xQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gunthorp@deltatee.com designates 207.54.116.67 as permitted sender) smtp.mailfrom=gunthorp@deltatee.com Received: from ale.deltatee.com (ale.deltatee.com. [207.54.116.67]) by mx.google.com with ESMTPS id j204si3269505iof.88.2018.11.30.09.06.18 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 09:06:18 -0800 (PST) Received-SPF: pass (google.com: domain of gunthorp@deltatee.com designates 207.54.116.67 as permitted sender) client-ip=207.54.116.67; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gunthorp@deltatee.com designates 207.54.116.67 as permitted sender) smtp.mailfrom=gunthorp@deltatee.com Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gSmF4-0000qo-2F; Fri, 30 Nov 2018 10:06:17 -0700 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1gSmEx-0004VC-Mv; Fri, 30 Nov 2018 10:06:07 -0700 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-ntb@googlegroups.com, linux-crypto@vger.kernel.org, linux-mm@kvack.org, Andrew Morton Cc: Arnd Bergmann , Greg Kroah-Hartman , Andy Shevchenko , =?utf-8?q?Horia_Geant=C4=83?= , Logan Gunthorpe , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Suresh Warrier , Nicholas Piggin Date: Fri, 30 Nov 2018 10:06:03 -0700 Message-Id: <20181130170606.17252-4-logang@deltatee.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181130170606.17252-1-logang@deltatee.com> References: <20181130170606.17252-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-crypto@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, arnd@arndb.de, gregkh@linuxfoundation.org, horia.geanta@nxp.com, logang@deltatee.com, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, warrier@linux.vnet.ibm.com, andy.shevchenko@gmail.com, npiggin@gmail.com X-SA-Exim-Mail-From: gunthorp@deltatee.com Subject: [PATCH v24 3/6] iomap: introduce io{read|write}64_{lo_hi|hi_lo} X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP In order to provide non-atomic functions for io{read|write}64 that will use readq and writeq when appropriate. We define a number of variants of these functions in the generic iomap that will do non-atomic operations on pio but atomic operations on mmio. These functions are only defined if readq and writeq are defined. If they are not, then the wrappers that always use non-atomic operations from include/linux/io-64-nonatomic*.h will be used. Signed-off-by: Logan Gunthorpe Reviewed-by: Andy Shevchenko Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Arnd Bergmann Cc: Suresh Warrier Cc: Nicholas Piggin --- arch/powerpc/include/asm/io.h | 2 + include/asm-generic/iomap.h | 22 ++++++ lib/iomap.c | 132 ++++++++++++++++++++++++++++++++++ 3 files changed, 156 insertions(+) diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h index e746becd9d6f..093a61795b14 100644 --- a/arch/powerpc/include/asm/io.h +++ b/arch/powerpc/include/asm/io.h @@ -781,8 +781,10 @@ extern void __iounmap_at(void *ea, unsigned long size); #define mmio_read16be(addr) readw_be(addr) #define mmio_read32be(addr) readl_be(addr) +#define mmio_read64be(addr) readq_be(addr) #define mmio_write16be(val, addr) writew_be(val, addr) #define mmio_write32be(val, addr) writel_be(val, addr) +#define mmio_write64be(val, addr) writeq_be(val, addr) #define mmio_insb(addr, dst, count) readsb(addr, dst, count) #define mmio_insw(addr, dst, count) readsw(addr, dst, count) #define mmio_insl(addr, dst, count) readsl(addr, dst, count) diff --git a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h index 5b63b94ef6b5..a008f504a2d0 100644 --- a/include/asm-generic/iomap.h +++ b/include/asm-generic/iomap.h @@ -36,6 +36,17 @@ extern u64 ioread64(void __iomem *); extern u64 ioread64be(void __iomem *); #endif +#ifdef readq +#define ioread64_lo_hi ioread64_lo_hi +#define ioread64_hi_lo ioread64_hi_lo +#define ioread64be_lo_hi ioread64be_lo_hi +#define ioread64be_hi_lo ioread64be_hi_lo +extern u64 ioread64_lo_hi(void __iomem *addr); +extern u64 ioread64_hi_lo(void __iomem *addr); +extern u64 ioread64be_lo_hi(void __iomem *addr); +extern u64 ioread64be_hi_lo(void __iomem *addr); +#endif + extern void iowrite8(u8, void __iomem *); extern void iowrite16(u16, void __iomem *); extern void iowrite16be(u16, void __iomem *); @@ -46,6 +57,17 @@ extern void iowrite64(u64, void __iomem *); extern void iowrite64be(u64, void __iomem *); #endif +#ifdef writeq +#define iowrite64_lo_hi iowrite64_lo_hi +#define iowrite64_hi_lo iowrite64_hi_lo +#define iowrite64be_lo_hi iowrite64be_lo_hi +#define iowrite64be_hi_lo iowrite64be_hi_lo +extern void iowrite64_lo_hi(u64 val, void __iomem *addr); +extern void iowrite64_hi_lo(u64 val, void __iomem *addr); +extern void iowrite64be_lo_hi(u64 val, void __iomem *addr); +extern void iowrite64be_hi_lo(u64 val, void __iomem *addr); +#endif + /* * "string" versions of the above. Note that they * use native byte ordering for the accesses (on diff --git a/lib/iomap.c b/lib/iomap.c index 2c293b22569f..e909ab71e995 100644 --- a/lib/iomap.c +++ b/lib/iomap.c @@ -67,6 +67,7 @@ static void bad_io_access(unsigned long port, const char *access) #ifndef mmio_read16be #define mmio_read16be(addr) swab16(readw(addr)) #define mmio_read32be(addr) swab32(readl(addr)) +#define mmio_read64be(addr) swab64(readq(addr)) #endif unsigned int ioread8(void __iomem *addr) @@ -100,6 +101,80 @@ EXPORT_SYMBOL(ioread16be); EXPORT_SYMBOL(ioread32); EXPORT_SYMBOL(ioread32be); +#ifdef readq +static u64 pio_read64_lo_hi(unsigned long port) +{ + u64 lo, hi; + + lo = inl(port); + hi = inl(port + sizeof(u32)); + + return lo | (hi << 32); +} + +static u64 pio_read64_hi_lo(unsigned long port) +{ + u64 lo, hi; + + hi = inl(port + sizeof(u32)); + lo = inl(port); + + return lo | (hi << 32); +} + +static u64 pio_read64be_lo_hi(unsigned long port) +{ + u64 lo, hi; + + lo = pio_read32be(port + sizeof(u32)); + hi = pio_read32be(port); + + return lo | (hi << 32); +} + +static u64 pio_read64be_hi_lo(unsigned long port) +{ + u64 lo, hi; + + hi = pio_read32be(port); + lo = pio_read32be(port + sizeof(u32)); + + return lo | (hi << 32); +} + +u64 ioread64_lo_hi(void __iomem *addr) +{ + IO_COND(addr, return pio_read64_lo_hi(port), return readq(addr)); + return 0xffffffffffffffffULL; +} + +u64 ioread64_hi_lo(void __iomem *addr) +{ + IO_COND(addr, return pio_read64_hi_lo(port), return readq(addr)); + return 0xffffffffffffffffULL; +} + +u64 ioread64be_lo_hi(void __iomem *addr) +{ + IO_COND(addr, return pio_read64be_lo_hi(port), + return mmio_read64be(addr)); + return 0xffffffffffffffffULL; +} + +u64 ioread64be_hi_lo(void __iomem *addr) +{ + IO_COND(addr, return pio_read64be_hi_lo(port), + return mmio_read64be(addr)); + return 0xffffffffffffffffULL; +} + +EXPORT_SYMBOL(ioread64_lo_hi); +EXPORT_SYMBOL(ioread64_hi_lo); +EXPORT_SYMBOL(ioread64be_lo_hi); +EXPORT_SYMBOL(ioread64be_hi_lo); + +#endif /* readq */ + #ifndef pio_write16be #define pio_write16be(val,port) outw(swab16(val),port) #define pio_write32be(val,port) outl(swab32(val),port) @@ -108,6 +183,7 @@ EXPORT_SYMBOL(ioread32be); #ifndef mmio_write16be #define mmio_write16be(val,port) writew(swab16(val),port) #define mmio_write32be(val,port) writel(swab32(val),port) +#define mmio_write64be(val,port) writeq(swab64(val),port) #endif void iowrite8(u8 val, void __iomem *addr) @@ -136,6 +212,62 @@ EXPORT_SYMBOL(iowrite16be); EXPORT_SYMBOL(iowrite32); EXPORT_SYMBOL(iowrite32be); +#ifdef writeq +static void pio_write64_lo_hi(u64 val, unsigned long port) +{ + outl(val, port); + outl(val >> 32, port + sizeof(u32)); +} + +static void pio_write64_hi_lo(u64 val, unsigned long port) +{ + outl(val >> 32, port + sizeof(u32)); + outl(val, port); +} + +static void pio_write64be_lo_hi(u64 val, unsigned long port) +{ + pio_write32be(val, port + sizeof(u32)); + pio_write32be(val >> 32, port); +} + +static void pio_write64be_hi_lo(u64 val, unsigned long port) +{ + pio_write32be(val >> 32, port); + pio_write32be(val, port + sizeof(u32)); +} + +void iowrite64_lo_hi(u64 val, void __iomem *addr) +{ + IO_COND(addr, pio_write64_lo_hi(val, port), + writeq(val, addr)); +} + +void iowrite64_hi_lo(u64 val, void __iomem *addr) +{ + IO_COND(addr, pio_write64_hi_lo(val, port), + writeq(val, addr)); +} + +void iowrite64be_lo_hi(u64 val, void __iomem *addr) +{ + IO_COND(addr, pio_write64be_lo_hi(val, port), + mmio_write64be(val, addr)); +} + +void iowrite64be_hi_lo(u64 val, void __iomem *addr) +{ + IO_COND(addr, pio_write64be_hi_lo(val, port), + mmio_write64be(val, addr)); +} + +EXPORT_SYMBOL(iowrite64_lo_hi); +EXPORT_SYMBOL(iowrite64_hi_lo); +EXPORT_SYMBOL(iowrite64be_lo_hi); +EXPORT_SYMBOL(iowrite64be_hi_lo); + +#endif /* readq */ + /* * These are the "repeat MMIO read/write" functions. * Note the "__raw" accesses, since we don't want to From patchwork Fri Nov 30 17:06:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 10706845 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8BC301057 for ; Fri, 30 Nov 2018 17:06:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 75DE2304E1 for ; Fri, 30 Nov 2018 17:06:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 69840304C0; Fri, 30 Nov 2018 17:06:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1CB5304E5 for ; Fri, 30 Nov 2018 17:06:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 836D26B594A; Fri, 30 Nov 2018 12:06:16 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6A7FE6B5945; Fri, 30 Nov 2018 12:06:16 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 39D426B5944; Fri, 30 Nov 2018 12:06:16 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-it1-f198.google.com (mail-it1-f198.google.com [209.85.166.198]) by kanga.kvack.org (Postfix) with ESMTP id 07EF76B5945 for ; Fri, 30 Nov 2018 12:06:16 -0500 (EST) Received: by mail-it1-f198.google.com with SMTP id o205so7473346itc.2 for ; Fri, 30 Nov 2018 09:06:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :date:message-id:in-reply-to:references:mime-version :content-transfer-encoding:subject; bh=lsSY068Z2TOKg3DjpjoNDSjNTjUW3yjInOZnxJ+Zc0Y=; b=qHzLVRGwHz/nIKoLL688VfCiEsg2Cq6WjhBB+/CsIHKSLfRcGY8fXmGRgjmJjs/5Im gvz6icyV1kjKc0ZW9kgu6XRvDhMkkvea9B6j32v3nhF5+KR/pWT66Dww7iSFtM7omZZ/ Yftw00FW0MRtNl5vBxmVZuCdcKIkH8kyK+GFZKTFA+nlb+B2ocTex29/sfrdV0fiPEOD jLN2YJ3m8jH0NofDUZFwWfoB8IPRdowbxgvcbbU9dIphy6WuWH9IG/1yrrSU5WkpYoa1 i7uqORumbMK7JSAEri095cxqq/VQqSc1S2pKuA/CRks183i7R5SesiDrSn+mzSe/1YVI F1Xw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of gunthorp@deltatee.com designates 207.54.116.67 as permitted sender) smtp.mailfrom=gunthorp@deltatee.com X-Gm-Message-State: AA+aEWa4e4AuIKpycCXlwKl4dPkAk65yUp1vsR1raPREVcmmun+7FbtQ gD4qeF8BZkz2OGaK8LRWjIuCuX41ZaJyIITLF+/KGZ7kVwGy7jZc0XdQWPQDLtLPwfAKQfCzZ5f T9lVlNQOMemdjJZScAe/tr7NThgT+FwygDeEIPO+UAqP7HCvYnjr8dXymhcbSjP9uyA== X-Received: by 2002:a05:660c:684:: with SMTP id n4mr375861itk.64.1543597575793; Fri, 30 Nov 2018 09:06:15 -0800 (PST) X-Google-Smtp-Source: AFSGD/X9xhcGDDu78t338NuYoBkIcKP5wtkznlNwkN7YNG6+J4SA+YmL9GGWrQwXuCA1uWX0lAGY X-Received: by 2002:a05:660c:684:: with SMTP id n4mr375801itk.64.1543597574786; Fri, 30 Nov 2018 09:06:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543597574; cv=none; d=google.com; s=arc-20160816; b=pB33aweLW1jhWeukEkgxVKRY3nF0QL31LLbTMBRJU57DrJTWo/Nz2tRT0hWTtkagXR t1aCjZsz7iKoLnV7u1artdhB+54blX3sAVr2rIxV5Vu6VQeHs6VGv2bnbxJNQWq+3FU4 JMRUjjvXUT5CBlxxBlmXcWvWqz/6J/7r5r+/QrRxHWO9L557mDhqGiX46jhLvaqG2UOk PvkldcOoNmehzeB8WY5H6w0X2I3f8bf06n0f0eBekbWOwkMRtK3IVK1BEyMPYgxaY0ue BUXPqOpabFvz6bq9YoUXZ9OA+OclIMZC222uDxHDXIWq/zccyXOlJvq0T++vnI+Bqg+Q 4MRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:cc:to:from; bh=lsSY068Z2TOKg3DjpjoNDSjNTjUW3yjInOZnxJ+Zc0Y=; b=HQuj/H9kx17bI4DnRWIKGAOXZvkxlJQ0Ar04wtl9TWCt8Ji7ZhILnYQBVXQkeUl3S1 BAEwMb4+Fh5N2OG1/pEalRfs+4aVCJGuDsXWlOswXcdNBarUIE5yeBfarKLZILBXPaQR soRuC1ZttXr2K/f6HWxL0/3m0TehaY+DmwnMpg0XGb4A2ePmXLbJRQeBEnhwXELE2knR 0EmLrYy2FGleslGJLq/42HDanD+eAPpBLjLtRv3ib7As/tul2SZOjPRM7+ttVrfattNZ SfDHdNEpYc4IfwQfvXx5hqELMYKmKgioa5kS1cuXUJlArDeUM2oMvYy8cipYh7JPHYg9 yvng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gunthorp@deltatee.com designates 207.54.116.67 as permitted sender) smtp.mailfrom=gunthorp@deltatee.com Received: from ale.deltatee.com (ale.deltatee.com. [207.54.116.67]) by mx.google.com with ESMTPS id t134si3570859itf.66.2018.11.30.09.06.14 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 09:06:14 -0800 (PST) Received-SPF: pass (google.com: domain of gunthorp@deltatee.com designates 207.54.116.67 as permitted sender) client-ip=207.54.116.67; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gunthorp@deltatee.com designates 207.54.116.67 as permitted sender) smtp.mailfrom=gunthorp@deltatee.com Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gSmEz-0000qp-Tp; Fri, 30 Nov 2018 10:06:12 -0700 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1gSmEx-0004VF-Pp; Fri, 30 Nov 2018 10:06:07 -0700 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-ntb@googlegroups.com, linux-crypto@vger.kernel.org, linux-mm@kvack.org, Andrew Morton Cc: Arnd Bergmann , Greg Kroah-Hartman , Andy Shevchenko , =?utf-8?q?Horia_Geant=C4=83?= , Logan Gunthorpe , Christoph Hellwig , Alan Cox Date: Fri, 30 Nov 2018 10:06:04 -0700 Message-Id: <20181130170606.17252-5-logang@deltatee.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181130170606.17252-1-logang@deltatee.com> References: <20181130170606.17252-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-crypto@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, arnd@arndb.de, gregkh@linuxfoundation.org, andy.shevchenko@gmail.com, horia.geanta@nxp.com, logang@deltatee.com, hch@lst.de, gnomes@lxorguk.ukuu.org.uk X-SA-Exim-Mail-From: gunthorp@deltatee.com Subject: [PATCH v24 4/6] io-64-nonatomic: add io{read|write}64[be]{_lo_hi|_hi_lo} macros X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP This patch adds generic io{read|write}64[be]{_lo_hi|_hi_lo} macros if they are not already defined by the architecture. (As they are provided by the generic iomap library). The patch also points io{read|write}64[be] to the variant specified by the header name. This is because new drivers are encouraged to use ioreadXX, et al instead of readX[1], et al -- and mixing ioreadXX with readq is pretty ugly. [1] LDD3: section 9.4.2 Signed-off-by: Logan Gunthorpe Reviewed-by: Andy Shevchenko Cc: Christoph Hellwig Cc: Arnd Bergmann Cc: Alan Cox Cc: Greg Kroah-Hartman --- include/linux/io-64-nonatomic-hi-lo.h | 64 +++++++++++++++++++++++++++ include/linux/io-64-nonatomic-lo-hi.h | 64 +++++++++++++++++++++++++++ 2 files changed, 128 insertions(+) diff --git a/include/linux/io-64-nonatomic-hi-lo.h b/include/linux/io-64-nonatomic-hi-lo.h index 862d786a904f..ae21b72cce85 100644 --- a/include/linux/io-64-nonatomic-hi-lo.h +++ b/include/linux/io-64-nonatomic-hi-lo.h @@ -55,4 +55,68 @@ static inline void hi_lo_writeq_relaxed(__u64 val, volatile void __iomem *addr) #define writeq_relaxed hi_lo_writeq_relaxed #endif +#ifndef ioread64_hi_lo +#define ioread64_hi_lo ioread64_hi_lo +static inline u64 ioread64_hi_lo(void __iomem *addr) +{ + u32 low, high; + + high = ioread32(addr + sizeof(u32)); + low = ioread32(addr); + + return low + ((u64)high << 32); +} +#endif + +#ifndef iowrite64_hi_lo +#define iowrite64_hi_lo iowrite64_hi_lo +static inline void iowrite64_hi_lo(u64 val, void __iomem *addr) +{ + iowrite32(val >> 32, addr + sizeof(u32)); + iowrite32(val, addr); +} +#endif + +#ifndef ioread64be_hi_lo +#define ioread64be_hi_lo ioread64be_hi_lo +static inline u64 ioread64be_hi_lo(void __iomem *addr) +{ + u32 low, high; + + high = ioread32be(addr); + low = ioread32be(addr + sizeof(u32)); + + return low + ((u64)high << 32); +} +#endif + +#ifndef iowrite64be_hi_lo +#define iowrite64be_hi_lo iowrite64be_hi_lo +static inline void iowrite64be_hi_lo(u64 val, void __iomem *addr) +{ + iowrite32be(val >> 32, addr); + iowrite32be(val, addr + sizeof(u32)); +} +#endif + +#ifndef ioread64 +#define ioread64_is_nonatomic +#define ioread64 ioread64_hi_lo +#endif + +#ifndef iowrite64 +#define iowrite64_is_nonatomic +#define iowrite64 iowrite64_hi_lo +#endif + +#ifndef ioread64be +#define ioread64be_is_nonatomic +#define ioread64be ioread64be_hi_lo +#endif + +#ifndef iowrite64be +#define iowrite64be_is_nonatomic +#define iowrite64be iowrite64be_hi_lo +#endif + #endif /* _LINUX_IO_64_NONATOMIC_HI_LO_H_ */ diff --git a/include/linux/io-64-nonatomic-lo-hi.h b/include/linux/io-64-nonatomic-lo-hi.h index d042e7bb5adb..faaa842dbdb9 100644 --- a/include/linux/io-64-nonatomic-lo-hi.h +++ b/include/linux/io-64-nonatomic-lo-hi.h @@ -55,4 +55,68 @@ static inline void lo_hi_writeq_relaxed(__u64 val, volatile void __iomem *addr) #define writeq_relaxed lo_hi_writeq_relaxed #endif +#ifndef ioread64_lo_hi +#define ioread64_lo_hi ioread64_lo_hi +static inline u64 ioread64_lo_hi(void __iomem *addr) +{ + u32 low, high; + + low = ioread32(addr); + high = ioread32(addr + sizeof(u32)); + + return low + ((u64)high << 32); +} +#endif + +#ifndef iowrite64_lo_hi +#define iowrite64_lo_hi iowrite64_lo_hi +static inline void iowrite64_lo_hi(u64 val, void __iomem *addr) +{ + iowrite32(val, addr); + iowrite32(val >> 32, addr + sizeof(u32)); +} +#endif + +#ifndef ioread64be_lo_hi +#define ioread64be_lo_hi ioread64be_lo_hi +static inline u64 ioread64be_lo_hi(void __iomem *addr) +{ + u32 low, high; + + low = ioread32be(addr + sizeof(u32)); + high = ioread32be(addr); + + return low + ((u64)high << 32); +} +#endif + +#ifndef iowrite64be_lo_hi +#define iowrite64be_lo_hi iowrite64be_lo_hi +static inline void iowrite64be_lo_hi(u64 val, void __iomem *addr) +{ + iowrite32be(val, addr + sizeof(u32)); + iowrite32be(val >> 32, addr); +} +#endif + +#ifndef ioread64 +#define ioread64_is_nonatomic +#define ioread64 ioread64_lo_hi +#endif + +#ifndef iowrite64 +#define iowrite64_is_nonatomic +#define iowrite64 iowrite64_lo_hi +#endif + +#ifndef ioread64be +#define ioread64be_is_nonatomic +#define ioread64be ioread64be_lo_hi +#endif + +#ifndef iowrite64be +#define iowrite64be_is_nonatomic +#define iowrite64be iowrite64be_lo_hi +#endif + #endif /* _LINUX_IO_64_NONATOMIC_LO_HI_H_ */ From patchwork Fri Nov 30 17:06:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 10706839 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6057C13A4 for ; Fri, 30 Nov 2018 17:06:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45441304EC for ; Fri, 30 Nov 2018 17:06:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3937A304ED; Fri, 30 Nov 2018 17:06:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B1DA304EE for ; Fri, 30 Nov 2018 17:06:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 91D0C6B5942; Fri, 30 Nov 2018 12:06:14 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8CAD96B5943; Fri, 30 Nov 2018 12:06:14 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7BB296B5944; Fri, 30 Nov 2018 12:06:14 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-it1-f199.google.com (mail-it1-f199.google.com [209.85.166.199]) by kanga.kvack.org (Postfix) with ESMTP id 51BD26B5942 for ; Fri, 30 Nov 2018 12:06:14 -0500 (EST) Received: by mail-it1-f199.google.com with SMTP id p66so7498450itc.0 for ; Fri, 30 Nov 2018 09:06:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :date:message-id:in-reply-to:references:mime-version :content-transfer-encoding:subject; bh=SdqQCyo/3b5sF4K7Vmst/Hr2uAmNHk0FnK7+2EjSr4w=; b=SLAL1Kfu0n1HJZj77+XQGb8HrXVOut16xmnO1NozmzeuPQ143lu1neXy9eTEayJzig B+4BD48j6vHwZgHCYjHTBHsZfEASBDNC1ALK9yCPYzoWHk0TzgX/LXjPn+KrDUZS0dvH cYRY9AzZ2a346bl/PS0/EVsEy/JRPZr/Njy1dIL9pKFmjqQxUceNDGEafujRkjS0XRtY 0b1AUSDrSZB8pSjpfZap8283YrrhGGxcc1+nmS8DRocA922Hy6T571bLdZhUJ1F0dVg4 vomK4pZsUZ3U9C9vDJ/xW17RUokETXVBECQ8FfNuH7sxPD1bkJgtsvYyXE2xD8Vl9EAb 9swA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of gunthorp@deltatee.com designates 207.54.116.67 as permitted sender) smtp.mailfrom=gunthorp@deltatee.com X-Gm-Message-State: AA+aEWYfof0vxTqofIBPjAedObFd9XdI0Grq9E42OYV+RudkBnEUI15i mNhShtuvdyQwVO9b3X9NDX64ozwFyMaq8UaL7A27INK3emlzYHOaye4L6VrZ90r8qGfOyaroPfM 4AwA3aMwfYQ3g68QDovhCXf5HfU8yqrRJTDlRjiLlMVFUV+C/kCvXu9BK1ym9OeFsNg== X-Received: by 2002:a24:c187:: with SMTP id e129mr6576204itg.68.1543597574090; Fri, 30 Nov 2018 09:06:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/XienR++H7w7TSgowOgfy6zaz2C87ui2tQUrhB4BQL1NGhljGj2w/jALGaa+yyt1Uu3mcPc X-Received: by 2002:a24:c187:: with SMTP id e129mr6576144itg.68.1543597573152; Fri, 30 Nov 2018 09:06:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543597573; cv=none; d=google.com; s=arc-20160816; b=jTR4cQLwoI21lxOkbpPACvofXzci7fhkxSPJGRPbt9adXleJEbpYHMxZNlpzJKi8Zd 8zw7wh4IU7I53j9CGpmWKoQB0WyVRPlpsayNLS7gLnb98v6qs9OLUQsSprswIjbjy4UE kdq5d7FXifxlk/g7AQ4sIgxINDSc77B/kiAhsSkOYJyZ3V/yh7na94unSTBLC4nm/Z8G tOceSpjq9/chP9UDUaiSBXzV1Kqc65QmZx6qfrhUs6pGNM4x4zHHLs/wY0l5+CMDg901 LqMzDEUkYSimsBOPRvZfs9gK2cB+SuN3/3OpKTgmNB1nqM1U9tq2eR/73rAEpb7D1Vho G7bA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:cc:to:from; bh=SdqQCyo/3b5sF4K7Vmst/Hr2uAmNHk0FnK7+2EjSr4w=; b=JGaM58QIfJ7buat1Kl9kR1E6N26uByMZrMEgvD/bMpRKRNQwA7o06N1ayozMCSpM+t ewk76oaUJHnIhqExQB4uKMbrklM1E+6mU/87PDZrdy6w2Un5yBxo479Xpos6SVDoZsqt xt3vSXDPfH+GL3e+GoPXRQ49LSNTIFstDp8cUI7NSlFSwYQvVWtzMR7A/KkygA4u4aKV o0kVP92wp1n+SDW71aNZr4110e02z5fS4XZBUs0OCZi0oEHPCyT3O3BNxb2MIJDPGQmc gDLMAQ9j+7yVAq0Ir9YTZsu3gyn72T0gUOCMGDjA4J8pTconjem5DM5np3Ssf2Dpy7iu ol8g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gunthorp@deltatee.com designates 207.54.116.67 as permitted sender) smtp.mailfrom=gunthorp@deltatee.com Received: from ale.deltatee.com (ale.deltatee.com. [207.54.116.67]) by mx.google.com with ESMTPS id z83si3601667itc.56.2018.11.30.09.06.12 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 09:06:13 -0800 (PST) Received-SPF: pass (google.com: domain of gunthorp@deltatee.com designates 207.54.116.67 as permitted sender) client-ip=207.54.116.67; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gunthorp@deltatee.com designates 207.54.116.67 as permitted sender) smtp.mailfrom=gunthorp@deltatee.com Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gSmEz-0000qq-3E; Fri, 30 Nov 2018 10:06:10 -0700 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1gSmEx-0004VI-So; Fri, 30 Nov 2018 10:06:07 -0700 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-ntb@googlegroups.com, linux-crypto@vger.kernel.org, linux-mm@kvack.org, Andrew Morton Cc: Arnd Bergmann , Greg Kroah-Hartman , Andy Shevchenko , =?utf-8?q?Horia_Geant=C4=83?= , Logan Gunthorpe Date: Fri, 30 Nov 2018 10:06:05 -0700 Message-Id: <20181130170606.17252-6-logang@deltatee.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181130170606.17252-1-logang@deltatee.com> References: <20181130170606.17252-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-crypto@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, arnd@arndb.de, gregkh@linuxfoundation.org, andy.shevchenko@gmail.com, horia.geanta@nxp.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com Subject: [PATCH v24 5/6] ntb: ntb_hw_intel: use io-64-nonatomic instead of in-driver hacks X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Now that ioread64 and iowrite64 are available in io-64-nonatomic, we can remove the hack at the top of ntb_hw_intel.c and replace it with an include. Signed-off-by: Logan Gunthorpe Reviewed-by: Andy Shevchenko Acked-by: Dave Jiang Acked-by: Allen Hubbe Acked-by: Jon Mason --- drivers/ntb/hw/intel/ntb_hw_intel.h | 30 +---------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/drivers/ntb/hw/intel/ntb_hw_intel.h b/drivers/ntb/hw/intel/ntb_hw_intel.h index c49ff8970ce3..e071e28bca3f 100644 --- a/drivers/ntb/hw/intel/ntb_hw_intel.h +++ b/drivers/ntb/hw/intel/ntb_hw_intel.h @@ -53,6 +53,7 @@ #include #include +#include /* PCI device IDs */ #define PCI_DEVICE_ID_INTEL_NTB_B2B_JSF 0x3725 @@ -218,33 +219,4 @@ static inline int pdev_is_gen3(struct pci_dev *pdev) return 0; } -#ifndef ioread64 -#ifdef readq -#define ioread64 readq -#else -#define ioread64 _ioread64 -static inline u64 _ioread64(void __iomem *mmio) -{ - u64 low, high; - - low = ioread32(mmio); - high = ioread32(mmio + sizeof(u32)); - return low | (high << 32); -} -#endif -#endif - -#ifndef iowrite64 -#ifdef writeq -#define iowrite64 writeq -#else -#define iowrite64 _iowrite64 -static inline void _iowrite64(u64 val, void __iomem *mmio) -{ - iowrite32(val, mmio); - iowrite32(val >> 32, mmio + sizeof(u32)); -} -#endif -#endif - #endif From patchwork Fri Nov 30 17:06:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 10706843 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6D84C1057 for ; Fri, 30 Nov 2018 17:06:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 584FF304EE for ; Fri, 30 Nov 2018 17:06:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B7E0304E4; Fri, 30 Nov 2018 17:06:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4DBA304C0 for ; Fri, 30 Nov 2018 17:06:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3A0AF6B5948; Fri, 30 Nov 2018 12:06:16 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 2B38C6B5947; Fri, 30 Nov 2018 12:06:16 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1604D6B5946; Fri, 30 Nov 2018 12:06:16 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-io1-f70.google.com (mail-io1-f70.google.com [209.85.166.70]) by kanga.kvack.org (Postfix) with ESMTP id D51246B5943 for ; Fri, 30 Nov 2018 12:06:15 -0500 (EST) Received: by mail-io1-f70.google.com with SMTP id x5so6123047ion.1 for ; Fri, 30 Nov 2018 09:06:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :date:message-id:in-reply-to:references:mime-version :content-transfer-encoding:subject; bh=xiVzrMixx22L0jVuC4/GHg9aSUVemvSKbhxTFU+QSeQ=; b=N0ryL6JvzVwJOUpaeUCov361rt6/mVdZS0Xk8DB0U+DU7m6w5imVI4htsdlFlei7Gs oC0YCsMmlJlVUsCpJULcsXD96saGia4hJDidMaGaj2HPjlmZrU2UKdkWfML5rHheUmMJ JjSbwTePZDd941IAJONwSEPLjsVqXSWFnX6YJEfBy+GGJ+mCju6yKORfMk503IFPfPOS GSH2qeIDgBBeNIMGydzY4k7CK5Nd4JBU/cx/DIjs6GmA05ZgOIrzaKfYlqu7Fnt7Ns87 2yQ2e08gtxgrwgs+Yyu/35vsJs9LNAa+V9Yf42UayZ3CRefkbhxrvhKaZEpXbl7KePIL hx1A== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of gunthorp@deltatee.com designates 207.54.116.67 as permitted sender) smtp.mailfrom=gunthorp@deltatee.com X-Gm-Message-State: AA+aEWZiAH+3kaQOx+8Cgg2HX1rGXW1hNIU08mLmO94wrwSVXrJgBqc9 apDuhCPTTEYJ+BKwhwPi+eJR9jlSF4ZzqrdZf4UQzKBsxj20vTZcOZWE2NyK96QDqncUU+NPam0 N4crbeEQVk2DqaHgfL9Hm58yBCcUHGDP+a4VZ/OiPsjbaK+i3AseZDlSCVZ1bwNKYVg== X-Received: by 2002:a24:2fcb:: with SMTP id j194mr6067261itj.56.1543597575659; Fri, 30 Nov 2018 09:06:15 -0800 (PST) X-Google-Smtp-Source: AFSGD/WE9XA2o0z2CarDFLeX2q8eBA99op5SknC3YSp8dH1wD8ssyuWXnzDu46dOB9BXmkC0/UKb X-Received: by 2002:a24:2fcb:: with SMTP id j194mr6067200itj.56.1543597574813; Fri, 30 Nov 2018 09:06:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543597574; cv=none; d=google.com; s=arc-20160816; b=DLcTKmbmDexfWirDbNUFPlefFs8ya3SegQH5ppuQSqddP5CS1hIxW9clPmXBrjQyEj wc0gyvS79wO0kEf1JDMx6kCmh8PQOdDhC2fJn7uEjUaTCWm597dwXHcvzmv6Pld8aA5p 8tnkFn0Qf0XpbOjJdxcBMCbccDLf6sDPAh7GDnO/6frXc+A6/n2TbNsmFhh1WPiDyAGm tyXt/J+9SB2WMTFT/GmO4eE+4LGzqil9w2EMLPDJJwFvKUMghXBKr0bITCkoVZj3BX9e YgFN+PIWExCMYTPx+m692M6IFkKfWuwt8+of6DBqY60Zcg5Dv6Y/1uvTE3npr2/griSu MCsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:cc:to:from; bh=xiVzrMixx22L0jVuC4/GHg9aSUVemvSKbhxTFU+QSeQ=; b=G8HdZ53uKXNNvOvpNP9WRweTxRIf2XrzSlP4xM5Q+j2GTfR9SAymnqMiFS1R4n1Fgg AmtBf3EYH416N4dGK5nB3Bkgs+90ojqdQxPdp6wz0m2pNKlU5xWBurfiM6lbdODoVaHf 91rgtvw78bIY/SWi5N7eK0zax6Z6cla4xi0y14Ldum8MkNAepp6e7LprgSkcFR0I/hBZ aGBMjZsYot9M8y5OujPpJUL6GQ6bA4miHoZPRQbGtCNJ0A3g8M1DkaegLpXEsTPwq6gZ kBuJ5+Vr+SRn/mdfw6TE+JHH6kZxc97L9j1DnyqthxbOVG7KgUeROMwOXGuY88LMoL1F aFow== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gunthorp@deltatee.com designates 207.54.116.67 as permitted sender) smtp.mailfrom=gunthorp@deltatee.com Received: from ale.deltatee.com (ale.deltatee.com. [207.54.116.67]) by mx.google.com with ESMTPS id d81si3604103itc.66.2018.11.30.09.06.14 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 09:06:14 -0800 (PST) Received-SPF: pass (google.com: domain of gunthorp@deltatee.com designates 207.54.116.67 as permitted sender) client-ip=207.54.116.67; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gunthorp@deltatee.com designates 207.54.116.67 as permitted sender) smtp.mailfrom=gunthorp@deltatee.com Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gSmEz-0000qr-9A; Fri, 30 Nov 2018 10:06:11 -0700 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1gSmEx-0004VL-WF; Fri, 30 Nov 2018 10:06:08 -0700 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-ntb@googlegroups.com, linux-crypto@vger.kernel.org, linux-mm@kvack.org, Andrew Morton Cc: Arnd Bergmann , Greg Kroah-Hartman , Andy Shevchenko , =?utf-8?q?Horia_Geant=C4=83?= , Logan Gunthorpe , Jon Mason Date: Fri, 30 Nov 2018 10:06:06 -0700 Message-Id: <20181130170606.17252-7-logang@deltatee.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181130170606.17252-1-logang@deltatee.com> References: <20181130170606.17252-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-crypto@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, arnd@arndb.de, gregkh@linuxfoundation.org, andy.shevchenko@gmail.com, horia.geanta@nxp.com, logang@deltatee.com, jdmason@kudzu.us X-SA-Exim-Mail-From: gunthorp@deltatee.com Subject: [PATCH v24 6/6] ntb: ntb_hw_switchtec: Cleanup 64bit IO defines to use the common header X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Clean up the ifdefs which conditionally defined the io{read|write}64 functions in favour of the new common io-64-nonatomic-lo-hi header. Per a nit from Andy Shevchenko, the include list is also made alphabetical. Signed-off-by: Logan Gunthorpe Reviewed-by: Andy Shevchenko Cc: Jon Mason --- drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 36 +++----------------------- 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c index 5ee5f40b4dfc..c0b97699169d 100644 --- a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c +++ b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c @@ -13,13 +13,14 @@ * */ -#include -#include +#include +#include #include #include -#include +#include #include #include +#include MODULE_DESCRIPTION("Microsemi Switchtec(tm) NTB Driver"); MODULE_VERSION("0.1"); @@ -36,35 +37,6 @@ module_param(use_lut_mws, bool, 0644); MODULE_PARM_DESC(use_lut_mws, "Enable the use of the LUT based memory windows"); -#ifndef ioread64 -#ifdef readq -#define ioread64 readq -#else -#define ioread64 _ioread64 -static inline u64 _ioread64(void __iomem *mmio) -{ - u64 low, high; - - low = ioread32(mmio); - high = ioread32(mmio + sizeof(u32)); - return low | (high << 32); -} -#endif -#endif - -#ifndef iowrite64 -#ifdef writeq -#define iowrite64 writeq -#else -#define iowrite64 _iowrite64 -static inline void _iowrite64(u64 val, void __iomem *mmio) -{ - iowrite32(val, mmio); - iowrite32(val >> 32, mmio + sizeof(u32)); -} -#endif -#endif - #define SWITCHTEC_NTB_MAGIC 0x45CC0001 #define MAX_MWS 128