Commit fa7e2247 authored by Christoph Hellwig's avatar Christoph Hellwig
Browse files

dma-direct: make uncached_kernel_address more general



Rename the symbol to arch_dma_set_uncached, and pass a size to it as
well as allow an error return.  That will allow reusing this hook for
in-place pagetable remapping.

As the in-place remap doesn't always require an explicit cache flush,
also detangle ARCH_HAS_DMA_PREP_COHERENT from ARCH_HAS_DMA_SET_UNCACHED.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarRobin Murphy <robin.murphy@arm.com>
parent 3d0fc341
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -248,11 +248,11 @@ config ARCH_HAS_SET_DIRECT_MAP
	bool

#
# Select if arch has an uncached kernel segment and provides the
# uncached_kernel_address symbol to use it
# Select if the architecture provides the arch_dma_set_uncached symbol to
# either provide an uncached segement alias for a DMA allocation, or
# to remap the page tables in place.
#
config ARCH_HAS_UNCACHED_SEGMENT
	select ARCH_HAS_DMA_PREP_COHERENT
config ARCH_HAS_DMA_SET_UNCACHED
	bool

# Select if arch init_task must go in the __init_task_data section
+1 −1
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@ config MICROBLAZE
	select ARCH_HAS_GCOV_PROFILE_ALL
	select ARCH_HAS_SYNC_DMA_FOR_CPU
	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
	select ARCH_HAS_UNCACHED_SEGMENT if !MMU
	select ARCH_HAS_DMA_SET_UNCACHED if !MMU
	select ARCH_MIGHT_HAVE_PC_PARPORT
	select ARCH_WANT_IPC_PARSE_VERSION
	select BUILDTIME_TABLE_SORT
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ void arch_dma_prep_coherent(struct page *page, size_t size)
#define UNCACHED_SHADOW_MASK 0
#endif /* CONFIG_XILINX_UNCACHED_SHADOW */

void *uncached_kernel_address(void *ptr)
void *arch_dma_set_uncached(void *ptr, size_t size)
{
	unsigned long addr = (unsigned long)ptr;

+2 −1
Original line number Diff line number Diff line
@@ -1187,8 +1187,9 @@ config DMA_NONCOHERENT
	# significant advantages.
	#
	select ARCH_HAS_DMA_WRITE_COMBINE
	select ARCH_HAS_DMA_PREP_COHERENT
	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
	select ARCH_HAS_UNCACHED_SEGMENT
	select ARCH_HAS_DMA_SET_UNCACHED
	select DMA_NONCOHERENT_MMAP
	select DMA_NONCOHERENT_CACHE_SYNC
	select NEED_DMA_MAP_STATE
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ void arch_dma_prep_coherent(struct page *page, size_t size)
	dma_cache_wback_inv((unsigned long)page_address(page), size);
}

void *uncached_kernel_address(void *addr)
void *arch_dma_set_uncached(void *addr, size_t size)
{
	return (void *)(__pa(addr) + UNCAC_BASE);
}
Loading