dma_sync_sg_for_cpu() dma_sync_sg_for_device() 流式DMA映射对于CPU何时可以操作DMA缓冲区有严格的要求,只能等到dma_unmap_single后CPU才可以操作该缓冲区。 究其原因,是因为流式DMA缓冲区是cached,在map时刷了下cache,在设备DMA完成unmap时再刷cache(根据数据流向写回或者无效),来保证了cache数据一致性,在...
dma_direct_sync_single_for_cpu(dev, addr, size, dir); else if (ops->sync_single_for_cpu) ops->sync_single_for_cpu(dev, addr, size, dir); debug_dma_sync_single_for_cpu(dev, addr, size, dir); } EXPORT_SYMBOL(dma_sync_single_for_cpu); void dma_sync_single_for_device(struct d...
void dma_sync_single_for_cpu(struct device *dev, dma_handle_t bus_addr, size_t size, enum dma_data_direction direction); void dma_sync_single_for_device(struct device *dev, dma_handle_t bus_addr, size_t size, enum dma_data_direction direction); 单页流式映射 dma_addr_t dma_map_...
void dma_sync_single_for_cpu(struct device *dev,dma_handle_t bus_addr,size_t size,enmu dma_data_direction direction);//应该在处理器访问流式DMA缓冲区前调用该函数。一旦调用,则处理器将“拥有”DMA缓冲区,并可根据需要对他进行访问。 void dam_sync_single_for_device(...)//在设备访问缓冲区前,...
dma_sync_single_for_cpu(xskb->pool->dev, xskb->dma, xskb->pool->frame_len, DMA_BIDIRECTIONAL); } void xp_dma_sync_for_device_slow(struct xsk_buff_pool *pool, dma_addr_t dma, size_t size); static inline void xp_dma_sync_for_device(struct xsk_buff_pool *pool, dma_addr_t dm...
(1)使用remap_pfn_range函数一次全部建立。 (2)通过nopage VMA方法每次建立一个页表。 使用remap_pfn_range remap_pfn_range和io_remap_page_range负责为一段物理地址建立新的页表,它们有如下的原型: int remap_pfn_range(struct vm_area_struct *vma, unsigned long virt_addr, unsigned long pfn); ...
virtqueue_dma_sync_single_range_for_cpu(rq->vq, dma->addr, offset, len, DMA_FROM_DEVICE); }return; }virtqueue_dma_unmap_single_attrs(rq->vq, dma->addr, dma->len, DMA_FROM_DEVICE, DMA_ATTR_SKIP_CPU_SYNC); put_page(page);
Therefore, much of the work has been done by the kernel; to implement mmap, the driver only has to build suitable page tables for the address range and, if necessary, replace vma->vm_ops with a new set of operations. There are two ways of building the page tables: doing it all at ...
void dma_unmap_single(struct device *dev, dma_addr_t bus_addr, size_t size, enum dma_data_direction direction); 创建和销毁一个单使用,流DMA映射. void dma_sync_single_for_cpu(struct device *dev, dma_handle_t bus_addr, size_t size, enum ...
3.4.3 dma_unmap_single 8 概述 由于处理器存在cache,cache和内存中数据可能不一致,所以驱动在使用dma在内存和device之间搬移数据前后需要cpu对cache和内存中数据进行同步。有些dma寻址能力有限,比如只能寻址内存低128m,但数据在内存的1G地址处,这时需要进行数据转移。