Skip to contentSkip to conversation

arm64: dma-mapping: check whether cma area is initialized or not

PATCH In review Jisheng Zhang 3 participants 3 messages Sep 11, 2015 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: dma-mapping: check whether cma area is initialized or not

If CMA is turned on and CMA size is set to zero, kernel should behave as if CMA was not enabled at compile time. Every dma allocation should check existence of cma area before requesting memory.

Arm has done this by commit e464ef16c4f0 ("arm: dma-mapping: add checking cma area initialized"), also do this for arm64.

---
 arch/arm64/mm/dma-mapping.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/mm/dma-mapping.c +1 -1
index 0bcc4bc..99224dc 100644
@@ -100,7 +100,7 @@ static void *__dma_alloc_coherent(struct device *dev, size_t size,
 	if (IS_ENABLED(CONFIG_ZONE_DMA) &&
 	    dev->coherent_dma_mask <= DMA_BIT_MASK(32))
 		flags |= GFP_DMA;
-	if (IS_ENABLED(CONFIG_DMA_CMA) && (flags & __GFP_WAIT)) {
+	if (dev_get_cma_area(dev) && (flags & __GFP_WAIT)) {
 		struct page *page;
 		void *addr;
 
Signature · 1 line
2.5.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Jisheng Zhang

If CMA is turned on and CMA size is set to zero, kernel should behave as if CMA was not enabled at compile time. Every dma allocation should check existence of cma area before requesting memory.

Arm has done this by commit e464ef16c4f0 ("arm: dma-mapping: add checking cma area initialized"), also do this for arm64.

Will should pick this up for 4.3.

Thanks.

Signature · 1 line
Catalin
#2 lore raw
Quoted 6 lines · Catalin Marinas
Quoted 5 lines · Jisheng Zhang

If CMA is turned on and CMA size is set to zero, kernel should behave as if CMA was not enabled at compile time. Every dma allocation should check existence of cma area before requesting memory.

Quoted 8 lines
Quoted 4 lines

Arm has done this by commit e464ef16c4f0 ("arm: dma-mapping: add checking cma area initialized"), also do this for arm64.

Will should pick this up for 4.3.

Yup, queued already. I'll push out at -rc1.

Will