History

dma-direct: remove the cached_kernel_address hook

dma-direct now finds the kernel address for coherent allocations based on the dma address, so the cached_kernel_address hooks is unused and can be removed entirely.

Christoph Hellwig committed 6 years ago

Commit 4f8232b1 parent 286c21d6 files · +3 −32Browse files

Unified · Split

6 files
  1. arch/Kconfig +1 −1
  2. arch/microblaze/mm/consistent.c +0 −7
  3. arch/mips/mm/dma-noncoherent.c +0 −5
  4. arch/nios2/mm/dma-mapping.c +0 −10
  5. arch/xtensa/kernel/pci-dma.c +2 −8
  6. include/linux/dma-noncoherent.h +0 −1
arch/Kconfig+1−1
@@ -249,7 +249,7 @@ config ARCH_HAS_SET_DIRECT_MAP · 248 unmodified lines
249249
250250 #
251251 # Select if arch has an uncached kernel segment and provides the
252−# uncached_kernel_address / cached_kernel_address symbols to use it
252+# uncached_kernel_address symbol to use it
253253 #
254254 config ARCH_HAS_UNCACHED_SEGMENT
255255 select ARCH_HAS_DMA_PREP_COHERENT
arch/microblaze/mm/consistent.c+0−7
@@ -49,11 +49,4 @@ void *uncached_kernel_address(void *ptr) · 48 unmodified lines
4949 pr_warn("ERROR: Your cache coherent area is CACHED!!!\n");
5050 return (void *)addr;
5151 }
52−
53−void *cached_kernel_address(void *ptr)
54−{
55− unsigned long addr = (unsigned long)ptr;
56−
57− return (void *)(addr & ~UNCACHED_SHADOW_MASK);
58−}
5952 #endif /* CONFIG_MMU */
arch/mips/mm/dma-noncoherent.c+0−5
@@ -54,11 +54,6 @@ void *uncached_kernel_address(void *addr) · 53 unmodified lines
5454 return (void *)(__pa(addr) + UNCAC_BASE);
5555 }
5656
57−void *cached_kernel_address(void *addr)
58−{
59− return __va(addr) - UNCAC_BASE;
60−}
61−
6257 static inline void dma_sync_virt(void *addr, size_t size,
6358 enum dma_data_direction dir)
6459 {
arch/nios2/mm/dma-mapping.c+0−10
@@ -75,13 +75,3 @@ void *uncached_kernel_address(void *ptr) · 74 unmodified lines
7575
7676 return (void *)ptr;
7777 }
78−
79−void *cached_kernel_address(void *ptr)
80−{
81− unsigned long addr = (unsigned long)ptr;
82−
83− addr &= ~CONFIG_NIOS2_IO_REGION_BASE;
84− addr |= CONFIG_NIOS2_KERNEL_REGION_BASE;
85−
86− return (void *)ptr;
87−}
arch/xtensa/kernel/pci-dma.c+2−8
@@ -88,18 +88,12 @@ void arch_dma_prep_coherent(struct page *page, size_t size) · 87 unmodified lines
8888
8989 /*
9090 * Memory caching is platform-dependent in noMMU xtensa configurations.
91− * The following two functions should be implemented in platform code
92− * in order to enable coherent DMA memory operations when CONFIG_MMU is not
93− * enabled.
91+ * This function should be implemented in platform code in order to enable
92+ * coherent DMA memory operations when CONFIG_MMU is not enabled.
9493 */
9594 #ifdef CONFIG_MMU
9695 void *uncached_kernel_address(void *p)
9796 {
9897 return p + XCHAL_KSEG_BYPASS_VADDR - XCHAL_KSEG_CACHED_VADDR;
9998 }
100−
101−void *cached_kernel_address(void *p)
102−{
103− return p + XCHAL_KSEG_CACHED_VADDR - XCHAL_KSEG_BYPASS_VADDR;
104−}
10599 #endif /* CONFIG_MMU */
include/linux/dma-noncoherent.h+0−1
@@ -109,6 +109,5 @@ static inline void arch_dma_prep_coherent(struct page *page, size_t size) · 108 unmodified lines
109109 #endif /* CONFIG_ARCH_HAS_DMA_PREP_COHERENT */
110110
111111 void *uncached_kernel_address(void *addr);
112−void *cached_kernel_address(void *addr);
113112
114113 #endif /* _LINUX_DMA_NONCOHERENT_H */