函数名称:dma_alloc_attrs 函数原型:void *dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flag, unsigned long attrs) 返回类型:void 参数: 类型参数名称 struct device * dev size_t size dma_addr_t * dma_handle gfp_t flag unsigned long attrs 267...
staticinlinevoid*dma_alloc_attrs(struct device*dev,size_t size,dma_addr_t*dma_handle,gfp_t flag,unsigned long attrs){conststruct dma_map_ops*ops=get_dma_ops(dev);void*cpu_addr;BUG_ON(!ops);if(dma_alloc_from_dev_coherent(dev,size,dma_handle,&cpu_addr))returncpu_addr;if(!arch_dma_...
我们知道DMA映射有两种方式,一种是一致性映射 dma_alloc_coherent,一种是流式映射 dma_map_single (dma_map_sg可以映射多个dma buffer)。 一致性映射 dma_alloc_coherent dma_alloc_coherent会调用dma_alloc_attrs: static inline void *dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_...
DMA_ATTR_FORCE_CONTIGUOUS 默认情况下,DMA映射子系统允许从dma_alloc_attrs()函数分配的缓冲区由单独的页面组装而成,如果可以将其作为连续块映射到设备DMA地址空间。通过指定此属性,分配的缓冲区将被强制在物理内存中也是连续的。 DMA_ATTR_ALLOC_SINGLE_PAGES 这是对DMA映射子系统的一种提示,表明尝试以提供更好的...
static inline void *dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_ha...
//dma_alloc_coherent -> dma_alloc_attrs -> dma_direct_allocvoid*dma_direct_alloc(structdevice*dev,size_tsize,dma_addr_t*dma_handle,gfp_tgfp,unsignedlongattrs){boolremap=false,set_uncached=false;structpage*page;void*ret;.../* we always manually zero the memory once we are done */--...
默认情况下,DMA映射子系统允许从dma_alloc_attrs()函数分配的缓冲区由单独的页面组装而成,如果可以将其作为连续块映射到设备DMA地址空间。通过指定此属性,分配的缓冲区将被强制在物理内存中也是连续的。 DMA_ATTR_ALLOC_SINGLE_PAGES 这是对DMA映射子系统的一种提示,表明尝试以提供更好的TLB效率的方式分配内存可能...
dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t gfp, struct dma_attrs *attrs) { struct dma_map_ops *ops = get_dma_ops(dev); void *memory; gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32); ...
另外这个函数会调用alloc_page()来分配物理页面,所以不要在中断上下文中使用该API 其实现流程如下:dma_alloc_coherent dma_alloc_attrs ops->alloc __dma_alloc 代码语言:javascript 代码运行次数:0 运行 AI代码解释 staticvoid*__dma_alloc(struct device*dev,size_t size,dma_addr_t*dma_handle,gfp_t flags...
我们知道DMA映射有两种方式,一种是一致性映射 dma_alloc_coherent,一种是流式映射 dma_map_single(dma_map_sg可以映射多个dma buffer)。 一致性映射 dma_alloc_coherent dma_alloc_coherent会调用dma_alloc_attrs: static inline void *dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_ha...