当前位置:网站首页>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)
边栏推荐
- What exactly does Devops mean?
- 年金险还能买吗?年金险安不安全?
- Optimization of startup under SYSTEMd, deleting useless SYSTEMd services
- Slam Kalman filter & nonlinear optimization
- 嵌入式学习资料和项目汇总
- Unity 容易被坑的点
- 阻塞队列 — DelayedWorkQueue源码分析
- Blocking queue - delayedworkqueue source code analysis
- [ROS tutorial] - 02 ROS installation
- C语言实现设置桌面壁纸
猜你喜欢
![[introduction to ROS] - 03 ROS workspace and function pack](/img/74/ff9bf9fd4912a02d016f560ac3aebb.png)
[introduction to ROS] - 03 ROS workspace and function pack

最好的创意鼓工具:Groove Agent 5

About log traffic monitoring and early warning small project | flag log monitoring script
![[论文阅读] BoostMIS: Boosting Medical Image Semi-supervised Learning with Adaptive Pseudo Labeling](/img/10/a60cfe830e2238de00121d7bd95ad6.png)
[论文阅读] BoostMIS: Boosting Medical Image Semi-supervised Learning with Adaptive Pseudo Labeling

Dynamic programming classical topic triangle shortest path

The driver has not received any packets from the server

CentOS7 实战部署MySQL8(二进制方式)

适配器模式
【ROS入门教程】---- 02 ROS安装

【ROS入门教程】---- 03 ROS工作空间与功能包
随机推荐
Load balancing strategy graphic explanation
Josephus problem_ Unidirectional circular linked list_ code implementation
Philips coo will be assigned to solve the dual crisis of "supply chain and product recall" in the face of crisis due to personnel change
扎实的基础知识+正确的方法是快速阅读源码的关键
CentOS实战部署redis
Introduction and basic construction of kubernetes
systemd 下开机启动的优化,删除无用的systemd服务
Small project on log traffic monitoring and early warning | environment foundation 2
WPF basic animation
What is MYCAT? Get to know you quickly
Wechat applet to realize OCR scanning recognition
[introduction to ROS] - 03 single chip microcomputer, PC host and ROS communication mechanism
pytorch分类问题总结
Deep copy and shallow copy in golang
Small project on log traffic monitoring and early warning | environment and foundation 1
The principle and source code interpretation of executor thread pool in concurrent programming
时间相关-格式、运算、比较、转换
[论文阅读] BoostMIS: Boosting Medical Image Semi-supervised Learning with Adaptive Pseudo Labeling
QT program plug-in reports an error plugin xcb
Network Engineer required course firewall security zone and basic operation of security policy