当前位置:网站首页>ion_ dma_ buf_ begin_ cpu_ access
ion_ dma_ buf_ begin_ cpu_ access
2022-06-11 01:05: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)
边栏推荐
- logback日志框架
- Pirate OJ 448 luck draw
- cosine 相似度计算总结
- [introduction to ROS] - 03 basic concepts and instructions of ROS
- No module named CV2
- Blocking queue - delayedworkqueue source code analysis
- Le meilleur outil de tambour créatif: Groove agent 5
- Ts+fetch to upload selected files
- 扎实的基础知识+正确的方法是快速阅读源码的关键
- 如何保证消息的顺序性、消息不丢失、不被重复消费
猜你喜欢

87.(leaflet之家)leaflet军事标绘-直线箭头修改

Random points in non overlapping rectangles

Complete uninstallation of MySQL under Linux

中小企业数字化转型为什么这么难?

Le meilleur outil de tambour créatif: Groove agent 5

Volatile keyword for concurrent programming

About log traffic monitoring and early warning small project | Kafka vs redis

C语言实现设置桌面壁纸
![[introduction to ROS] - 03 single chip microcomputer, PC host and ROS communication mechanism](/img/ad/d798284ceb370f7c68cbab755a11de.png)
[introduction to ROS] - 03 single chip microcomputer, PC host and ROS communication mechanism

Small project on log traffic monitoring and early warning | environment foundation 2
随机推荐
What is the difference between hubs, switches and routers?
MySQL
MySql 触发器
Random points in non overlapping rectangles
Pirate OJ 146 character string
SqlServer中的锁
Solid basic knowledge + correct method is the key to quickly read the source code
[论文翻译] Recent Advances in Open Set Recognition: A Survey
Animation
[论文阅读] TGANet: Text-guided attention for improved polyp segmentation
阿里云配置SLB(负载均衡)实例
SLAM卡尔曼滤波&&非线性优化
Block queue - delayedworkqueue Source Analysis
Josephus problem_ Unidirectional circular linked list_ code implementation
Network Engineer required course firewall security zone and basic operation of security policy
DevOps到底是什么意思?
Serrures dans SQLSERVER
五大类型负载均衡的原理场景详解
【ROS入门教程】---- 01 ROS介绍
table_exists_action=append和table_exists_action=truncate