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.
Unified · Split
| @@ -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 the | 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 | config ARCH_HAS_UNCACHED_SEGMENT | 254 | config ARCH_HAS_UNCACHED_SEGMENT |
| 255 | select ARCH_HAS_DMA_PREP_COHERENT | 255 | select ARCH_HAS_DMA_PREP_COHERENT |
| @@ -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 | |||
| 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 | #endif /* CONFIG_MMU */ | 52 | #endif /* CONFIG_MMU */ |
| @@ -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 | ||
| 57 | void *cached_kernel_address(void *addr) | ||
| 58 | { | ||
| 59 | return __va(addr) - UNCAC_BASE; | ||
| 60 | } | ||
| 61 | |||
| 62 | static inline void dma_sync_virt(void *addr, size_t size, | 57 | static inline void dma_sync_virt(void *addr, size_t size, |
| 63 | enum dma_data_direction dir) | 58 | enum dma_data_direction dir) |
| 64 | { | 59 | { |
| @@ -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 | |||
| 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 | } | ||
| @@ -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 code | 91 | * 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 not | 92 | * coherent DMA memory operations when CONFIG_MMU is not enabled. |
| 93 | * enabled. | ||
| 94 | */ | 93 | */ |
| 95 | #ifdef CONFIG_MMU | 94 | #ifdef CONFIG_MMU |
| 96 | void *uncached_kernel_address(void *p) | 95 | void *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 | |||
| 101 | void *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 */ |
| @@ -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 | ||
| 111 | void *uncached_kernel_address(void *addr); | 111 | void *uncached_kernel_address(void *addr); |
| 112 | void *cached_kernel_address(void *addr); | ||
| 113 | 112 | ||
| 114 | #endif /* _LINUX_DMA_NONCOHERENT_H */ | 113 | #endif /* _LINUX_DMA_NONCOHERENT_H */ |