• Alex Smith's avatar
    MIPS: Add implementation of dma_map_ops.mmap() · 8c172467
    Alex Smith authored
    The generic implementation of dma_map_ops.mmap(), dma_common_mmap(),
    is not correct for non-coherent devices. It expects to be passed a
    virtual address previously returned by dma_alloc_coherent(), which for
    a non-coherent device will return a KSEG1 address. It then attempts to
    convert that virtual address to a physical address using virt_to_page()
    which will yield an incorrect address.
    
    Also, dma_common_mmap() does not handle the DMA_ATTR_WRITE_COMBINE
    attribute, and therefore dma_mmap_writecombine() will not actually set
    the appropriate pgprot_t flags for write combining.
    
    This patch adds an implementation of dma_map_ops.mmap() that correctly
    handles KSEG1 addresses, and enables write combining when requested.
    Signed-off-by: default avatarAlex Smith <alex.smith@imgtec.com>
    Cc: Sadegh Abbasi <Sadegh.Abbasi@imgtec.com>
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/10808/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
    8c172467
dma-default.c 11.3 KB