]> git.dujemihanovic.xyz Git - linux.git/commit
dma: compile-out DMA sync op calls when not used
authorAlexander Lobakin <aleksander.lobakin@intel.com>
Tue, 7 May 2024 11:20:20 +0000 (13:20 +0200)
committerChristoph Hellwig <hch@lst.de>
Tue, 7 May 2024 11:29:53 +0000 (13:29 +0200)
commitfe7514b149e0a8a6f3031d286e52d40163b0b11a
tree6e9bab82f3717433f89e243770d4ad9e559b32a3
parent2650073f1b5858008c32712f3d9e1e808ce7e967
dma: compile-out DMA sync op calls when not used

Some platforms do have DMA, but DMA there is always direct and coherent.
Currently, even on such platforms DMA sync operations are compiled and
called.
Add a new hidden Kconfig symbol, DMA_NEED_SYNC, and set it only when
either sync operations are needed or there is DMA ops or swiotlb
or DMA debug is enabled. Compile global dma_sync_*() and dma_need_sync()
only when it's set, otherwise provide empty inline stubs.
The change allows for future optimizations of DMA sync calls depending
on runtime conditions.

Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
include/linux/dma-mapping.h
kernel/dma/Kconfig
kernel/dma/mapping.c