[PATCH 2/2] ARM: dma-mapping: Handle prot with non-consistent dma attribute

Thierry Escande thierry.escande at collabora.com
Wed Oct 26 10:04:08 PDT 2016


From: Heng-Ruey Hsu <henryhsu at chromium.org>

With this change, __get_dma_pgprot() now returns the VMA access
protection passed directly instead of overriding it if called with
NON_CONSISTENT DMA attribute.

Signed-off-by: Heng-Ruey Hsu <henryhsu at chromium.org>
Tested-by: Heng-ruey Hsu <henryhsu at chromium.org>
Reviewed-by: Tomasz Figa <tfiga at chromium.org>
Signed-off-by: Thierry Escande <thierry.escande at collabora.com>
---
 arch/arm/mm/dma-mapping.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index dc42ca6..d608c185 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -640,6 +640,9 @@ static void __free_from_contiguous(struct device *dev, struct page *page,
 
 static inline pgprot_t __get_dma_pgprot(unsigned long attrs, pgprot_t prot)
 {
+	if (attrs & DMA_ATTR_NON_CONSISTENT)
+		return prot;
+
 	prot = (attrs & DMA_ATTR_WRITE_COMBINE) ?
 			pgprot_writecombine(prot) :
 			pgprot_dmacoherent(prot);
-- 
2.7.4




More information about the linux-arm-kernel mailing list