• Shawn Anastasio's avatar
    powerpc/dma: Fix invalid DMA mmap behavior · b4fc36e6
    Shawn Anastasio authored
    The refactor of powerpc DMA functions in commit 6666cc17
    ("powerpc/dma: remove dma_nommu_mmap_coherent") incorrectly
    changes the way DMA mappings are handled on powerpc.
    Since this change, all mapped pages are marked as cache-inhibited
    through the default implementation of arch_dma_mmap_pgprot.
    This differs from the previous behavior of only marking pages
    in noncoherent mappings as cache-inhibited and has resulted in
    sporadic system crashes in certain hardware configurations and
    workloads (see Bugzilla).
    
    This commit restores the previous correct behavior by providing
    an implementation of arch_dma_mmap_pgprot that only marks
    pages in noncoherent mappings as cache-inhibited. As this behavior
    should be universal for all powerpc platforms a new file,
    dma-generic.c, was created to store it.
    
    Fixes: 6666cc17 ("powerpc/dma: remove dma_nommu_mmap_coherent")
    # NOTE: fixes commit 6666cc17 released in v5.1.
    # Consider a stable tag:
    # Cc: stable@vger.kernel.org # v5.1+
    # NOTE: fixes commit 6666cc17 released in v5.1.
    # Consider a stable tag:
    # Cc: stable@vger.kernel.org # v5.1+
    Cc: stable@vger.kernel.org # v5.1+
    Signed-off-by: default avatarShawn Anastasio <shawn@anastas.io>
    Reviewed-by: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20190717235437.12908-1-shawn@anastas.io
    b4fc36e6
Kconfig 34.6 KB