From: Stefano Stabellini Subject: Re: [PATCH v3 3/5] xen/x86: introduce more cache maintenance operations Date: Fri, 10 Oct 2014 10:23:46 +0100 Message-ID: References: <1412773221-15150-3-git-send-email-stefano.stabellini@eu.citrix.com> <5437A986020000780003D853@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XcWSa-0004Gh-Ke for xen-devel@lists.xenproject.org; Fri, 10 Oct 2014 09:26:04 +0000 In-Reply-To: <5437A986020000780003D853@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: julien.grall@citrix.com, xen-devel , Ian.Campbell@citrix.com, Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Fri, 10 Oct 2014, Jan Beulich wrote: > >>> On 08.10.14 at 15:00, wrote: > > --- a/xen/include/asm-x86/page.h > > +++ b/xen/include/asm-x86/page.h > > @@ -346,6 +346,10 @@ static inline uint32_t cacheattr_to_pte_flags(uint32_t cacheattr) > > > > /* No cache maintenance required on x86 architecture. */ > > static inline void flush_page_to_ram(unsigned long mfn) {} > > +static inline void clean_xen_dcache_va_range(const void *p, unsigned long size) {} > > +static inline void invalidate_xen_dcache_va_range(const void *p, unsigned long size) {} > > +static inline void clean_and_invalidate_xen_dcache_va_range > > + (const void *p, unsigned long size) {} > > Mind explaining what purpose the "_xen" in these names serves? It means a Xen virtual address (as opposed to a guest p2m address or a guest virtual address), but I guess it is pretty obvious so I should remove it? > Also, is simply stubbing these out correct? I.e. there are caches on > x86, and those can both be invalidated and cleaned, so why would > you not do so here? Good point. The problem is that to be sure that I am doing the right thing I would need to know what kind of flushes are required with a non-coherent device on x86, but I don't have any examples at hand. >From the amd64 manual, I would implement invalidate with CLFLUSH, clean and invalidate with WBINVD (even though it operates on the entire cache so it is very heavyweight) and I would have no way to implement just "clean". Do you agree?