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_ */