]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: Fix the DMA mmap and get_sgtable API with DMA_ATTR_FORCE_CONTIGUOUS
authorCatalin Marinas <catalin.marinas@arm.com>
Tue, 25 Apr 2017 14:42:31 +0000 (15:42 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 5 May 2017 10:41:35 +0000 (11:41 +0100)
commit402f551dce76ad30c147f5595990c9e8d5f988a6
tree47da8343526e429c2753ffe55072cef1972fef28
parent34e8db383141113d87cf45f89b6bc97927b4f637
arm64: Fix the DMA mmap and get_sgtable API with DMA_ATTR_FORCE_CONTIGUOUS

While honouring the DMA_ATTR_FORCE_CONTIGUOUS on arm64 (commit
8200b6ac5576: "arm64: Add support for DMA_ATTR_FORCE_CONTIGUOUS to
IOMMU"), the existing uses of dma_mmap_attrs() and dma_get_sgtable()
have been broken by passing a physically contiguous vm_struct with an
invalid pages pointer through the common iommu API.

Since the coherent allocation with DMA_ATTR_FORCE_CONTIGUOUS uses CMA,
this patch simply reuses the existing swiotlb logic for mmap and
get_sgtable.

Note that the current implementation of get_sgtable (both swiotlb and
iommu) is broken if dma_declare_coherent_memory() is used since such
memory does not have a corresponding struct page. To be addressed in a
subsequent patch.

Fixes: 8200b6ac5576 ("arm64: Add support for DMA_ATTR_FORCE_CONTIGUOUS to IOMMU")
Reported-by: Andrzej Hajda <a.hajda@samsung.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Robin Murphy <robin.murphy@arm.com>
Tested-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/mm/dma-mapping.c