From mboxrd@z Thu Jan 1 00:00:00 1970 From: Russell King - ARM Linux Subject: Re: [Linaro-mm-sig] [RFC 0/2] DMA-mapping & IOMMU - physically contiguous allocations Date: Tue, 16 Oct 2012 09:59:28 +0100 Message-ID: <20121016085928.GV21164@n2100.arm.linux.org.uk> References: <1350309832-18461-1-git-send-email-m.szyprowski@samsung.com> <20121016090434.7d5e088152a3e0b0606903c8@nvidia.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20121016090434.7d5e088152a3e0b0606903c8@nvidia.com> Sender: linux-kernel-owner@vger.kernel.org To: Hiroshi Doyu Cc: Marek Szyprowski , Inki Dae , Arnd Bergmann , "linux-kernel@vger.kernel.org" , "linaro-mm-sig@lists.linaro.org" , "linux-mm@kvack.org" , Kyungmin Park , "linux-arm-kernel@lists.infradead.org" , linux-tegra@vger.kernel.org List-Id: linux-tegra@vger.kernel.org On Tue, Oct 16, 2012 at 09:04:34AM +0300, Hiroshi Doyu wrote: > In addition to those contiguous/discontiguous page allocation, is > there any way to _import_ anonymous pages allocated by a process to be > used in dma-mapping API later? > > I'm considering the following scenario, an user process allocates a > buffer by malloc() in advance, and then it asks some driver to convert > that buffer into IOMMU'able/DMA'able ones later. In this case, pages > are discouguous and even they may not be yet allocated at > malloc()/mmap(). That situation is covered. It's the streaming API you're wanting for that. dma_map_sg() - but you may need additional cache handling via flush_dcache_page() to ensure that your code is safe for all CPU cache architectures. Remember that pages allocated into userspace will be cacheable, so a cache flush is required before they can be DMA'd. Hence the streaming API.