Message ID | 20230221124613.2859-6-jiaxun.yang@flygoat.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | MIPS DMA coherence fixes | expand |
On Tue, Feb 21, 2023 at 12:46:11PM +0000, Jiaxun Yang wrote: > Provide a kconfig option to allow arches to manipulate default > value of dma_default_coherent in Kconfig. I don't see the win over just doing this by setting dma_default_coherent in the early boot code.
> 2023年2月21日 17:58,Christoph Hellwig <hch@lst.de> 写道: > > On Tue, Feb 21, 2023 at 12:46:11PM +0000, Jiaxun Yang wrote: >> Provide a kconfig option to allow arches to manipulate default >> value of dma_default_coherent in Kconfig. > > I don't see the win over just doing this by setting dma_default_coherent > in the early boot code. I just don’t want to dig into every archs’ early boot code to decide a good timing for setting this variable. Also as we do have a OF_DMA_DEFAULT_COHERENT before it makes more sense to me. Thanks - Jiaxun
diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig index 56866aaa2ae1..968108fdf9bf 100644 --- a/kernel/dma/Kconfig +++ b/kernel/dma/Kconfig @@ -76,6 +76,9 @@ config ARCH_HAS_DMA_PREP_COHERENT config ARCH_HAS_FORCE_DMA_UNENCRYPTED bool +config ARCH_DMA_DEFAULT_COHERENT + bool + config SWIOTLB bool select NEED_DMA_MAP_STATE diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c index e0b005c8ffce..3d4a2ca15b5a 100644 --- a/kernel/dma/mapping.c +++ b/kernel/dma/mapping.c @@ -20,7 +20,7 @@ #if defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE) || \ defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU) || \ defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL) -bool dma_default_coherent; +bool dma_default_coherent = IS_ENABLED(CONFIG_ARCH_DMA_DEFAULT_COHERENT); #endif /*
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> --- kernel/dma/Kconfig | 3 +++ kernel/dma/mapping.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-)