From: Tim Deegan Subject: Re: [PATCH 6/7] xen/arm: flush D-cache and I-cache when appropriate Date: Fri, 26 Oct 2012 10:01:41 +0100 Message-ID: <20121026090141.GB76080@ocelot.phlegethon.org> References: <1351091027-20740-6-git-send-email-stefano.stabellini@eu.citrix.com> <20121024155945.GD39126@ocelot.phlegethon.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini Cc: "xen-devel@lists.xensource.com" , Ian Campbell List-Id: xen-devel@lists.xenproject.org At 18:35 +0100 on 24 Oct (1351103740), Stefano Stabellini wrote: > > I don't think this is necessary - why not just pass va directly to the > > inline asm? We don't care what register it's in (and if we did I'm not > > convinced this would guarantee it was r0). > > > > > + asm volatile ( > > > + "dsb;" > > > + STORE_CP32(0, DCCMVAC) > > > + "isb;" > > > + : : "r" (r0) : "memory"); > > > > Does this need a 'memory' clobber? Can we get away with just saying it > > consumes *va as an input? All we need to be sure of is that the > > particular thing we're flushing has been written out; no need to stop > > any other optimizations. > > you are right on both points > > > I guess it might need to be re-cast as a macro so the compiler knows how > > big *va is? > > I don't think it is necessary, after all the size of a register has to > be the same of a virtual address But it's the size of the thing in memory that's being flushed that matters, not the size of the pointer to it! E.g. after a PTE write we need a 64-bit memory input operand to stop the compiler from hoisting any part of the PTE write past the cache flush. (well OK we explicitly use a 64-bit atomic write for PTE writes, but YKWIM). Tim.