arm64: Add support for DMA_ATTR_FORCE_CONTIGUOUS to IOMMU
authorGeert Uytterhoeven <geert+renesas@glider.be>
Tue, 7 Mar 2017 17:43:32 +0000 (18:43 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Wed, 22 Mar 2017 17:21:37 +0000 (17:21 +0000)
commit44176bb38fa48726a9658b2ccf407ea94113c760
treeb75296c63df365b8811c3235258d63d23b83b54d
parentf13d52cb3fad03c237572be2ee691e1fe2d1d7bb
arm64: Add support for DMA_ATTR_FORCE_CONTIGUOUS to IOMMU

Add support for allocating physically contiguous DMA buffers on arm64
systems with an IOMMU.  This can be useful when two or more devices
with different memory requirements are involved in buffer sharing.

Note that as this uses the CMA allocator, setting the
DMA_ATTR_FORCE_CONTIGUOUS attribute has a runtime-dependency on
CONFIG_DMA_CMA, just like on arm32.

For arm64 systems using swiotlb, no changes are needed to support the
allocation of physically contiguous DMA buffers:
  - swiotlb always uses physically contiguous buffers (up to
    IO_TLB_SEGSIZE = 128 pages),
  - arm64's __dma_alloc_coherent() already calls
    dma_alloc_from_contiguous() when CMA is available.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/mm/dma-mapping.c