From mboxrd@z Thu Jan 1 00:00:00 1970 From: Will Deacon Subject: Re: RFC on writel and writel_relaxed Date: Wed, 28 Mar 2018 11:13:45 +0100 Message-ID: <20180328101345.GA30850@arm.com> References: <20180327100944.GD29373@arm.com> <20180327110258.GF2464@arm.com> <20180327143628.GA10642@arm.com> <1522186185.7364.59.camel@kernel.crashing.org> <20180328085338.GA28871@arm.com> <1522230616.21446.1.camel@kernel.crashing.org> <1522231287.21446.9.camel@kernel.crashing.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <1522231287.21446.9.camel@kernel.crashing.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+glppe-linuxppc-embedded-2=m.gmane.org@lists.ozlabs.org Sender: "Linuxppc-dev" To: Benjamin Herrenschmidt Cc: Arnd Bergmann , Jonathan Corbet , "linux-rdma@vger.kernel.org" , Sinan Kaya , Jason Gunthorpe , Peter Zijlstra , David Laight , Oliver , "Paul E. McKenney" , "open list:LINUX FOR POWERPC (32-BIT AND 64-BIT)" , Ingo Molnar List-Id: linux-rdma@vger.kernel.org On Wed, Mar 28, 2018 at 09:01:27PM +1100, Benjamin Herrenschmidt wrote: > On Wed, 2018-03-28 at 11:55 +0200, Arnd Bergmann wrote: > > > powerpc and ARM can't quite make them synchronous I think, but at least > > > they should have the same semantics as writel. > > > > One thing that ARM does IIRC is that it only guarantees to order writel() within > > one device, and the memory mapped PCI I/O space window almost certainly > > counts as a separate device to the CPU. > > That sounds bogus. To elaborate, if you do the following on arm: writel(DEVICE_FOO); writel(DEVICE_BAR); we generally cannot guarantee in which order those accesses will hit the devices even if we add every barrier under the sun. You'd need something in between, specific to DEVICE_FOO (probably a read-back) to really push the first write out. This doesn't sound like it would be that uncommon to me. On the other hand: writel(DEVICE_FOO); writel(DEVICE_FOO); is obviously ordered and also things like: writel(DEVICE_FOO_IN_PCI_MEM_SPACE); writel(DEVICE_BAR_IN_SAME_PCI_MEM_SPACE); are ordered up to the PCI host bridge, because that's really the "device" here. Will