Commit 34dc0ea6 authored by Christoph Hellwig's avatar Christoph Hellwig
Browse files

dma-direct: provide mmap and get_sgtable method overrides



For dma-direct we know that the DMA address is an encoding of the
physical address that we can trivially decode.  Use that fact to
provide implementations that do not need the arch_dma_coherent_to_pfn
architecture hook.  Note that we still can only support mmap of
non-coherent memory only if the architecture provides a way to set an
uncached bit in the page tables.  This must be true for architectures
that use the generic remap helpers, but other architectures can also
manually select it.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
parent 4e1003aa
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -6,7 +6,6 @@
config ARC
config ARC
	def_bool y
	def_bool y
	select ARC_TIMERS
	select ARC_TIMERS
	select ARCH_HAS_DMA_COHERENT_TO_PFN
	select ARCH_HAS_DMA_PREP_COHERENT
	select ARCH_HAS_DMA_PREP_COHERENT
	select ARCH_HAS_PTE_SPECIAL
	select ARCH_HAS_PTE_SPECIAL
	select ARCH_HAS_SETUP_DMA_OPS
	select ARCH_HAS_SETUP_DMA_OPS
+0 −1
Original line number Original line Diff line number Diff line
@@ -7,7 +7,6 @@ config ARM
	select ARCH_HAS_BINFMT_FLAT
	select ARCH_HAS_BINFMT_FLAT
	select ARCH_HAS_DEBUG_VIRTUAL if MMU
	select ARCH_HAS_DEBUG_VIRTUAL if MMU
	select ARCH_HAS_DEVMEM_IS_ALLOWED
	select ARCH_HAS_DEVMEM_IS_ALLOWED
	select ARCH_HAS_DMA_COHERENT_TO_PFN if SWIOTLB
	select ARCH_HAS_DMA_WRITE_COMBINE if !ARM_DMA_MEM_BUFFERABLE
	select ARCH_HAS_DMA_WRITE_COMBINE if !ARM_DMA_MEM_BUFFERABLE
	select ARCH_HAS_ELF_RANDOMIZE
	select ARCH_HAS_ELF_RANDOMIZE
	select ARCH_HAS_FORTIFY_SOURCE
	select ARCH_HAS_FORTIFY_SOURCE
+0 −6
Original line number Original line Diff line number Diff line
@@ -2346,12 +2346,6 @@ void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
			      size, dir);
			      size, dir);
}
}


long arch_dma_coherent_to_pfn(struct device *dev, void *cpu_addr,
		dma_addr_t dma_addr)
{
	return dma_to_pfn(dev, dma_addr);
}

void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
		gfp_t gfp, unsigned long attrs)
		gfp_t gfp, unsigned long attrs)
{
{
+0 −1
Original line number Original line Diff line number Diff line
@@ -12,7 +12,6 @@ config ARM64
	select ARCH_CLOCKSOURCE_DATA
	select ARCH_CLOCKSOURCE_DATA
	select ARCH_HAS_DEBUG_VIRTUAL
	select ARCH_HAS_DEBUG_VIRTUAL
	select ARCH_HAS_DEVMEM_IS_ALLOWED
	select ARCH_HAS_DEVMEM_IS_ALLOWED
	select ARCH_HAS_DMA_COHERENT_TO_PFN
	select ARCH_HAS_DMA_PREP_COHERENT
	select ARCH_HAS_DMA_PREP_COHERENT
	select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
	select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
	select ARCH_HAS_FAST_MULTIPLIER
	select ARCH_HAS_FAST_MULTIPLIER
+1 −1
Original line number Original line Diff line number Diff line
@@ -33,7 +33,7 @@ config IA64
	select HAVE_ARCH_TRACEHOOK
	select HAVE_ARCH_TRACEHOOK
	select HAVE_MEMBLOCK_NODE_MAP
	select HAVE_MEMBLOCK_NODE_MAP
	select HAVE_VIRT_CPU_ACCOUNTING
	select HAVE_VIRT_CPU_ACCOUNTING
	select ARCH_HAS_DMA_COHERENT_TO_PFN
	select DMA_NONCOHERENT_MMAP
	select ARCH_HAS_SYNC_DMA_FOR_CPU
	select ARCH_HAS_SYNC_DMA_FOR_CPU
	select VIRT_TO_BUS
	select VIRT_TO_BUS
	select GENERIC_IRQ_PROBE
	select GENERIC_IRQ_PROBE
Loading