OpenCloudOS-Kernel/kernel/dma
Stephen Boyd 99c65fa7c5 dma-debug: Check for drivers mapping invalid addresses in dma_map_single()
I recently debugged a DMA mapping oops where a driver was trying to map
a buffer returned from request_firmware() with dma_map_single(). Memory
returned from request_firmware() is mapped into the vmalloc region and
this isn't a valid region to map with dma_map_single() per the DMA
documentation's "What memory is DMA'able?" section.

Unfortunately, we don't really check that in the DMA debugging code, so
enabling DMA debugging doesn't help catch this problem. Let's add a new
DMA debug function to check for a vmalloc address or an invalid virtual
address and print a warning if this happens. This makes it a little
easier to debug these sorts of problems, instead of seeing odd behavior
or crashes when drivers attempt to map the vmalloc space for DMA.

Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2018-10-08 09:44:17 +02:00
..
Kconfig dma-mapping: consolidate the dma mmap implementations 2018-09-20 09:01:16 +02:00
Makefile dma-mapping: merge direct and noncoherent ops 2018-09-20 09:01:15 +02:00
coherent.c dma-mapping: move all DMA mapping code to kernel/dma 2018-06-14 08:50:37 +02:00
contiguous.c dma-mapping: fix panic caused by passing empty cma command line argument 2018-09-20 09:01:08 +02:00
debug.c dma-debug: Check for drivers mapping invalid addresses in dma_map_single() 2018-10-08 09:44:17 +02:00
direct.c dma-direct: fix return value of dma_direct_supported 2018-10-05 09:15:15 +02:00
mapping.c dma-mapping: support non-coherent devices in dma_common_get_sgtable 2018-09-20 09:01:17 +02:00
swiotlb.c swiotlb: clean up reporting 2018-07-25 13:33:05 +02:00
virt.c dma-mapping: move all DMA mapping code to kernel/dma 2018-06-14 08:50:37 +02:00