Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>

+3 -32
+1 -1
arch/Kconfig
··· 249 249 250 250 # 251 251 # 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 253 253 # 254 254 config ARCH_HAS_UNCACHED_SEGMENT 255 255 select ARCH_HAS_DMA_PREP_COHERENT
-7
arch/microblaze/mm/consistent.c
··· 49 49 pr_warn("ERROR: Your cache coherent area is CACHED!!!\n"); 50 50 return (void *)addr; 51 51 } 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 - } 59 52 #endif /* CONFIG_MMU */
-5
arch/mips/mm/dma-noncoherent.c
··· 54 54 return (void *)(__pa(addr) + UNCAC_BASE); 55 55 } 56 56 57 - void *cached_kernel_address(void *addr) 58 - { 59 - return __va(addr) - UNCAC_BASE; 60 - } 61 - 62 57 static inline void dma_sync_virt(void *addr, size_t size, 63 58 enum dma_data_direction dir) 64 59 {
-10
arch/nios2/mm/dma-mapping.c
··· 75 75 76 76 return (void *)ptr; 77 77 } 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 - }
+2 -8
arch/xtensa/kernel/pci-dma.c
··· 88 88 89 89 /* 90 90 * 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. 94 93 */ 95 94 #ifdef CONFIG_MMU 96 95 void *uncached_kernel_address(void *p) 97 96 { 98 97 return p + XCHAL_KSEG_BYPASS_VADDR - XCHAL_KSEG_CACHED_VADDR; 99 - } 100 - 101 - void *cached_kernel_address(void *p) 102 - { 103 - return p + XCHAL_KSEG_CACHED_VADDR - XCHAL_KSEG_BYPASS_VADDR; 104 98 } 105 99 #endif /* CONFIG_MMU */
-1
include/linux/dma-noncoherent.h
··· 109 109 #endif /* CONFIG_ARCH_HAS_DMA_PREP_COHERENT */ 110 110 111 111 void *uncached_kernel_address(void *addr); 112 - void *cached_kernel_address(void *addr); 113 112 114 113 #endif /* _LINUX_DMA_NONCOHERENT_H */