aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/dma-map-ops.h
diff options
context:
space:
mode:
authorAlexander Lobakin <aleksander.lobakin@intel.com>2024-05-09 16:46:16 +0200
committerChristoph Hellwig <hch@lst.de>2024-05-09 19:00:29 +0200
commita6016aac5252da9d22a4dc0b98121b0acdf6d2f5 (patch)
tree3c77ee2d2df0c886af162b6d85f6d562c3d6b1b7 /include/linux/dma-map-ops.h
parentxsk: use generic DMA sync shortcut instead of a custom one (diff)
downloadwireguard-linux-a6016aac5252da9d22a4dc0b98121b0acdf6d2f5.tar.xz
wireguard-linux-a6016aac5252da9d22a4dc0b98121b0acdf6d2f5.zip
dma: fix DMA sync for drivers not calling dma_set_mask*()
There are several reports that the DMA sync shortcut broke non-coherent devices. dev->dma_need_sync is false after the &device allocation and if a driver didn't call dma_set_mask*(), it will still be false even if the device is not DMA-coherent and thus needs synchronizing. Due to historical reasons, there's still a lot of drivers not calling it. Invert the boolean, so that the sync will be performed by default and the shortcut will be enabled only when calling dma_set_mask*(). Reported-by: Steven Price <steven.price@arm.com> Closes: https://lore.kernel.org/lkml/010686f5-3049-46a1-8230-7752a1b433ff@arm.com Reported-by: Marek Szyprowski <m.szyprowski@samsung.com> Closes: https://lore.kernel.org/lkml/46160534-5003-4809-a408-6b3a3f4921e9@samsung.com Fixes: f406c8e4b770. ("dma: avoid redundant calls for sync operations") Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Tested-by: Steven Price <steven.price@arm.com> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Diffstat (limited to 'include/linux/dma-map-ops.h')
-rw-r--r--include/linux/dma-map-ops.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/dma-map-ops.h b/include/linux/dma-map-ops.h
index 4893cb89cb52..5217b922d29f 100644
--- a/include/linux/dma-map-ops.h
+++ b/include/linux/dma-map-ops.h
@@ -280,8 +280,8 @@ static inline void dma_reset_need_sync(struct device *dev)
{
#ifdef CONFIG_DMA_NEED_SYNC
/* Reset it only once so that the function can be called on hotpath */
- if (unlikely(!dev->dma_need_sync))
- dev->dma_need_sync = true;
+ if (unlikely(dev->dma_skip_sync))
+ dev->dma_skip_sync = false;
#endif
}