• Alexey Brodkin's avatar
    arc: Implement arch-specific dma_map_ops.mmap · a79a8121
    Alexey Brodkin authored
    We used to use generic implementation of dma_map_ops.mmap which is
    dma_common_mmap() but that only worked for simpler cached mappings when
    vaddr = paddr.
    
    If a driver requests uncached DMA buffer kernel maps it to virtual
    address so that MMU gets involved and page uncached status takes into
    account. In that case usage of dma_common_mmap() lead to mapping of
    vaddr to vaddr for user-space which is obviously wrong. For more detals
    please refer to verbose explanation here [1].
    
    So here we implement our own version of mmap() which always deals
    with dma_addr and maps underlying memory to user-space properly
    (note that DMA buffer mapped to user-space is always uncached
    because there's no way to properly manage cache from user-space).
    
    [1] https://lkml.org/lkml/2016/10/26/973Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
    Cc: Marek Szyprowski <m.szyprowski@samsung.com>
    Cc: <stable@vger.kernel.org>  #4.5+
    Signed-off-by: default avatarAlexey Brodkin <abrodkin@synopsys.com>
    Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
    a79a8121
dma.c 6.26 KB