dma_map_sg函数定义在/asm/dma-mapping.h中,如下所示: intdma_map_sg(structdevice*dev,structscatterlist*sglist,intnents,enumdma_data_directiondir){...}参数*dev是设备结构体;参数*sg是scatterlist结构体数组;参数nents是页数,也就是SG缓存块的个数;参数direction是DMA传输方向,它是一个枚举类型变量; 常...
(5) 上一小节说到scatterlist结构体描述SG缓存块的,包含页面、页内偏移、长度等信息,Linux提供了sg_set_page函数来把这些信息存入scatterlist结构体中(遍历scatterlist结构体数组一个一个分配)。 (6) 最后调用dma_map_sg函数建立SGDMA映射,此时SGDMA的环境就建立好了。dma_map_sg函数定义在/asm/dma-mapping.h中,...
.get_sgtable = iommu_dma_get_sgtable, .map_page = iommu_dma_map_page, ---(2) .unmap_page = iommu_dma_unmap_page, .map_sg = iommu_dma_map_sg, .unmap_sg = iommu_dma_unmap_sg, .sync_single_for_cpu = iommu_dma_sync_single_for_cpu, .sync_single_for_device = iommu_dma_sync...
.get_sgtable = iommu_dma_get_sgtable, .map_page = iommu_dma_map_page, .unmap_page = iommu_dma_unmap_page, .map_sg = iommu_dma_map_sg, .unmap_sg = iommu_dma_unmap_sg, .sync_single_for_cpu = iommu_dma_sync_single_for_cpu, .sync_single_for_device = iommu_dma_sync_single_fo...
返回的 sg_table 保证有 1 个单一的 DMA 映射段,如 sgt->nents 所示,但可能有多个 CPU 端段,如 sgt->orig_nents 所示。 dir 参数指定设备是读取和/或写入数据,详细信息请参阅 dma_map_single()。 gfp 参数允许调用者指定 GFP_ 标志(参见 kmalloc())进行分配,但拒绝用于指定内存区域的标志,如 GFP_DMA...
还有dma_map_sg, dma_unmap_sg这两个API,有的dma引擎较强,支持 聚集散列,自动传n个buffer,第一个传完,传第二个,并不需要连续的内存做DMA.可以用上述两个api,可以将多个不连续的 buffer 做自动传输(以后接触到再查资料学习把)。 dma_alloc_coherent的例外 ...
static struct dma_map_ops iommu_dma_ops = { .alloc = __iommu_alloc_attrs, .free = __iommu_free_attrs, .mmap = __iommu_mmap_attrs, .get_sgtable = __iommu_get_sgtable, .map_page = __iommu_map_page, .unmap_page = __iommu_unmap_page, ...
[ 9.669428] debug_dma_map_sg+0x2b0/0x350 [ 9.673439] __dma_map_sg_attrs+0xa0/0x110 [ 9.677536] dma_map_sgtable+0x28/0x44 [ 9.681284] drm_gem_map_dma_buf+0x5c/0xd4 [ 9.685381] __map_dma_buf+0x2c/0xa0 [ 9.688957] dma_buf_map_attachment+0xa0/...
But we cannot udpate linux version at will, we must use ubuntu release kernel. So i am here for some help. I think this bug afftect the cuda api who call linux api dma_map_sg to map large size system memory. Is nvidia encounter this bug? we can avoid ...
我们知道DMA映射有两种方式,一种是一致性映射 dma_alloc_coherent,一种是流式映射 dma_map_single(dma_map_sg可以映射多个dma buffer)。 一致性映射 dma_alloc_coherent dma_alloc_coherent会调用dma_alloc_attrs: 代码语言:javascript 复制 staticinlinevoid*dma_alloc_attrs(struct device*dev,size_t size,dma_...