Files
erofs-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.

[[email protected]: replace is_swiotlb_allocated() with is_swiotlb_active(), per Catalin]
  Link: https://lkml.kernel.org/r/[email protected]
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 370645f41e ("dma-mapping: force bouncing if the kmalloc() size is not cache-line-aligned")
Signed-off-by: Marek Szyprowski <[email protected]>
Reviewed-by: Catalin Marinas <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: Inki Dae <[email protected]>
Cc: Robin Murohy <[email protected]>
Cc: "Isaac J. Manjarres" <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
2025-10-15 13:24:33 -07:00
..
2024-10-29 08:53:37 +01:00