linux/kernel/dma
Marek Szyprowski 03521c892b dma-debug: don't report false positives with DMA_BOUNCE_UNALIGNED_KMALLOC
Commit 370645f41e ("dma-mapping: force bouncing if the kmalloc() size is
not cache-line-aligned") introduced DMA_BOUNCE_UNALIGNED_KMALLOC feature
and permitted architecture specific code configure kmalloc slabs with
sizes smaller than the value of dma_get_cache_alignment().

When that feature is enabled, the physical address of some small
kmalloc()-ed buffers might be not aligned to the CPU cachelines, thus not
really suitable for typical DMA.  To properly handle that case a SWIOTLB
buffer bouncing is used, so no CPU cache corruption occurs.  When that
happens, there is no point reporting a false-positive DMA-API warning that
the buffer is not properly aligned, as this is not a client driver fault.

[m.szyprowski@samsung.com: replace is_swiotlb_allocated() with is_swiotlb_active(), per Catalin]
  Link: https://lkml.kernel.org/r/20251010173009.3916215-1-m.szyprowski@samsung.com
Link: https://lkml.kernel.org/r/20251009141508.2342138-1-m.szyprowski@samsung.com
Fixes: 370645f41e ("dma-mapping: force bouncing if the kmalloc() size is not cache-line-aligned")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Inki Dae <m.szyprowski@samsung.com>
Cc: Robin Murohy <robin.murphy@arm.com>
Cc: "Isaac J. Manjarres" <isaacmanjarres@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2025-10-15 13:24:33 -07: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
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 of: reserved_mem: Restructure call site for dma_contiguous_early_fixup() 2025-08-11 13:05:38 +02:00
debug.c dma-debug: don't report false positives with DMA_BOUNCE_UNALIGNED_KMALLOC 2025-10-15 13:24:33 -07:00
debug.h dma-mapping: export new dma_*map_phys() interface 2025-09-12 00:18:21 +02:00
direct.c dma-mapping: export new dma_*map_phys() interface 2025-09-12 00:18:21 +02:00
direct.h dma-mapping: convert dma_direct_*map_page to be phys_addr_t based 2025-09-12 00:18:20 +02:00
dummy.c dma-mapping: call ->unmap_page and ->unmap_sg unconditionally 2024-08-22 06:18:11 +02:00
map_benchmark.c dma-mapping: benchmark: Don't starve others when doing the test 2024-07-09 07:48:32 +02:00
mapping.c dma-mapping: export new dma_*map_phys() interface 2025-09-12 00:18:21 +02:00
ops_helpers.c iommu/dma: rename iommu_dma_*map_page to iommu_dma_*map_phys 2025-09-12 00:18:20 +02:00
pool.c dma/pool: Ensure DMA_DIRECT_REMAP allocations are decrypted 2025-08-13 11:02:10 +02:00
remap.c dma-remap: drop nth_page() in dma_common_contiguous_remap() 2025-09-21 14:22:06 -07:00
swiotlb.c swiotlb: Remove redundant __GFP_NOWARN 2025-08-11 11:29:38 +02:00