Skip to content

Commit 13bf5ce

Browse files
author
Christoph Hellwig
committed
dma-mapping: add a Kconfig symbol to indicate arch_dma_prep_coherent presence
Add a Kconfig symbol that indicates an architecture provides a arch_dma_prep_coherent implementation, and provide a stub otherwise. This will allow the generic dma-iommu code to use it while still allowing to be built for cache coherent architectures. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Robin Murphy <robin.murphy@arm.com>
1 parent 148a97d commit 13bf5ce

4 files changed

Lines changed: 11 additions & 0 deletions

File tree

‎arch/arm64/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ config ARM64
1313
select ARCH_HAS_DEVMEM_IS_ALLOWED
1414
select ARCH_HAS_DMA_COHERENT_TO_PFN
1515
select ARCH_HAS_DMA_MMAP_PGPROT
16+
select ARCH_HAS_DMA_PREP_COHERENT
1617
select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
1718
select ARCH_HAS_ELF_RANDOMIZE
1819
select ARCH_HAS_FAST_MULTIPLIER

‎arch/csky/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
config CSKY
22
def_bool y
33
select ARCH_32BIT_OFF_T
4+
select ARCH_HAS_DMA_PREP_COHERENT
45
select ARCH_HAS_SYNC_DMA_FOR_CPU
56
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
67
select ARCH_USE_BUILTIN_BSWAP

‎include/linux/dma-noncoherent.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ static inline void arch_sync_dma_for_cpu_all(struct device *dev)
7272
}
7373
#endif /* CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL */
7474

75+
#ifdef CONFIG_ARCH_HAS_DMA_PREP_COHERENT
7576
void arch_dma_prep_coherent(struct page *page, size_t size);
77+
#else
78+
static inline void arch_dma_prep_coherent(struct page *page, size_t size)
79+
{
80+
}
81+
#endif /* CONFIG_ARCH_HAS_DMA_PREP_COHERENT */
7682

7783
#endif /* _LINUX_DMA_NONCOHERENT_H */

‎kernel/dma/Kconfig‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ config ARCH_HAS_SYNC_DMA_FOR_CPU
3838
config ARCH_HAS_SYNC_DMA_FOR_CPU_ALL
3939
bool
4040

41+
config ARCH_HAS_DMA_PREP_COHERENT
42+
bool
43+
4144
config ARCH_HAS_DMA_COHERENT_TO_PFN
4245
bool
4346

0 commit comments

Comments
 (0)