Skip to content

Commit 1d3f56b

Browse files
FlyGoatChristoph Hellwig
authored andcommitted
dma-mapping: provide CONFIG_ARCH_DMA_DEFAULT_COHERENT
Provide a kconfig option to allow arches to manipulate default value of dma_default_coherent in Kconfig. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent fe4e5ef commit 1d3f56b

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

kernel/dma/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ config ARCH_HAS_DMA_PREP_COHERENT
7676
config ARCH_HAS_FORCE_DMA_UNENCRYPTED
7777
bool
7878

79+
#
80+
# Select this option if the architecture assumes DMA devices are coherent
81+
# by default.
82+
#
83+
config ARCH_DMA_DEFAULT_COHERENT
84+
bool
85+
7986
config SWIOTLB
8087
bool
8188
select NEED_DMA_MAP_STATE

kernel/dma/mapping.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#if defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE) || \
2121
defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU) || \
2222
defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL)
23-
bool dma_default_coherent;
23+
bool dma_default_coherent = IS_ENABLED(CONFIG_ARCH_DMA_DEFAULT_COHERENT);
2424
#endif
2525

2626
/*

0 commit comments

Comments
 (0)