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>
(cherry picked from commit ccc9e244eb)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
This commit is contained in:
Laura Abbott
2014-02-04 23:08:57 +00:00
committed by Mark Brown
parent 9d93ccedc2
commit 7e7f87dda0

View File

@@ -40,6 +40,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)