All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: dma-mapping: support non-consistent DMA attribute
@ 2015-02-24 20:45 Daniel Drake
  2015-02-25 10:24 ` Arnd Bergmann
  2015-02-25 10:36 ` Russell King - ARM Linux
  0 siblings, 2 replies; 11+ messages in thread
From: Daniel Drake @ 2015-02-24 20:45 UTC (permalink / raw)
  To: linux-arm-kernel

Currently when arm_dma_mmap() is called, vm_page_prot is reset
according to DMA attributes. Currently, writecombine is the
only attribute supported; any other configuration will map uncached
memory.

Add support for the non-consistent attribute so that cachable memory
can be mapped into userspace via the dma_mmap_attrs() API.

Signed-off-by: Daniel Drake <drake@endlessm.com>
---
 arch/arm/mm/dma-mapping.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 170a116..cfb7d4d 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -562,10 +562,12 @@ static void __free_from_contiguous(struct device *dev, struct page *page,
 
 static inline pgprot_t __get_dma_pgprot(struct dma_attrs *attrs, pgprot_t prot)
 {
-	prot = dma_get_attr(DMA_ATTR_WRITE_COMBINE, attrs) ?
-			    pgprot_writecombine(prot) :
-			    pgprot_dmacoherent(prot);
-	return prot;
+	if (dma_get_attr(DMA_ATTR_NON_CONSISTENT, attrs))
+		return prot;
+	else if (dma_get_attr(DMA_ATTR_WRITE_COMBINE, attrs))
+		return pgprot_writecombine(prot);
+	else
+		return pgprot_dmacoherent(prot);
 }
 
 #define nommu() 0
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-02-25 17:27 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-24 20:45 [PATCH] ARM: dma-mapping: support non-consistent DMA attribute Daniel Drake
2015-02-25 10:24 ` Arnd Bergmann
2015-02-25 13:58   ` Daniel Drake
2015-02-25 14:18     ` Russell King - ARM Linux
2015-02-25 14:30       ` Daniel Drake
2015-02-25 14:42         ` Russell King - ARM Linux
2015-02-25 15:21           ` Daniel Drake
2015-02-25 16:31           ` Jasper St. Pierre
2015-02-25 17:25             ` Russell King - ARM Linux
2015-02-25 17:27               ` Jasper St. Pierre
2015-02-25 10:36 ` Russell King - ARM Linux

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.