当前位置:网站首页>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)
边栏推荐
- pytorch分类问题总结
- Small project on log traffic monitoring and early warning | environment foundation 2
- QT thread and interface
- SLAM卡尔曼滤波&&非线性优化
- Volatile keyword for concurrent programming
- Can I buy annuity insurance? Is annuity insurance safe?
- The best creative drum tool: groove agent 5
- MySQL
- System interpretation: Authority Design Guide
- Redis data has been overwritten
猜你喜欢

The principle and source code interpretation of executor thread pool in concurrent programming

SQL审核 | “云上”用户可以一键使用 SQLE 审核服务啦

循环结构语句

Random points in non overlapping rectangles

为什么使用 Golang 进行 Web 开发

【ROS入门教程】---- 03 ROS工作空间与功能包

五大类型负载均衡的原理场景详解

阻塞隊列 — DelayedWorkQueue源碼分析

SQL audit | "cloud" users can use the SQL audit service with one click

The driver has not received any packets from the server
随机推荐
[persistent problems of NVIDIA driver] - - /dev/sdax:clean, xxx/xxx files, xxx/xxx blocks - the most complete solution
Deploy netron services through kubernetes and specify model files at startup
增额终身寿险产品都有哪些优势?门槛高吗?
Unity 容易被坑的点
About log traffic monitoring and early warning small project | database management tool: migrate
嵌入式学习资料和项目汇总
[ROS tutorial] - 02 ROS installation
五大类型负载均衡的原理场景详解
集线器、交换机与路由器有什么区别?
Introduction and basic construction of kubernetes
招聘 | 南京 | TRIOSTUDIO 三厘社 – 室内设计师 / 施工图深化设计师 / 装置/产品设计师 / 实习生等
[论文阅读] BoostMIS: Boosting Medical Image Semi-supervised Learning with Adaptive Pseudo Labeling
循环结构语句
[introduction to ROS] - 03 basic concepts and instructions of ROS
lucene思维导图,让搜索引擎不再难懂
阻塞队列 — DelayedWorkQueue源码分析
OTA升级
阿里云配置SLB(负载均衡)实例
STM32 cannot download again after downloading the code
DeepStream系列之鱼眼相机测试