Skip to content

Commit fa7e224

Browse files
author
Christoph Hellwig
committed
dma-direct: make uncached_kernel_address more general
Rename the symbol to arch_dma_set_uncached, and pass a size to it as well as allow an error return. That will allow reusing this hook for in-place pagetable remapping. As the in-place remap doesn't always require an explicit cache flush, also detangle ARCH_HAS_DMA_PREP_COHERENT from ARCH_HAS_DMA_SET_UNCACHED. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Robin Murphy <[email protected]>
1 parent 3d0fc34 commit fa7e224

File tree

11 files changed

+21
-17
lines changed

11 files changed

+21
-17
lines changed

arch/Kconfig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,11 @@ config ARCH_HAS_SET_DIRECT_MAP
248248
bool
249249

250250
#
251-
# Select if arch has an uncached kernel segment and provides the
252-
# uncached_kernel_address symbol to use it
251+
# Select if the architecture provides the arch_dma_set_uncached symbol to
252+
# either provide an uncached segement alias for a DMA allocation, or
253+
# to remap the page tables in place.
253254
#
254-
config ARCH_HAS_UNCACHED_SEGMENT
255-
select ARCH_HAS_DMA_PREP_COHERENT
255+
config ARCH_HAS_DMA_SET_UNCACHED
256256
bool
257257

258258
# Select if arch init_task must go in the __init_task_data section

arch/microblaze/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ config MICROBLAZE
88
select ARCH_HAS_GCOV_PROFILE_ALL
99
select ARCH_HAS_SYNC_DMA_FOR_CPU
1010
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
11-
select ARCH_HAS_UNCACHED_SEGMENT if !MMU
11+
select ARCH_HAS_DMA_SET_UNCACHED if !MMU
1212
select ARCH_MIGHT_HAVE_PC_PARPORT
1313
select ARCH_WANT_IPC_PARSE_VERSION
1414
select BUILDTIME_TABLE_SORT

arch/microblaze/mm/consistent.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void arch_dma_prep_coherent(struct page *page, size_t size)
4040
#define UNCACHED_SHADOW_MASK 0
4141
#endif /* CONFIG_XILINX_UNCACHED_SHADOW */
4242

43-
void *uncached_kernel_address(void *ptr)
43+
void *arch_dma_set_uncached(void *ptr, size_t size)
4444
{
4545
unsigned long addr = (unsigned long)ptr;
4646

arch/mips/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1187,8 +1187,9 @@ config DMA_NONCOHERENT
11871187
# significant advantages.
11881188
#
11891189
select ARCH_HAS_DMA_WRITE_COMBINE
1190+
select ARCH_HAS_DMA_PREP_COHERENT
11901191
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
1191-
select ARCH_HAS_UNCACHED_SEGMENT
1192+
select ARCH_HAS_DMA_SET_UNCACHED
11921193
select DMA_NONCOHERENT_MMAP
11931194
select DMA_NONCOHERENT_CACHE_SYNC
11941195
select NEED_DMA_MAP_STATE

arch/mips/mm/dma-noncoherent.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void arch_dma_prep_coherent(struct page *page, size_t size)
4949
dma_cache_wback_inv((unsigned long)page_address(page), size);
5050
}
5151

52-
void *uncached_kernel_address(void *addr)
52+
void *arch_dma_set_uncached(void *addr, size_t size)
5353
{
5454
return (void *)(__pa(addr) + UNCAC_BASE);
5555
}

arch/nios2/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
config NIOS2
33
def_bool y
44
select ARCH_32BIT_OFF_T
5+
select ARCH_HAS_DMA_PREP_COHERENT
56
select ARCH_HAS_SYNC_DMA_FOR_CPU
67
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
7-
select ARCH_HAS_UNCACHED_SEGMENT
8+
select ARCH_HAS_DMA_SET_UNCACHED
89
select ARCH_NO_SWAP
910
select TIMER_OF
1011
select GENERIC_ATOMIC64

arch/nios2/mm/dma-mapping.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void arch_dma_prep_coherent(struct page *page, size_t size)
6767
flush_dcache_range(start, start + size);
6868
}
6969

70-
void *uncached_kernel_address(void *ptr)
70+
void *arch_dma_set_uncached(void *ptr, size_t size)
7171
{
7272
unsigned long addr = (unsigned long)ptr;
7373

arch/xtensa/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ config XTENSA
66
select ARCH_HAS_DMA_PREP_COHERENT if MMU
77
select ARCH_HAS_SYNC_DMA_FOR_CPU if MMU
88
select ARCH_HAS_SYNC_DMA_FOR_DEVICE if MMU
9-
select ARCH_HAS_UNCACHED_SEGMENT if MMU
9+
select ARCH_HAS_DMA_SET_UNCACHED if MMU
1010
select ARCH_USE_QUEUED_RWLOCKS
1111
select ARCH_USE_QUEUED_SPINLOCKS
1212
select ARCH_WANT_FRAME_POINTERS

arch/xtensa/kernel/pci-dma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void arch_dma_prep_coherent(struct page *page, size_t size)
9292
* coherent DMA memory operations when CONFIG_MMU is not enabled.
9393
*/
9494
#ifdef CONFIG_MMU
95-
void *uncached_kernel_address(void *p)
95+
void *arch_dma_set_uncached(void *p, size_t size)
9696
{
9797
return p + XCHAL_KSEG_BYPASS_VADDR - XCHAL_KSEG_CACHED_VADDR;
9898
}

include/linux/dma-noncoherent.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,6 @@ static inline void arch_dma_prep_coherent(struct page *page, size_t size)
108108
}
109109
#endif /* CONFIG_ARCH_HAS_DMA_PREP_COHERENT */
110110

111-
void *uncached_kernel_address(void *addr);
111+
void *arch_dma_set_uncached(void *addr, size_t size);
112112

113113
#endif /* _LINUX_DMA_NONCOHERENT_H */

0 commit comments

Comments
 (0)