Skip to contentSkip to conversation

arm64: Align CMA sizes to PAGE_SIZE

PATCH New Laura Abbott 2 participants 2 messages Feb 4, 2014 – Feb 5, 2014 arm64

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 arm64: Align CMA sizes to PAGE_SIZE

dma_alloc_from_contiguous takes number of pages for a size. Align up the dma size passed in to page size to avoid truncation and allocation failures on sizes less than PAGE_SIZE.

Cc Will Deacon <[email protected]>
Cc Catalin Marinas <[email protected]>
---
 arch/arm64/mm/dma-mapping.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm64/mm/dma-mapping.c +1 -0
index 45b5ab5..fbd7678 100644
@@ -45,6 +45,7 @@ static void *arm64_swiotlb_alloc_coherent(struct device *dev, size_t size,
 	if (IS_ENABLED(CONFIG_DMA_CMA)) {
 		struct page *page;
 
+		size = PAGE_ALIGN(size);
 		page = dma_alloc_from_contiguous(dev, size >> PAGE_SHIFT,
 							get_order(size));
 		if (!page)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
maintainer
#1 lore raw

PATCH v2 1/1 arm64: Align CMA sizes to PAGE_SIZE

Quoted 7 lines · Laura Abbott

dma_alloc_from_contiguous takes number of pages for a size. Align up the dma size passed in to page size to avoid truncation and allocation failures on sizes less than PAGE_SIZE.

Cc Will Deacon <[email protected]>
Cc Catalin Marinas <[email protected]>

Thanks. Applied.

Signature · 1 line
Catalin