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);