---
name: "dma_mmap_from_coherent"
section: "9"
platform: "linux"
package: "linux-manual-3.16"
version: "3.16.56-1+deb8u1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/dma_mmap_from_coherent"
---

# dma\_mmap\_from\_coherent(9)

try to mmap the memory allocated from per-device coherent memory pool to userspace

## NAME

dma\_mmap\_from\_coherent - try to mmap the memory allocated from per-device coherent memory pool to userspace

## SYNOPSIS

**int dma\_mmap\_from\_coherent(struct device \*** *dev***, struct vm\_area\_struct \*** *vma***, void \*** *vaddr***, size\_t** *size***, int \*** *ret***);**

## ARGUMENTS

*dev*

device from which the memory was allocated

*vma*

vm\_area for the userspace memory

*vaddr*

cpu address returned by dma\_alloc\_from\_coherent

*size*

size of the memory buffer allocated by dma\_alloc\_from\_coherent

*ret*

result from **remap\_pfn\_range**

## DESCRIPTION

This checks whether the memory was allocated from the per-device coherent memory pool and if so, maps that memory to the provided vma.

Returns 1 if we correctly mapped the memory, or 0 if the caller should proceed with mapping memory from generic pools.

## COPYRIGHT
