From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by lists.ozlabs.org (Postfix) with ESMTP id 40B3cg0wdyzF2KH for ; Wed, 28 Mar 2018 21:13:38 +1100 (AEDT) Date: Wed, 28 Mar 2018 11:13:45 +0100 From: Will Deacon To: Benjamin Herrenschmidt Cc: Arnd Bergmann , Sinan Kaya , Jason Gunthorpe , David Laight , Oliver , "open list:LINUX FOR POWERPC (32-BIT AND 64-BIT)" , "linux-rdma@vger.kernel.org" , "Paul E. McKenney" , Peter Zijlstra , Ingo Molnar , Jonathan Corbet Subject: Re: RFC on writel and writel_relaxed 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 In-Reply-To: <1522231287.21446.9.camel@kernel.crashing.org> List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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