From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Szyprowski Subject: RE: [PATCH 7/8] common: dma-mapping: change alloc/free_coherent method to more generic alloc/free_attrs Date: Mon, 27 Jun 2011 14:23:40 +0200 Message-ID: <000701cc34c5$0c50b800$24f22800$%szyprowski@samsung.com> References: <1308556213-24970-1-git-send-email-m.szyprowski@samsung.com> <1308556213-24970-8-git-send-email-m.szyprowski@samsung.com> <201106241751.35655.arnd@arndb.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-reply-to: <201106241751.35655.arnd@arndb.de> Content-language: pl List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: 'Arnd Bergmann' Cc: linux-arch@vger.kernel.org, 'Russell King - ARM Linux' , 'Joerg Roedel' , linaro-mm-sig@lists.linaro.org, linux-mm@kvack.org, 'Kyungmin Park' , linux-arm-kernel@lists.infradead.org List-Id: linux-arch.vger.kernel.org Hello, On Friday, June 24, 2011 5:52 PM Arnd Bergmann wrote: > On Monday 20 June 2011, Marek Szyprowski wrote: > > Introduce new alloc/free/mmap methods that take attributes argument. > > alloc/free_coherent can be implemented on top of the new alloc/free > > calls with NULL attributes. dma_alloc_non_coherent can be implemented > > using DMA_ATTR_NONCOHERENT attribute, dma_alloc_writecombine can also > > use separate DMA_ATTR_WRITECOMBINE attribute. This way the drivers will > > get more generic, platform independent way of allocating dma memory > > buffers with specific parameters. > > > > One more attribute can be usefull: DMA_ATTR_NOKERNELVADDR. Buffers with > > such attribute will not have valid kernel virtual address. They might be > > usefull for drivers that only exports the DMA buffers to userspace (like > > for example V4L2 or ALSA). > > > > mmap method is introduced to let the drivers create a user space mapping > > for a DMA buffer in generic, architecture independent way. > > > > TODO: update all dma_map_ops clients for all architectures > > > > Signed-off-by: Marek Szyprowski > > Signed-off-by: Kyungmin Park > > Yes, I think that is good, but the change needs to be done atomically > across all architectures. Yes, I'm aware of this and I will include such changes in the next version of my patches. > This should be easy enough as I believe > all other architectures that use dma_map_ops don't even require > dma_alloc_noncoherent but just define it to dma_alloc_coherent > because they have only coherent memory in regular device drivers. Right, this should be quite simple. I will also add DMA_ATTR_NON_COHERENT attribute for implementing dma_alloc_noncoherent() call. > On a related note, do you plan to make the CMA work use this > transparently, or do you want to have a DMA_ATTR_LARGE or > DMA_ATTR_CONTIGUOUS for CMA? IMHO it will be better to hide the CMA from the drivers. Memory allocated from CMA doesn't really differ from the one allocated by dma_alloc_coherent() (which internally use alloc_pages()), so I really see no reason for adding additional attribute for it. Best regards -- Marek Szyprowski Samsung Poland R&D Center From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout2.w1.samsung.com ([210.118.77.12]:38022 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757144Ab1F0MYj (ORCPT ); Mon, 27 Jun 2011 08:24:39 -0400 Received: from spt2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by mailout2.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTP id <0LNG007AT7RLQC@mailout2.w1.samsung.com> for linux-arch@vger.kernel.org; Mon, 27 Jun 2011 13:23:45 +0100 (BST) Received: from linux.samsung.com ([106.116.38.10]) by spt2.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LNG002IJ7RJEO@spt2.w1.samsung.com> for linux-arch@vger.kernel.org; Mon, 27 Jun 2011 13:23:44 +0100 (BST) Date: Mon, 27 Jun 2011 14:23:40 +0200 From: Marek Szyprowski Subject: RE: [PATCH 7/8] common: dma-mapping: change alloc/free_coherent method to more generic alloc/free_attrs In-reply-to: <201106241751.35655.arnd@arndb.de> Message-ID: <000701cc34c5$0c50b800$24f22800$%szyprowski@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-language: pl Content-transfer-encoding: 7BIT References: <1308556213-24970-1-git-send-email-m.szyprowski@samsung.com> <1308556213-24970-8-git-send-email-m.szyprowski@samsung.com> <201106241751.35655.arnd@arndb.de> Sender: linux-arch-owner@vger.kernel.org List-ID: To: 'Arnd Bergmann' Cc: linux-arm-kernel@lists.infradead.org, linaro-mm-sig@lists.linaro.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, 'Kyungmin Park' , 'Joerg Roedel' , 'Russell King - ARM Linux' Message-ID: <20110627122340.DWBHnGxCUIOqpSvA9lx_5vqbFx6yBQiZdc8usC6x7oM@z> Hello, On Friday, June 24, 2011 5:52 PM Arnd Bergmann wrote: > On Monday 20 June 2011, Marek Szyprowski wrote: > > Introduce new alloc/free/mmap methods that take attributes argument. > > alloc/free_coherent can be implemented on top of the new alloc/free > > calls with NULL attributes. dma_alloc_non_coherent can be implemented > > using DMA_ATTR_NONCOHERENT attribute, dma_alloc_writecombine can also > > use separate DMA_ATTR_WRITECOMBINE attribute. This way the drivers will > > get more generic, platform independent way of allocating dma memory > > buffers with specific parameters. > > > > One more attribute can be usefull: DMA_ATTR_NOKERNELVADDR. Buffers with > > such attribute will not have valid kernel virtual address. They might be > > usefull for drivers that only exports the DMA buffers to userspace (like > > for example V4L2 or ALSA). > > > > mmap method is introduced to let the drivers create a user space mapping > > for a DMA buffer in generic, architecture independent way. > > > > TODO: update all dma_map_ops clients for all architectures > > > > Signed-off-by: Marek Szyprowski > > Signed-off-by: Kyungmin Park > > Yes, I think that is good, but the change needs to be done atomically > across all architectures. Yes, I'm aware of this and I will include such changes in the next version of my patches. > This should be easy enough as I believe > all other architectures that use dma_map_ops don't even require > dma_alloc_noncoherent but just define it to dma_alloc_coherent > because they have only coherent memory in regular device drivers. Right, this should be quite simple. I will also add DMA_ATTR_NON_COHERENT attribute for implementing dma_alloc_noncoherent() call. > On a related note, do you plan to make the CMA work use this > transparently, or do you want to have a DMA_ATTR_LARGE or > DMA_ATTR_CONTIGUOUS for CMA? IMHO it will be better to hide the CMA from the drivers. Memory allocated from CMA doesn't really differ from the one allocated by dma_alloc_coherent() (which internally use alloc_pages()), so I really see no reason for adding additional attribute for it. Best regards -- Marek Szyprowski Samsung Poland R&D Center From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail203.messagelabs.com (mail203.messagelabs.com [216.82.254.243]) by kanga.kvack.org (Postfix) with SMTP id 05AB06B007E for ; Mon, 27 Jun 2011 08:24:39 -0400 (EDT) Received: from spt2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by mailout2.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTP id <0LNG00HIH7RLAH@mailout2.w1.samsung.com> for linux-mm@kvack.org; Mon, 27 Jun 2011 13:23:45 +0100 (BST) Received: from linux.samsung.com ([106.116.38.10]) by spt2.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LNG002IJ7RJEO@spt2.w1.samsung.com> for linux-mm@kvack.org; Mon, 27 Jun 2011 13:23:44 +0100 (BST) Date: Mon, 27 Jun 2011 14:23:40 +0200 From: Marek Szyprowski Subject: RE: [PATCH 7/8] common: dma-mapping: change alloc/free_coherent method to more generic alloc/free_attrs In-reply-to: <201106241751.35655.arnd@arndb.de> Message-id: <000701cc34c5$0c50b800$24f22800$%szyprowski@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-language: pl Content-transfer-encoding: 7BIT References: <1308556213-24970-1-git-send-email-m.szyprowski@samsung.com> <1308556213-24970-8-git-send-email-m.szyprowski@samsung.com> <201106241751.35655.arnd@arndb.de> Sender: owner-linux-mm@kvack.org List-ID: To: 'Arnd Bergmann' Cc: linux-arm-kernel@lists.infradead.org, linaro-mm-sig@lists.linaro.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, 'Kyungmin Park' , 'Joerg Roedel' , 'Russell King - ARM Linux' Hello, On Friday, June 24, 2011 5:52 PM Arnd Bergmann wrote: > On Monday 20 June 2011, Marek Szyprowski wrote: > > Introduce new alloc/free/mmap methods that take attributes argument. > > alloc/free_coherent can be implemented on top of the new alloc/free > > calls with NULL attributes. dma_alloc_non_coherent can be implemented > > using DMA_ATTR_NONCOHERENT attribute, dma_alloc_writecombine can also > > use separate DMA_ATTR_WRITECOMBINE attribute. This way the drivers will > > get more generic, platform independent way of allocating dma memory > > buffers with specific parameters. > > > > One more attribute can be usefull: DMA_ATTR_NOKERNELVADDR. Buffers with > > such attribute will not have valid kernel virtual address. They might be > > usefull for drivers that only exports the DMA buffers to userspace (like > > for example V4L2 or ALSA). > > > > mmap method is introduced to let the drivers create a user space mapping > > for a DMA buffer in generic, architecture independent way. > > > > TODO: update all dma_map_ops clients for all architectures > > > > Signed-off-by: Marek Szyprowski > > Signed-off-by: Kyungmin Park > > Yes, I think that is good, but the change needs to be done atomically > across all architectures. Yes, I'm aware of this and I will include such changes in the next version of my patches. > This should be easy enough as I believe > all other architectures that use dma_map_ops don't even require > dma_alloc_noncoherent but just define it to dma_alloc_coherent > because they have only coherent memory in regular device drivers. Right, this should be quite simple. I will also add DMA_ATTR_NON_COHERENT attribute for implementing dma_alloc_noncoherent() call. > On a related note, do you plan to make the CMA work use this > transparently, or do you want to have a DMA_ATTR_LARGE or > DMA_ATTR_CONTIGUOUS for CMA? IMHO it will be better to hide the CMA from the drivers. Memory allocated from CMA doesn't really differ from the one allocated by dma_alloc_coherent() (which internally use alloc_pages()), so I really see no reason for adding additional attribute for it. Best regards -- Marek Szyprowski Samsung Poland R&D Center -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 From: m.szyprowski@samsung.com (Marek Szyprowski) Date: Mon, 27 Jun 2011 14:23:40 +0200 Subject: [PATCH 7/8] common: dma-mapping: change alloc/free_coherent method to more generic alloc/free_attrs In-Reply-To: <201106241751.35655.arnd@arndb.de> References: <1308556213-24970-1-git-send-email-m.szyprowski@samsung.com> <1308556213-24970-8-git-send-email-m.szyprowski@samsung.com> <201106241751.35655.arnd@arndb.de> Message-ID: <000701cc34c5$0c50b800$24f22800$%szyprowski@samsung.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hello, On Friday, June 24, 2011 5:52 PM Arnd Bergmann wrote: > On Monday 20 June 2011, Marek Szyprowski wrote: > > Introduce new alloc/free/mmap methods that take attributes argument. > > alloc/free_coherent can be implemented on top of the new alloc/free > > calls with NULL attributes. dma_alloc_non_coherent can be implemented > > using DMA_ATTR_NONCOHERENT attribute, dma_alloc_writecombine can also > > use separate DMA_ATTR_WRITECOMBINE attribute. This way the drivers will > > get more generic, platform independent way of allocating dma memory > > buffers with specific parameters. > > > > One more attribute can be usefull: DMA_ATTR_NOKERNELVADDR. Buffers with > > such attribute will not have valid kernel virtual address. They might be > > usefull for drivers that only exports the DMA buffers to userspace (like > > for example V4L2 or ALSA). > > > > mmap method is introduced to let the drivers create a user space mapping > > for a DMA buffer in generic, architecture independent way. > > > > TODO: update all dma_map_ops clients for all architectures > > > > Signed-off-by: Marek Szyprowski > > Signed-off-by: Kyungmin Park > > Yes, I think that is good, but the change needs to be done atomically > across all architectures. Yes, I'm aware of this and I will include such changes in the next version of my patches. > This should be easy enough as I believe > all other architectures that use dma_map_ops don't even require > dma_alloc_noncoherent but just define it to dma_alloc_coherent > because they have only coherent memory in regular device drivers. Right, this should be quite simple. I will also add DMA_ATTR_NON_COHERENT attribute for implementing dma_alloc_noncoherent() call. > On a related note, do you plan to make the CMA work use this > transparently, or do you want to have a DMA_ATTR_LARGE or > DMA_ATTR_CONTIGUOUS for CMA? IMHO it will be better to hide the CMA from the drivers. Memory allocated from CMA doesn't really differ from the one allocated by dma_alloc_coherent() (which internally use alloc_pages()), so I really see no reason for adding additional attribute for it. Best regards -- Marek Szyprowski Samsung Poland R&D Center