summaryrefslogtreecommitdiffstats
path: root/arch/arm64/mm
diff options
context:
space:
mode:
authorLaura Abbott <lauraa@codeaurora.org>2014-02-05 00:08:57 +0100
committerCatalin Marinas <catalin.marinas@arm.com>2014-02-05 11:28:27 +0100
commitccc9e244eb1b9654915634827322932cbafd8244 (patch)
treeccd48e88d9ecc6d28266669e9fa8ad9a083ff741 /arch/arm64/mm
parentarm64: add DSB after icache flush in __flush_icache_all() (diff)
downloadlinux-ccc9e244eb1b9654915634827322932cbafd8244.tar.xz
linux-ccc9e244eb1b9654915634827322932cbafd8244.zip
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 <will.deacon@arm.com> Signed-off-by: Laura Abbott <lauraa@codeaurora.org> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/mm')
-rw-r--r--arch/arm64/mm/dma-mapping.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index 45b5ab54c9ee..fbd76785c5db 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -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)