Skip to content

Commit 1fbf57d

Browse files
author
Christoph Hellwig
committed
dma-direct: re-enable mmap for !CONFIG_MMU
nommu configfs can trivially map the coherent allocations to user space, as no actual page table setup is required and the kernel and the user space programs share the same address space. Fixes: 62fcee9 ("dma-mapping: remove CONFIG_ARCH_NO_COHERENT_DMA_MMAP") Signed-off-by: Christoph Hellwig <hch@lst.de> Reported-by: dillon min <dillon.minfei@gmail.com> Reviewed-by: Vladimir Murzin <vladimir.murzin@arm.com> Tested-by: dillon min <dillon.minfei@gmail.com>
1 parent dbed452 commit 1fbf57d

2 files changed

Lines changed: 1 addition & 14 deletions

File tree

‎kernel/dma/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ config SWIOTLB
7171
# in the pagetables
7272
#
7373
config DMA_NONCOHERENT_MMAP
74+
default y if !MMU
7475
bool
7576

7677
config DMA_COHERENT_POOL

‎kernel/dma/direct.c‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,6 @@ int dma_direct_get_sgtable(struct device *dev, struct sg_table *sgt,
459459
return ret;
460460
}
461461

462-
#ifdef CONFIG_MMU
463462
bool dma_direct_can_mmap(struct device *dev)
464463
{
465464
return dev_is_dma_coherent(dev) ||
@@ -485,19 +484,6 @@ int dma_direct_mmap(struct device *dev, struct vm_area_struct *vma,
485484
return remap_pfn_range(vma, vma->vm_start, pfn + vma->vm_pgoff,
486485
user_count << PAGE_SHIFT, vma->vm_page_prot);
487486
}
488-
#else /* CONFIG_MMU */
489-
bool dma_direct_can_mmap(struct device *dev)
490-
{
491-
return false;
492-
}
493-
494-
int dma_direct_mmap(struct device *dev, struct vm_area_struct *vma,
495-
void *cpu_addr, dma_addr_t dma_addr, size_t size,
496-
unsigned long attrs)
497-
{
498-
return -ENXIO;
499-
}
500-
#endif /* CONFIG_MMU */
501487

502488
int dma_direct_supported(struct device *dev, u64 mask)
503489
{

0 commit comments

Comments
 (0)