From mboxrd@z Thu Jan 1 00:00:00 1970 From: Catalin Marinas Subject: Re: [PATCH v5 11/13] xen: introduce xen_alloc/free_coherent_pages Date: Fri, 6 Sep 2013 16:59:28 +0100 Message-ID: <20130906155928.GH1946@arm.com> References: <1377801154-29215-11-git-send-email-stefano.stabellini@eu.citrix.com> <20130905160905.GI11887@arm.com> <20130906141444.GE1946@arm.com> 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-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: Stefano Stabellini Cc: "konrad.wilk@oracle.com" , "xen-devel@lists.xensource.com" , "Ian.Campbell@citrix.com" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" List-Id: xen-devel@lists.xenproject.org On Fri, Sep 06, 2013 at 03:59:02PM +0100, Stefano Stabellini wrote: > On Fri, 6 Sep 2013, Catalin Marinas wrote: > > On Thu, Sep 05, 2013 at 05:43:33PM +0100, Stefano Stabellini wrote: > > > On Thu, 5 Sep 2013, Catalin Marinas wrote: > > > > On Thu, Aug 29, 2013 at 07:32:32PM +0100, Stefano Stabellini wrote: > > > > > xen_swiotlb_alloc_coherent needs to allocate a coherent buffer for cpu > > > > > and devices. On native x86 and ARMv8 is sufficient to call > > > > > __get_free_pages in order to get a coherent buffer, while on ARM we need > > > > > to call arm_dma_ops.alloc. > > > > > > > > Don't bet on this for ARMv8. It's not mandated for the architecture, so > > > > at some point some SoC will require non-cacheable buffers for coherency. > > > > > > I see. > > > Would it be better if I implemented xen_alloc_coherent_pages on armv8 by > > > calling arm64_swiotlb_dma_ops.alloc? > > > > What does this buffer do exactly? Is it allocated by guests? > > It is allocated by Dom0 to do DMA to/from a device. > It is the buffer that is going to be returned by dma_map_ops.alloc to > the caller: > > On x86: > dma_map_ops.alloc -> xen_swiotlb_alloc_coherent -> xen_alloc_coherent_pages -> __get_free_pages > > On ARM: > dma_map_ops.alloc -> xen_swiotlb_alloc_coherent -> xen_alloc_coherent_pages -> arm_dma_ops.alloc > > On ARM64 > dma_map_ops.alloc -> xen_swiotlb_alloc_coherent -> xen_alloc_coherent_pages -> ???? OK, I'm getting more confused. Do all the above calls happen in the guest, Dom0, or a mix? -- Catalin