Skip to contentSkip to conversation

dma-mapping: enable no mmu support in dma_common_mmap

PATCH In review Scott Jiang 2 participants 2 messages Mar 5, 2013 – Mar 13, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dma-mapping: enable no mmu support in dma_common_mmap

No MMU systems also make use of this function to do mmap.

---
 drivers/base/dma-mapping.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/base/dma-mapping.c +0 -2
index 0ce39a3..ae655b2 100644
@@ -245,7 +245,6 @@ int dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
 		    void *cpu_addr, dma_addr_t dma_addr, size_t size)
 {
 	int ret = -ENXIO;
-#ifdef CONFIG_MMU
 	unsigned long user_count = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
 	unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT;
 	unsigned long pfn = page_to_pfn(virt_to_page(cpu_addr));
@@ -262,7 +261,6 @@ int dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
 				      user_count << PAGE_SHIFT,
 				      vma->vm_page_prot);
 	}
-#endif	/* CONFIG_MMU */
 
 	return ret;
 }
Signature · 1 line
1.7.0.4
#1 lore raw

Hello,

Quoted 20 lines · Scott Jiang

No MMU systems also make use of this function to do mmap.

---
  drivers/base/dma-mapping.c |    2 --
  1 files changed, 0 insertions(+), 2 deletions(-)
drivers/base/dma-mapping.c +0 -1
index 0ce39a3..ae655b2 100644
@@ -245,7 +245,6 @@ int dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
  		    void *cpu_addr, dma_addr_t dma_addr, size_t size)
  {
  	int ret = -ENXIO;
-#ifdef CONFIG_MMU
  	unsigned long user_count = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
  	unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT;
  	unsigned long pfn = page_to_pfn(virt_to_page(cpu_addr));

drivers/base/dma-mapping.c int dma_common_mmap(struct device *dev, struct vm_area_struct *vma, · line 266

Quoted 7 lines
drivers/base/dma-mapping.c +0 -1
@@ -262,7 +261,6 @@ int dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
  				      user_count << PAGE_SHIFT,
  				      vma->vm_page_prot);
  	}
-#endif	/* CONFIG_MMU */
 
  	return ret;
  }

I really have no experience with NO-MMU kernels, could you explain a bit more how this is useful for handling mmap on such systems? How remap_pfn_range() is handled on no-mmu systems?

I've thought that mmap on no-mmu systems is silently replaced by a call to get_unmapped_area(), but it looks that there is still a call to mmap function.

Best regards

Signature · 2 lines
Marek Szyprowski
Samsung Poland R&D Center