当前位置:网站首页>ion_dma_buf_begin_cpu_access
ion_dma_buf_begin_cpu_access
2022-06-10 23:57:00 【wmzjzwlzs】
static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
enum dma_data_direction direction)
{
struct ion_buffer *buffer = dmabuf->priv;
void *vaddr;
struct ion_dma_buf_attachment *a;
int ret = 0;
/*
* TODO: Move this elsewhere because we don't always need a vaddr
*/
if (buffer->heap->ops->map_kernel) {
mutex_lock(&buffer->lock);
vaddr = ion_buffer_kmap_get(buffer);
if (IS_ERR(vaddr)) {
ret = PTR_ERR(vaddr);
goto unlock;
}
mutex_unlock(&buffer->lock);
}
mutex_lock(&buffer->lock);
list_for_each_entry(a, &buffer->attachments, list) {
dma_sync_sg_for_cpu(a->dev, a->table->sgl, a->table->nents,
direction);
}
unlock:
mutex_unlock(&buffer->lock);
return ret;
}
static inline void
dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
int nelems, enum dma_data_direction dir)
{
const struct dma_map_ops *ops = get_dma_ops(dev);
BUG_ON(!valid_dma_direction(dir));
if (dma_is_direct(ops))
dma_direct_sync_sg_for_cpu(dev, sg, nelems, dir);
else if (ops->sync_sg_for_cpu)
ops->sync_sg_for_cpu(dev, sg, nelems, dir);
debug_dma_sync_sg_for_cpu(dev, sg, nelems, dir);
}
sync_sg_for_cpu __dma_unmap_area
sync_sg_for_device __dma_map_area
ENTRY(__dma_map_area)
cmp w2, #DMA_FROM_DEVICE
b.eq __dma_inv_area
b __dma_clean_area
ENDPIPROC(__dma_map_area)
/* * __dma_unmap_area(start, size, dir) * - start - kernel virtual start address * - size - size of region * - dir - DMA direction */
ENTRY(__dma_unmap_area)
cmp w2, #DMA_TO_DEVICE
b.ne __dma_inv_area ret
ENDPIPROC(__dma_unmap_area)
边栏推荐
- How word inserts a guide (dot before page number) into a table of contents
- Download Google gcr IO image
- 微信小程序实现OCR扫描识别
- BGP basic concept and iBGP basic configuration
- 记录oracle的几个参数 db_files,Cursor_sharing ,open_cursor
- Google搜索为什么不能无限分页?
- WIN11卸载小组件
- [network planning] 3.2 transport layer - UDP: connectionless service
- 中小企业数字化转型为什么这么难?
- Controltemplate in WPF
猜你喜欢

Complete collection of MySQL exercises (with answers) - you will know everything after practice

集线器、交换机与路由器有什么区别?

非重叠矩形中的随机点

compiler explorer

海贼oj#146.字符串

How word removes the header line
![[network planning] 2.2.3 user server interaction: cookies](/img/a8/74a1b44ce4d8b0b1a85043a091a91d.jpg)
[network planning] 2.2.3 user server interaction: cookies

The driver has not received any packets from the server
![[network planning] 1.5 seven layer network model and five layer network model](/img/a8/74a1b44ce4d8b0b1a85043a091a91d.jpg)
[network planning] 1.5 seven layer network model and five layer network model
![[network planning] 2.4 DNS: directory service of the Internet](/img/a8/74a1b44ce4d8b0b1a85043a091a91d.jpg)
[network planning] 2.4 DNS: directory service of the Internet
随机推荐
Logback log framework
[network planning] 1.5 seven layer network model and five layer network model
【ROS入门教程】---- 02 ROS安装
如何保证消息的顺序性、消息不丢失、不被重复消费
[network planning] 3.2 transport layer - UDP: connectionless service
Serrures dans SQLSERVER
Block queue - delayedworkqueue Source Analysis
Small project on log traffic monitoring and early warning | environment and foundation 1
阻塞队列 — DelayedWorkQueue源码分析
Room first use
Brief introduction to MySQL lock and transaction isolation level
Datatemplate in WPF
嵌入式学习资料和项目汇总
Qt线程与界面
async await
[论文阅读] TGANet: Text-guided attention for improved polyp segmentation
集线器、交换机与路由器有什么区别?
What is thread in concurrent programming
Kubernetes入门介绍与基础搭建
Fastdfs quick start