From patchwork Wed Jan 16 18:25:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 10766673 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 C00901580 for ; 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 ; 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 ; 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 ; Wed, 16 Jan 2019 13:25:35 -0500 (EST) Received: by mail-it1-f197.google.com with SMTP id b14so2503841itd.1 for ; 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 (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 ) 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 ) id 1gjpsT-00054U-Sk; Wed, 16 Jan 2019 11:25:25 -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: 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 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: 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 Wed Jan 16 18:25:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 10766683 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 8A12313BF for ; Wed, 16 Jan 2019 18:25:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7ADF12F3E1 for ; Wed, 16 Jan 2019 18:25:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6E83E2F3F4; Wed, 16 Jan 2019 18:25:50 +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 D4D622F3E1 for ; Wed, 16 Jan 2019 18:25:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B77C38E0011; Wed, 16 Jan 2019 13:25:37 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A16E38E0004; Wed, 16 Jan 2019 13:25:37 -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 7EC738E0013; Wed, 16 Jan 2019 13:25:37 -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 43FD08E0011 for ; Wed, 16 Jan 2019 13:25:37 -0500 (EST) Received: by mail-io1-f70.google.com with SMTP id c4so5341373ioh.16 for ; Wed, 16 Jan 2019 10:25:37 -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=REEhkDTxDlUiod/mFrWUzBoDhFBOMry6cHe+vAASCag=; b=dY60tSu8t44al442IjwvLJj82jW4qAU1gwYX4gHrePPFOMwRJwHnI07sOqvoRnJOEG qRcmN83dpiCzRW3GbitwAJ8ITUslbLzL1XHJFf1V+qu37jTlw89gt9az7gCAaXMqO1XT xIiNughTge2DBHHZLc8XM4u3oJ8l4cLuBZld/YREX+NCnQTJH9mK5OIMKxHfKrNLidDD DTjEst9w/k4coGhsPMU7O/ZWjJpRcVTjDCcU0r4fJ9uKB1M578acPqUh8i8rRp3ojtKf CXJeqMxFmymzMeTCciTkHE9SM42jOxsT2xqmtP+oKgzGCK43smWO5/CDsMxCIsEyo7rf weTQ== 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: AJcUukdP9yjVm25Ou8lkhsQWBxTfpC3mVy3YhbhUD6KKYrOQPYBCUIRQ As7pq+UJUcST6P0ZuJifKS6e+bJjpeyHyezO/C4RVSiM57Jd515U/CsGQQKWJdh8XxsrR2tsztO jYVyaDn1YMfmKz4YB7vNI3mTpgQsnF0xX60cw77D2UgLIkmy4LmVuQXrOATEPyYpuWQ== X-Received: by 2002:a02:8785:: with SMTP id t5mr6144045jai.73.1547663136964; Wed, 16 Jan 2019 10:25:36 -0800 (PST) X-Google-Smtp-Source: ALg8bN5bpPbSeTEnKMkgjHHLUM8Tqj59IoZmAANXxcfCjssua8Tr8YelTSopON0ZCPXXpcLoj1Db X-Received: by 2002:a02:8785:: with SMTP id t5mr6144009jai.73.1547663136186; Wed, 16 Jan 2019 10:25:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547663136; cv=none; d=google.com; s=arc-20160816; b=FBZtGOVLK7zmL+WHzHHNc0sNbXg7/D8hoOcjwBcnDHNP3e2epJhvtm21sKTR9suShy Z7Vi3PkA8UfTELoyJMybGpduOxCUKtwBu1AhNfCISvy1e5bZQZS5T3zUPyJA9q6BVEsa LchtK4zHPNxdRVppil97FBKr6ozqINYX9/Q/dXdHPN7X3TMqRCyKAXSsu21fz46M6K42 5oA9ol1VO47wj+X5Yiy3Xt93YvAYdvEU6J7cpsummAYXteQBgQewEcKpHSaYqPNOyJIV 01yJaKYij5BxKscem3erUTLCWFxUNmSVDr0i1O8jGtFG5fo2Y230CYNTeX10xRGYepbT ZVaA== 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=REEhkDTxDlUiod/mFrWUzBoDhFBOMry6cHe+vAASCag=; b=rrkMVK8a0XjTF6ltUN9DemFmOgVyySNxeM67Iypsp7qBASC/+RmfZVoZKatYZogcrt fSXQ0mXLYoeg3+e+A+kj/nrrXS7fe2qkrpFDUXATPkfaUADqHiOExhAi5UgrZVJKcR9R yUTX7/aLYhmGeUhfklFj2iuvMA+0s1h/G8Ak5h5vazSpbueqhdMC38feI55MZTuxGcWX 9UNpOccyLpy8L0bc9U9k7OMUgQgQHyJ3YqyIVWU90lFAY5PyS9M1eyH2CixWlNzboug3 hrZrWnwlyLAGhD+rHosV+v65RRZGwXJynwOkJlyPgbQF5O7z0yT6bPpsKsCe8DZUYUPJ Ts2g== 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 130si4091127jaz.43.2019.01.16.10.25.35 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Jan 2019 10:25:36 -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 1gjpsY-0003ND-0K; Wed, 16 Jan 2019 11:25:34 -0700 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1gjpsU-00054a-37; Wed, 16 Jan 2019 11:25:26 -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: Wed, 16 Jan 2019 11:25:20 -0700 Message-Id: <20190116182523.19446-4-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 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 v25 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 7f19fbd3ba55..4b73847e9b95 100644 --- a/arch/powerpc/include/asm/io.h +++ b/arch/powerpc/include/asm/io.h @@ -783,8 +783,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 Wed Jan 16 18:25:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 10766681 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 5694E186E for ; Wed, 16 Jan 2019 18:25:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 480BC2F3E1 for ; Wed, 16 Jan 2019 18:25:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B79D2F3F5; Wed, 16 Jan 2019 18:25:46 +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 6ADA52F3E8 for ; Wed, 16 Jan 2019 18:25:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5F2498E0012; Wed, 16 Jan 2019 13:25:37 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5A3818E0004; Wed, 16 Jan 2019 13:25:37 -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 4937D8E0012; Wed, 16 Jan 2019 13:25:37 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-io1-f72.google.com (mail-io1-f72.google.com [209.85.166.72]) by kanga.kvack.org (Postfix) with ESMTP id 13C778E0004 for ; Wed, 16 Jan 2019 13:25:37 -0500 (EST) Received: by mail-io1-f72.google.com with SMTP id x12so5416028ioj.2 for ; Wed, 16 Jan 2019 10:25:37 -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=gyy7cijSCBCxAclDn4zc+5XexXTDTozxk2qqZbJ+EBZokVOV73A2+4qgOaXNxkj31U 381cpDd6xIgCM2Di1BR13aDhncFAdrwhra1k0lOwXGK89LWBPc7C3wy3O0EyNXGN8IHY n+8UnlFsOjPOf45HucKoi1GN1lT3JsOvzZim15s/iBKK4VSThaztOjonvEX3BCSNj99J B5om7xYeMt/Wl0iiSnR4XHSkNCwhBCEFlcEkk2WxEdhBBZHGBWsMoi3xEt8Sg4G7ifNm 7BvYQ2WHWkwp3solsy7TBI2op6TnTDs3UdbiMyAwYA9q5JGZy4Lm3cqR39fT529ZOPvz n0gw== 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: AJcUukd2I9EaWzUDTkZ2Xwr5ExkCvV3CCgSz8IQCWktqr1iAYongTlI8 RVb04GAsomnkHWoui8fKyYOT8ZrCXoTVoS19NB/ejUJr2HwZmCcpsNIxpIliQAVMYwnRooy67Hj iLjWX1QS+fRE2I2BVFu9t01gyJyZM59pFtCiX44azTvFsqrV1vIAI9aV5DNUYILmzmg== X-Received: by 2002:a24:9b87:: with SMTP id o129mr6527100itd.128.1547663136815; Wed, 16 Jan 2019 10:25:36 -0800 (PST) X-Google-Smtp-Source: ALg8bN4k8ZTefHPDlBhursrJaxRhSrN90Ped8hiy6B/evaB5f8QQFgwNTuFdICIWYB3fH65hk+3r X-Received: by 2002:a24:9b87:: with SMTP id o129mr6527058itd.128.1547663135984; Wed, 16 Jan 2019 10:25:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547663135; cv=none; d=google.com; s=arc-20160816; b=GQpiLeGn37aSg6vdmKpWJj/OQrd4zdfcEfDGou6WrSF+TeGEOwySRBPyI2Pkeojz+P WO9iGPBL50GUHItEZIfJfELr+0eFfua5QTqnzyIFMc8W+YAn5mGVN7JnGfGkQ5FcCEFW AmdJb3zCHUY+AjN2tlABQOOKXXWTJ+Q9E0n4SWTV1seqc9xGr5P4LZBW8hDTDyzfNp59 ALA0Cs81sYfKCvkGLxU+ajXus8EhqF1Qt18FvC/LUdTwuOeoQMFjIxZcNUBew4KzDPBg dseEpdaJRsW4I1oVIVc2ziBAEkjMWe9sBl7Ynic5lJ6nPwGaC662o1eiLrICkIdG9j+E U8sA== 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=kqmLkzaSfY0Ri9wJGHQ+WunTycvtWa35hNGVLt165wAO0V/9PgFhdPKZyjH/iKgpu6 gJN+Itj1ljHuhmgRzh/PKzpu75gaVsoEUyTU6v7q0VAh1q0fMN3aT6OvNYzimfWt0nwA VPsQ98JE9JU4iww24Trg04QBvYI4RG3F+Or/lneffFRH3seQD1hFuufXg/3Rqg2/TAal 8L9ZSqvcW2zFSeNgmrYhB+pSzw2r/vRC74cDIIumpMGYXdHEY1/w+2fLYPKJKzfLMATn GZdjKFeIjInqdcUJJsQq4cDMV+x7iZhBw9DNQvc88vGghP2y7zP6SPhyWeFf0JCU6ioa bXSQ== 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 z190si3445155iof.110.2019.01.16.10.25.35 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Jan 2019 10:25:35 -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 1gjpsW-0003NE-NA; Wed, 16 Jan 2019 11:25:33 -0700 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1gjpsU-00054d-64; Wed, 16 Jan 2019 11:25:26 -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: Wed, 16 Jan 2019 11:25:21 -0700 Message-Id: <20190116182523.19446-5-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 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 v25 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 Wed Jan 16 18:25:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 10766663 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 8CAB11580 for ; Wed, 16 Jan 2019 18:25:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FFB82F3F5 for ; Wed, 16 Jan 2019 18:25:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 737902F3F0; Wed, 16 Jan 2019 18:25:34 +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 4F4912F3E8 for ; Wed, 16 Jan 2019 18:25:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3F7D28E0003; Wed, 16 Jan 2019 13:25:32 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3A5E28E0002; Wed, 16 Jan 2019 13:25:32 -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 294C38E0003; Wed, 16 Jan 2019 13:25:32 -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 F40BE8E0002 for ; Wed, 16 Jan 2019 13:25:31 -0500 (EST) Received: by mail-io1-f70.google.com with SMTP id q207so5303592iod.18 for ; Wed, 16 Jan 2019 10:25:31 -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=pwR0iWje+w2rbx3OQGRZDChEOa/A5DWjG1zB0fay6WSDNYESUpepEH/O+0diBrGutM q7vMn6pVYcJX4qOw8XnK8U6loLWaS0A0o5NbKkiDZLfvCx8SrOr2XxQKsJKT6mvedrtG WUY+j7PsyCdfDKXM/33/WdhsNXFtoa2qRiiOn2gk2j6UT13rmDuKlQwwmUN2VgW8j1aj 7TLuzvwdkAlmYlL4Uhz6RwsudcOcMwkCD9fpee07uDJ1FOCzchbbI/KdNNh3giR2Z8fB 1TBM2JkYt64FMGSKfgGLBfOirt++XN2WXn0Fo/rD6eRva9/BVXwUvTFmHjjmCuRL8Kih pkhw== 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: AJcUukd5SDy+vy1+EnlSiYJaf6GF1QXPvAW7UJr0/m7cKHWPDz+RXnMR NTbzbaaM5eG7hUQq1z+CdXLpvy81jjgXNItSeomeNGWOd/FzdT51iR9u7Gt0ml6cHTymhSC3es/ Il0UoZEP78So8wHlcUzPEXN6P7d+wMV16W2bCdpQTZgC57X7EectTfcEzpA82dH0c/w== X-Received: by 2002:a6b:c8c9:: with SMTP id y192mr5322520iof.183.1547663131775; Wed, 16 Jan 2019 10:25:31 -0800 (PST) X-Google-Smtp-Source: ALg8bN6gH0dXrlR+EeU656Bo+8wa4w8spd1kmtFtH9hV2sMMbR3/EEu/NCrb7Ns8/i/0pJXDlgb4 X-Received: by 2002:a6b:c8c9:: with SMTP id y192mr5322496iof.183.1547663131023; Wed, 16 Jan 2019 10:25:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547663131; cv=none; d=google.com; s=arc-20160816; b=lzD7wHNXqgyG+++bGVfaVH5Gy6ItIgtQtwJLCEWC2WT6Mi5jQqykOXrBmUKhKT52Gq /N5BExcRKI7J38VUqGiSJsCfuS9gcyRjgVnWTcpxxvwecYDMH9q0jIgVw2IraDMGfCQH aO4gHDABpgOr4TPcWIikW7Om9/Fulq8DbEijlgYllTRwDq2slgYggHuZMwHFIYOxmBmB yqgUqpElZhwwBN0/gzJiNyycQuzf0XXEUQM+MzEFllw3rUyStpaXYn8GYuntobjPmcAo O2TZZ9Z9q95uvaIN6t9eRqa31FT3a0O/783QcJxDPN8Zo53CZR9qf8QP9a9A7sQYg6qD dFCg== 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=whmmyZATalXL8OMITHo01qgLb3csz0kAH2SZmAIp68aopxE9v1NGRLL3s5qXq5sDav 9RkJMho+2007L+DG9HJSTa/eaKHWquyygFCuA3eWKoesWvtEJ5ORrWnwsVDMk+9Wb77M S3exYg/aF/tgGixUWGc+WxfVi+eOYxX3zNUeLXKalWjOhp0qDrSwqRBQIsX9lDdOT8/s c7EOcROSwPZN5O6JdtA2OysQKPP7GxV2l3pVF9d3zTVhzBsHcXXDeQzZnalkCkTki8Bt LbwdzQhT4bRGajfeFY7XSiXSOtULpgfJpY5+N1A3561KeIuqRw2YE0sie+jXX5e/xg3i k60Q== 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 p24si217196iol.125.2019.01.16.10.25.30 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Jan 2019 10:25:30 -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 1gjpsV-0003NF-5D; Wed, 16 Jan 2019 11:25:28 -0700 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1gjpsU-00054g-9Q; Wed, 16 Jan 2019 11:25:26 -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: Wed, 16 Jan 2019 11:25:22 -0700 Message-Id: <20190116182523.19446-6-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 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 v25 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 Wed Jan 16 18:25:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 10766665 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 C6BBB1580 for ; Wed, 16 Jan 2019 18:25:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B6E2F2F3E1 for ; Wed, 16 Jan 2019 18:25:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A95012F3F0; Wed, 16 Jan 2019 18:25:37 +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 901322F3E1 for ; Wed, 16 Jan 2019 18:25:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 496158E0007; Wed, 16 Jan 2019 13:25:34 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 46C098E0004; Wed, 16 Jan 2019 13:25:34 -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 2E4B68E0007; Wed, 16 Jan 2019 13:25:34 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-it1-f200.google.com (mail-it1-f200.google.com [209.85.166.200]) by kanga.kvack.org (Postfix) with ESMTP id 05CF38E0002 for ; Wed, 16 Jan 2019 13:25:34 -0500 (EST) Received: by mail-it1-f200.google.com with SMTP id 136so2475651itt.6 for ; Wed, 16 Jan 2019 10:25:34 -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=8yF3qyP2usLqKl/a24+bzCiizo8aQgkvKqVG9jLd7ss=; b=ZF/Fb+NtHOltOB1igUTQkszsnxFcWyWUkYFDKvBAio2G8j2VlReyL3EMN1rIu90oZk kHBfP8isO16ZxDASB84uri/2Wa0vVgqxIPbpEB8ypfSoJpx+LQUznTZKenl2EKGKgMK0 DdOqNWihoLtxD9jLkWBzQ++6/H+OAAxJbZ5eVol6cuiCDaOJAI7M3N2q64ydEbcOQILg FwprybWWU03GC7mg7RbzcQMacRL5qA6ZPYS35HbSfKsYaWcUuBFJYU0TRae3LZtlIfqe kFMG/peBkcSg2d5AY6oODZEkDLZAzGCOYEdNjTRdevn6PbewWSMhw5toJV/b077u6Ptq bXJA== 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: AJcUukfKkkYvPnwsZW8UYFPxrLCRzxGqtH+DVqTOsGG49Ew57qrIJXwl 73GYv6oVAbXjbUCblDQ2Zow+rJfeVF3CTNReGdGVCZmf1/xzGoigEFmxcAcmvgCsH7NciEKaqUk u1HjlMXsijXdXYWl31lAoOAkp3NgZQNYjEZbf4DxkPDkvU+FRFdGWFniF08TVDyt+0A== X-Received: by 2002:a24:248:: with SMTP id 69mr6328748itu.91.1547663133778; Wed, 16 Jan 2019 10:25:33 -0800 (PST) X-Google-Smtp-Source: ALg8bN5pk27t8z7nDLvOBrjEClrKD1d40GOiMY6slCQZgFef7ZhDYFjNkF4gWorrmHPhPaFdNvpR X-Received: by 2002:a24:248:: with SMTP id 69mr6328718itu.91.1547663132874; Wed, 16 Jan 2019 10:25:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547663132; cv=none; d=google.com; s=arc-20160816; b=amg5OaiIAGJyIr96RCCWWjxseg99ejgsnzUK/846DQ3IxU62tLjwnkYwykz0ycRqvG LY+ckmHe2ctyMMIO9ilpb5UrDgEz0z99qM3aQuPM1nauFfkqz1HOr9VpRcUnBMMDu+2R mhf/X7CyY0VBGhpiHT4592YFnYbf5dqQCJiP7TXONx1eKGv3mFHgL2vcLzR+/tK2Ys/0 wyWo2Bn+y7hCORei3Dq9FI6b3Ki0/7dpCVJNgoOl1sNTBJiW44eDx07hqFQCAf3XgTqW TnF2BxnQzMsQrXkW1guRUTtbN5QmXf+iHbwscvt5MK2vJpL+S4KeI7bScPEJi6bvLacr zuVg== 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=8yF3qyP2usLqKl/a24+bzCiizo8aQgkvKqVG9jLd7ss=; b=OBjfGIUOEtodhAkaPLKsNu1BUN2GY936/hc/6yinnWGqryNNBmXQ+wnrvTg2mO/G2D 4cjZUNR52bFFQQzre0Q6rJh04SKL4UtuetjgVTZxuNFEI4tcQePkfQNnVUroaCzYcrJr LZcBB5SAAsh934NYwVkgX/NAMyhpPZ6vT/W5H08ITV42/5N0xww8jF16CS+oRurqg8PX sPL835FKioxRoiYx+TcyEigxlPEK5CeuJlBQBVjcIXX5LzBK5sHKCGsQ9h91sheFUbwq wvRBNrYEuC3TB/5Gi1Ud22knogO/KOIK3U2hmuiOrV7xZIXE+XpIuGqtvydlQkBQjlU9 ogIg== 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 i71si4359416itc.81.2019.01.16.10.25.32 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Jan 2019 10:25:32 -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 1gjpsV-0003NG-Cn; Wed, 16 Jan 2019 11:25:31 -0700 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1gjpsU-00054j-C6; Wed, 16 Jan 2019 11:25:26 -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: Wed, 16 Jan 2019 11:25:23 -0700 Message-Id: <20190116182523.19446-7-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 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 v25 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 f1eaa3c4d46a..f2df2d39c65b 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