linux-mainline/kernel/dma
Chen-Yu Tsai 89461db349 dma-coherent: Warn if OF reserved memory is beyond current coherent DMA mask
When a reserved memory region described in the device tree is attached
to a device, it is expected that the device's limitations are correctly
included in that description.

However, if the device driver failed to implement DMA address masking
or addressing beyond the default 32 bits (on arm64), then bad things
could happen because the DMA address was truncated, such as playing
back audio with no actual audio coming out, or DMA overwriting random
blocks of kernel memory.

Check against the coherent DMA mask when the memory regions are attached
to the device. Give a warning when the memory region can not be covered
by the mask.

A warning instead of a hard error was chosen, because it is possible
that existing drivers could be working fine even if they forgot to
extend the coherent DMA mask.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://lore.kernel.org/r/20250421083930.374173-1-wenst@chromium.org
2025-04-22 17:44:09 +02:00
..
coherent.c dma-coherent: Warn if OF reserved memory is beyond current coherent DMA mask 2025-04-22 17:44:09 +02:00
contiguous.c dma/contiguous: avoid warning about unused size_bytes 2025-04-09 17:28:53 +02:00
debug.c dma-debug: fix physical address calculation for struct dma_debug_entry 2024-11-28 10:19:16 +01:00
debug.h
direct.c dma-mapping: fix missing clear bdr in check_ram_in_range_map() 2025-03-12 13:41:44 +01:00
direct.h
dummy.c dma-mapping: call ->unmap_page and ->unmap_sg unconditionally 2024-08-22 06:18:11 +02:00
Kconfig dma-debug: remove DMA_API_DEBUG_SG 2024-10-29 08:53:37 +01:00
Makefile dma-mapping: clearly mark DMA ops as an architecture feature 2024-09-04 07:08:51 +03:00
map_benchmark.c
mapping.c dma-mapping: Fix warning reported for missing prototype 2025-04-22 15:06:33 +02:00
ops_helpers.c dma-mapping: use IOMMU DMA calls for common alloc/free page calls 2024-09-05 14:29:42 +03:00
pool.c dma-mapping: replace zone_dma_bits by zone_dma_limit 2024-08-22 06:18:00 +02:00
remap.c dma-mapping: use bit masking to check VM_DMA_COHERENT 2024-08-22 06:15:35 +02:00
swiotlb.c dma-mapping: replace zone_dma_bits by zone_dma_limit 2024-08-22 06:18:00 +02:00