Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\dma\mapping.c Create Date:2022-07-28 10:32:39
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Create userspace mapping for the DMA-coherent memory.

Proto:int dma_common_mmap(struct device *dev, struct vm_area_struct *vma, void *cpu_addr, dma_addr_t dma_addr, size_t size, unsigned long attrs)

Type:int

Parameter:

TypeParameterName
struct device *dev
struct vm_area_struct *vma
void *cpu_addr
dma_addr_tdma_addr
size_tsize
unsigned longattrs
177  user_count = vma_pages(vma)
178  count = align the pointer to the (next) page boundary (size) >> PAGE_SHIFT determines the page size
179  off = Offset (within vm_file) in PAGE_SIZEunits
180  ret = -ENXIO
182  Access permissions of this VMA. = Return the page attributes used for mapping dma_alloc_* memory, either in* kernel space if remapping is needed, or to userspace through dma_mmap_*.
184  If dma_mmap_from_dev_coherent(dev, vma, cpu_addr, size, & ret) Then Return ret
187  If off >= count || user_count > count - off Then Return -ENXIO
190  Return remap_pfn_range(vma, Our start address within vm_mm. , page_to_pfn(virt_to_page(kaddr) returns a valid pointer if and only if* virt_addr_valid(kaddr) returns true.(cpu_addr)) + Offset (within vm_file) in PAGE_SIZEunits , user_count << PAGE_SHIFT determines the page size , Access permissions of this VMA. )