dma_alloc_coherent->dma_alloc_attrs 根据是否direct(有smmu),分别调用dma_direct_alloc 或者ops->alloc (dma_map_ops) 见上。 iommu_dma_alloc //根据参数 非连续物理内存: iommu_dma_alloc_remap __iommu_dma_alloc_pages //此处分配非连续的物理页 iommu_dma_alloc_iova iommu_map_sg_atomic __iommu_...
(2)直接从系统内存中分配(dma_direct_alloc) 只有当该设备没有注册dma内存操作函数时,才会从系统中直接分配内存,否则就会通过step 3的方式分配。此时,根据DMA是否支持硬件cache一致性,确定其分配流程,其中设备是否支持硬件一致性可以通过dts中的dma-coherent参数设置。 当设备不支持硬件一致性时,若其支持global dma po...
.alloc_pages_op = dma_direct_alloc_pages, .free_pages = dma_direct_free_pages, };2 changes: 1 addition & 1 deletion 2 drivers/iommu/dma-iommu.c Original file line numberDiff line numberDiff line change @@ -1644,7 +1644,7 @@ static const struct dma_map_ops iommu_dma_ops = { ...
//caq:direct模式下的dma_map_ops,不同的模式有不同的ops实现,356da6d0cde之后,就改为直接了,没有封装ops,因为direct比较简单 const struct dma_map_ops dma_direct_ops = { .alloc = dma_direct_alloc, .free = dma_direct_free, .map_page = dma_direct_map_page,//caq:只有map,ops没有实现unmap...
[ 411.470684] dma_direct_alloc_pages+0x28/0x120[ 411.470685] dma_direct_alloc+0xe/0x10[ 411.470686] dma_alloc_attrs+0x30/0x60[ 411.470689] intel_fpga_pcie_dma_probe+0x133/0x280 [intel_fpga_pcie_drv][ 411.470690] intel_fpga_pcie_probe+0x3dd/0x...
The device transfers to and from a contiguous virtual image that can be mapped to discontiguous physical pages. Devices that operate in these platforms don't need scatter-gather DMA capability. Typically, SPARC platforms provide virtual addresses for direct memory transfers. ...
dma_addr_t dma_handle;cpu_addr=dma_alloc_coherent(dev,size,&dma_handle,gfp); 其中device 是一个“struct device *”。 这可以在中断上下文中使用 GFP_ATOMIC 标志来调用。 Size 是要分配的区域的长度(以字节为单位)。 该例程将为该区域分配 RAM,因此它的作用与 __get_free_pages() 类似(但采用大小...
* allocates pages, and will return the CPU-viewed address, and sets @handle * to be the device-viewed address. */void*dma_alloc_coherent(structdevice *dev,size_tsize,dma_addr_t*dma_handle,gfp_tflag)//申请PCI设备的DMA缓冲区void*pci_alloc_consistent(structpci_dev *hwdev,size_tsize,dma...
* allocates pages, and will return the CPU-viewed address, and sets @handle * to be the device-viewed address. */ void * dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flag) //申请PCI设备的DMA缓冲区 ...
Linux 系统下基于PCI 控制器(PLX9054)的DMA 编程