summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuofei Ma <ruofeim@google.com>2022-10-11 11:14:25 -0700
committerRuofei Ma <ruofeim@google.com>2022-10-11 11:31:05 -0700
commit04aeae0b3b439dfc3f2e0a67f69c1edb07c912e1 (patch)
treea9d064e2a47a13ab4d601972c3c19c5651b37fc0
parent13340e7b61d888f2997165405fc2364c724b5ef2 (diff)
downloadgchips-04aeae0b3b439dfc3f2e0a67f69c1edb07c912e1.tar.gz
Use fd instead of dmabuf
Since we are using lazy unmap, we don't need to use dmabuf as an identifier to guarantee each buffer is mapped only once. With fd, same buffer can be mapped multiple times, and the map count is managed by iommu driver. Userspace may map the same buffer multiple times so using fd makes buffer management easier and performance is the same. Bug: 170963610 Signed-off-by: Ruofei Ma <ruofeim@google.com> Change-Id: Ie30ec2b4b568b8526a068f40e4f66939e2662371
-rw-r--r--bigo_iommu.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/bigo_iommu.c b/bigo_iommu.c
index 483bce0..872431a 100644
--- a/bigo_iommu.c
+++ b/bigo_iommu.c
@@ -42,13 +42,6 @@ static int check_mapped_list(struct bigo_core *core, struct bigo_inst *inst,
{
int found = -1;
struct bufinfo *binfo;
- struct dma_buf *dmabuf;
-
- dmabuf = dma_buf_get(mapping->fd);
- if (IS_ERR(dmabuf)) {
- pr_err("failed to get dma buf(%d)\n", mapping->fd);
- return found;
- }
mutex_lock(&inst->lock);
list_for_each_entry(binfo, &inst->buffers, list) {
@@ -56,14 +49,13 @@ static int check_mapped_list(struct bigo_core *core, struct bigo_inst *inst,
* TODO(vinaykalia@): Do we need to check for size,
* offset, etc?
*/
- if (binfo->dmabuf == dmabuf) {
+ if (binfo->fd == mapping->fd) {
mapping->iova = binfo->iova;
found = 0;
break;
}
}
mutex_unlock(&inst->lock);
- dma_buf_put(dmabuf);
return found;
}