Skip to content

Commit

Permalink
dma-direct: remove the cached_kernel_address hook
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Robin Murphy <[email protected]>
  • Loading branch information
Christoph Hellwig committed Mar 16, 2020
1 parent 286c21d commit 4f8232b
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 32 deletions.
2 changes: 1 addition & 1 deletion arch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ config ARCH_HAS_SET_DIRECT_MAP

#
# Select if arch has an uncached kernel segment and provides the
# uncached_kernel_address / cached_kernel_address symbols to use it
# uncached_kernel_address symbol to use it
#
config ARCH_HAS_UNCACHED_SEGMENT
select ARCH_HAS_DMA_PREP_COHERENT
Expand Down
7 changes: 0 additions & 7 deletions arch/microblaze/mm/consistent.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,4 @@ void *uncached_kernel_address(void *ptr)
pr_warn("ERROR: Your cache coherent area is CACHED!!!\n");
return (void *)addr;
}

void *cached_kernel_address(void *ptr)
{
unsigned long addr = (unsigned long)ptr;

return (void *)(addr & ~UNCACHED_SHADOW_MASK);
}
#endif /* CONFIG_MMU */
5 changes: 0 additions & 5 deletions arch/mips/mm/dma-noncoherent.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ void *uncached_kernel_address(void *addr)
return (void *)(__pa(addr) + UNCAC_BASE);
}

void *cached_kernel_address(void *addr)
{
return __va(addr) - UNCAC_BASE;
}

static inline void dma_sync_virt(void *addr, size_t size,
enum dma_data_direction dir)
{
Expand Down
10 changes: 0 additions & 10 deletions arch/nios2/mm/dma-mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,3 @@ void *uncached_kernel_address(void *ptr)

return (void *)ptr;
}

void *cached_kernel_address(void *ptr)
{
unsigned long addr = (unsigned long)ptr;

addr &= ~CONFIG_NIOS2_IO_REGION_BASE;
addr |= CONFIG_NIOS2_KERNEL_REGION_BASE;

return (void *)ptr;
}
10 changes: 2 additions & 8 deletions arch/xtensa/kernel/pci-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,12 @@ void arch_dma_prep_coherent(struct page *page, size_t size)

/*
* Memory caching is platform-dependent in noMMU xtensa configurations.
* The following two functions should be implemented in platform code
* in order to enable coherent DMA memory operations when CONFIG_MMU is not
* enabled.
* This function should be implemented in platform code in order to enable
* coherent DMA memory operations when CONFIG_MMU is not enabled.
*/
#ifdef CONFIG_MMU
void *uncached_kernel_address(void *p)
{
return p + XCHAL_KSEG_BYPASS_VADDR - XCHAL_KSEG_CACHED_VADDR;
}

void *cached_kernel_address(void *p)
{
return p + XCHAL_KSEG_CACHED_VADDR - XCHAL_KSEG_BYPASS_VADDR;
}
#endif /* CONFIG_MMU */
1 change: 0 additions & 1 deletion include/linux/dma-noncoherent.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,5 @@ static inline void arch_dma_prep_coherent(struct page *page, size_t size)
#endif /* CONFIG_ARCH_HAS_DMA_PREP_COHERENT */

void *uncached_kernel_address(void *addr);
void *cached_kernel_address(void *addr);

#endif /* _LINUX_DMA_NONCOHERENT_H */

0 comments on commit 4f8232b

Please sign in to comment.