]> git.baikalelectronics.ru Git - kernel.git/commit
dma-mapping: fix page attributes for dma_mmap_*
authorChristoph Hellwig <hch@lst.de>
Fri, 26 Jul 2019 07:26:40 +0000 (09:26 +0200)
committerChristoph Hellwig <hch@lst.de>
Sat, 10 Aug 2019 17:52:45 +0000 (19:52 +0200)
commitfa57354d3ab67ef82c861a5079931ced07f3f190
tree129f9cde5b52cd77e04382c99ff0421aa862354b
parent863219ddbccc4e5804189e1baede7f83e4d9406c
dma-mapping: fix page attributes for dma_mmap_*

All the way back to introducing dma_common_mmap we've defaulted to mark
the pages as uncached.  But this is wrong for DMA coherent devices.
Later on DMA_ATTR_WRITE_COMBINE also got incorrect treatment as that
flag is only treated special on the alloc side for non-coherent devices.

Introduce a new dma_pgprot helper that deals with the check for coherent
devices so that only the remapping cases ever reach arch_dma_mmap_pgprot
and we thus ensure no aliasing of page attributes happens, which makes
the powerpc version of arch_dma_mmap_pgprot obsolete and simplifies the
remaining ones.

Note that this means arch_dma_mmap_pgprot is a bit misnamed now, but
we'll phase it out soon.

Fixes: d6f2271f3749 ("common: dma-mapping: add support for generic dma_mmap_* calls")
Reported-by: Shawn Anastasio <shawn@anastas.io>
Reported-by: Gavin Li <git@thegavinli.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Catalin Marinas <catalin.marinas@arm.com> # arm64
arch/arm/mm/dma-mapping.c
arch/arm64/mm/dma-mapping.c
arch/powerpc/Kconfig
arch/powerpc/kernel/Makefile
arch/powerpc/kernel/dma-common.c [deleted file]
drivers/iommu/dma-iommu.c
include/linux/dma-noncoherent.h
kernel/dma/mapping.c
kernel/dma/remap.c