diff options
author | Laura Abbott <lauraa@codeaurora.org> | 2014-02-04 23:08:57 +0000 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-05-05 16:02:14 -0700 |
commit | 7e7f87dda0fbc095f27f3ccd97aed18c2542b93c (patch) | |
tree | a23aab18275e7df35e00b3dd75aef72fcaa9990e | |
parent | 9d93ccedc26f8591ca4e6f2b65dcbf2bdbfd6453 (diff) |
arm64: Align CMA sizes to PAGE_SIZEv3.10/topic/arm64-cma
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 ccc9e244eb1b9654915634827322932cbafd8244)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
-rw-r--r-- | arch/arm64/mm/dma-mapping.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c index c4c005cc2ed2..0150f5d14eda 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c @@ -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) |