当前位置:网站首页>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)
边栏推荐
- 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
- Deep copy and shallow copy in golang
- About log traffic monitoring and early warning small project | Kafka vs redis
- Pirate OJ 448 luck draw
- systemd 下开机启动的优化,删除无用的systemd服务
- 时间相关-格式、运算、比较、转换
- Google搜索为什么不能无限分页?
- Kubeflow 1.2.0 installation
- 大厂是面对深度分页问题是如何解决的(通俗易懂)
- What is MYCAT? Get to know you quickly
猜你喜欢
随机推荐
动态规划经典题目三角形最短路径
About log traffic monitoring and early warning small project | database management tool: migrate
About log traffic monitoring and early warning small project | flask
[kingcraft] 3.1 link layer - functions of data link layer
Can I buy annuity insurance? Is annuity insurance safe?
A simple understanding of B tree
[network planning] 2.4 DNS: directory service of the Internet
Datatemplate in WPF
Synchronized keyword for concurrent programming
Objects as points personal summary
Dictionary sort of array
B 树的简单认识
QT program plug-in reports an error plugin xcb
[论文阅读] TGANet: Text-guided attention for improved polyp segmentation
STM32下载代码后出现无法再次下载的问题
Ts+fetch to upload selected files
About the log traffic monitoring and early warning small project | standardized return of interaction with the database in flask
[论文阅读] FixMatch: Simplifying Semi-Supervised Learning with Consistency and Confidence
Optimization of startup under SYSTEMd, deleting useless SYSTEMd services
qt程序插件报错plugin xcb









