Thread (2 messages) 2 messages, 2 authors, 2016-11-02

Re: [PATCH] arc: Implement arch-specific dma_map_ops.mmap

From: Catalin Marinas <catalin.marinas@arm.com>
Date: 2016-11-02 17:09:13
Also in: lkml, stable

On Wed, Nov 02, 2016 at 03:19:43PM +0300, Alexey Brodkin wrote:
quoted hunk ↗ jump to hunk
diff --git a/arch/arc/mm/dma.c b/arch/arc/mm/dma.c
index 20afc65e22dc..034ec6a8a764 100644
--- a/arch/arc/mm/dma.c
+++ b/arch/arc/mm/dma.c
@@ -105,6 +105,31 @@ static void arc_dma_free(struct device *dev, size_t size, void *vaddr,
 	__free_pages(page, get_order(size));
 }
 
+static int arc_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+			void *cpu_addr, dma_addr_t dma_addr, size_t size,
+			unsigned long attrs)
+{
+	unsigned long user_count = vma_pages(vma);
+	unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT;
+	unsigned long pfn = __phys_to_pfn(dma_addr);
I don't think that's correct in all situations. Better as (for arc):

	unsigned long pfn = __phys_to_pfn(plat_dma_to_phys(dma_addr));

Other than that:

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help