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
249 249
250#250#
251# Select if arch has an uncached kernel segment and provides the251# Select if arch has an uncached kernel segment and provides the
252# uncached_kernel_address / cached_kernel_address symbols to use it252# uncached_kernel_address symbol to use it
253#253#
254config ARCH_HAS_UNCACHED_SEGMENT254config ARCH_HAS_UNCACHED_SEGMENT
255 select ARCH_HAS_DMA_PREP_COHERENT255 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
49 pr_warn("ERROR: Your cache coherent area is CACHED!!!\n");49 pr_warn("ERROR: Your cache coherent area is CACHED!!!\n");
50 return (void *)addr;50 return (void *)addr;
51}51}
52
53void *cached_kernel_address(void *ptr)
54{
55 unsigned long addr = (unsigned long)ptr;
56
57 return (void *)(addr & ~UNCACHED_SHADOW_MASK);
58}
59#endif /* CONFIG_MMU */52#endif /* CONFIG_MMU */
arch/mips/mm/dma-noncoherent.c+0−5
@@ -54,11 +54,6 @@ void *uncached_kernel_address(void *addr) · 53 unmodified lines
54 return (void *)(__pa(addr) + UNCAC_BASE);54 return (void *)(__pa(addr) + UNCAC_BASE);
55}55}
56 56
57void *cached_kernel_address(void *addr)
58{
59 return __va(addr) - UNCAC_BASE;
60}
61
62static inline void dma_sync_virt(void *addr, size_t size,57static inline void dma_sync_virt(void *addr, size_t size,
63 enum dma_data_direction dir)58 enum dma_data_direction dir)
64{59{
arch/nios2/mm/dma-mapping.c+0−10
@@ -75,13 +75,3 @@ void *uncached_kernel_address(void *ptr) · 74 unmodified lines
75 75
76 return (void *)ptr;76 return (void *)ptr;
77}77}
78
79void *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
88 88
89/*89/*
90 * Memory caching is platform-dependent in noMMU xtensa configurations.90 * Memory caching is platform-dependent in noMMU xtensa configurations.
91 * The following two functions should be implemented in platform code91 * This function should be implemented in platform code in order to enable
92 * in order to enable coherent DMA memory operations when CONFIG_MMU is not92 * coherent DMA memory operations when CONFIG_MMU is not enabled.
93 * enabled.
94 */93 */
95#ifdef CONFIG_MMU94#ifdef CONFIG_MMU
96void *uncached_kernel_address(void *p)95void *uncached_kernel_address(void *p)
97{96{
98 return p + XCHAL_KSEG_BYPASS_VADDR - XCHAL_KSEG_CACHED_VADDR;97 return p + XCHAL_KSEG_BYPASS_VADDR - XCHAL_KSEG_CACHED_VADDR;
99}98}
100
101void *cached_kernel_address(void *p)
102{
103 return p + XCHAL_KSEG_CACHED_VADDR - XCHAL_KSEG_BYPASS_VADDR;
104}
105#endif /* CONFIG_MMU */99#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
109#endif /* CONFIG_ARCH_HAS_DMA_PREP_COHERENT */109#endif /* CONFIG_ARCH_HAS_DMA_PREP_COHERENT */
110 110
111void *uncached_kernel_address(void *addr);111void *uncached_kernel_address(void *addr);
112void *cached_kernel_address(void *addr);
113 112
114#endif /* _LINUX_DMA_NONCOHERENT_H */113#endif /* _LINUX_DMA_NONCOHERENT_H */