Message ID | 20190116182523.19446-2-logang@deltatee.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 C00901580 for <patchwork-linux-mm@patchwork.kernel.org>; Wed, 16 Jan 2019 18:25:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B1F8D2F3E1 for <patchwork-linux-mm@patchwork.kernel.org>; Wed, 16 Jan 2019 18:25:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A678C2F3F5; Wed, 16 Jan 2019 18:25:43 +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 436F62F3E1 for <patchwork-linux-mm@patchwork.kernel.org>; Wed, 16 Jan 2019 18:25:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9ECE88E000D; Wed, 16 Jan 2019 13:25:35 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 999128E0004; Wed, 16 Jan 2019 13:25:35 -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 887098E000D; Wed, 16 Jan 2019 13:25:35 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-it1-f197.google.com (mail-it1-f197.google.com [209.85.166.197]) by kanga.kvack.org (Postfix) with ESMTP id 60FBA8E0004 for <linux-mm@kvack.org>; Wed, 16 Jan 2019 13:25:35 -0500 (EST) Received: by mail-it1-f197.google.com with SMTP id b14so2503841itd.1 for <linux-mm@kvack.org>; Wed, 16 Jan 2019 10:25:35 -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=RNA+UeGH4DRoBvndbH2LBUy3z2yEmGPSabXSi6c/FVdMj41m/st/BiUsGxPcLBDIv4 6igGTIS3HmiyZMKSi04hhnwPmtY/5eQw4PQPDeXMedZct3lqEQJAzznu8VO6T/wXVTvd a5TzG3+YZ+rKbNfLl1bi42Kcne2UX5SBk/PsS1XHuGqpXXoogARxelfJoMA9/Bom5GpX ww9eYW1R/E5cqo+Ue9lGggnaAB61XKUzEhGUbhd6LPCRA/2vZjjOMJF2CaXaNbcg3IWh +caLkNaR1zSop8pn06IXi02CRkGKKU8PgVH8J4wpNMwkYZ7fZvzOw5tAOb+x1r7p9SNu N2Xw== 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: AJcUukeWHo1WkR1sydm32fnqejmVC9cpu+WIwfIRmd6rkF5Dc01o3dUp xdvN196jYeui13Nb4FgcSUnuBObUdZaPWpL4mHx881AiAerSI7am0fqddPx7i08ozWrt7XdPnSu 6AH2ZytsZkY4Sb6VQLTersHOg0ZcfFcS8zani+7L29jACOvAO7lJ+mcLXvxcKPXKu5Q== X-Received: by 2002:a5e:d910:: with SMTP id n16mr6118367iop.58.1547663135155; Wed, 16 Jan 2019 10:25:35 -0800 (PST) X-Google-Smtp-Source: ALg8bN7DIf/qtQwSOHF8X2lvtrQmVqG5JvDG/vQ/RIGbGW04ySw2rQs6noPiS77ug+ajukZgbBnc X-Received: by 2002:a5e:d910:: with SMTP id n16mr6118344iop.58.1547663134408; Wed, 16 Jan 2019 10:25:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547663134; cv=none; d=google.com; s=arc-20160816; b=qrRlpJCtfQVnE1gwetRSZz3WEh0mutyhW6mWl8vkKC9S0tayFiS0hC+3si745VgXfU LCKvsEfY6Q74w55z9igoEqhMo+3lFkW4iNnuHrB7bcgNZjLzxqLkCI6nKKHgvdJHTj7S bs3v1eyQFDj2+/Eo3AtoXvtYjfJhLsK3+XtDDLOhd57tTv+O4Un3PgKCUFdEsB/8DGl4 KGoBMo8tPx+V2rroQGOka+cFxRVnib1uI+47966NX+zOFa/hyTJZs9fXLL9KvyoQ9Rsr cA9jqXDw8vap5JiTDDi5cfg0htsEa85TpoIqzl81lX95+fKLvllTLSJR/5qK13ldEtEH tpgQ== 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=FC7p2teS3Q1IKey9mQzGrPMU0cB+noJmoXExGV8SeAUxPPzjS+/qxDH2y0PyQjLynf iMn6g+k9BFRogmZ+ZWWC/6J4+uGLAmBWL2eGCSXGLJGxnVcE9bGRuibai5KqTVXi5Hf4 3FanIu2TEFN8WgD9hc3nX43ncuLU0Nk36EW5NYjTMAZ2ndLysXaIS2VWl1uKo2TIOrLe PpqyeZaLEUJEgjwNj4B5d4eejjyq3xBSqszBX5B9ne3Q6NtgOWndnnmalC1+ZYT3X/Lp jIprzAIm4H6jA6WyfP6g85jlpoRnoSkzBr3oRobkhIoLhZ/9rOYppT2XVnmqkp9V72O+ KSyw== 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 m123si4177181iof.141.2019.01.16.10.25.33 for <linux-mm@kvack.org> (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Jan 2019 10:25:34 -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 <gunthorp@deltatee.com>) id 1gjpsW-0003NB-OU; Wed, 16 Jan 2019 11:25:32 -0700 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from <gunthorp@deltatee.com>) id 1gjpsT-00054U-Sk; Wed, 16 Jan 2019 11:25:25 -0700 From: Logan Gunthorpe <logang@deltatee.com> 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 <akpm@linux-foundation.org> Cc: Arnd Bergmann <arnd@arndb.de>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Andy Shevchenko <andy.shevchenko@gmail.com>, =?utf-8?q?Horia_Geant=C4=83?= <horia.geanta@nxp.com>, Logan Gunthorpe <logang@deltatee.com>, Thomas Gleixner <tglx@linutronix.de>, Kate Stewart <kstewart@linuxfoundation.org>, Philippe Ombredanne <pombredanne@nexb.com> Date: Wed, 16 Jan 2019 11:25:18 -0700 Message-Id: <20190116182523.19446-2-logang@deltatee.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20190116182523.19446-1-logang@deltatee.com> References: <20190116182523.19446-1-logang@deltatee.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 v25 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: <linux-mm.kvack.org> X-Virus-Scanned: ClamAV using ClamSMTP |
Series |
Add io{read|write}64 to io-64-atomic headers
|
expand
|
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)
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 <logang@deltatee.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Kate Stewart <kstewart@linuxfoundation.org> Cc: Philippe Ombredanne <pombredanne@nexb.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Arnd Bergmann <arnd@arndb.de> Link: http://lkml.kernel.org/r/CAK8P3a25zQDxyaY3iVv+JmSSzs7F6ssGc+HdBkGs54ZfViX+Fg@mail.gmail.com --- lib/iomap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)