Skip to content

Commit f66d48c

Browse files
committed
drm/tegra: Prepare to dynamic dma-buf locking specification
Prepare Tegra DRM driver to the common dynamic dma-buf locking convention by starting to use the unlocked versions of dma-buf API functions. Acked-by: Christian König <[email protected]> Signed-off-by: Dmitry Osipenko <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 8b0baa8 commit f66d48c

File tree

1 file changed

+9
-8
lines changed
  • drivers/gpu/drm/tegra

1 file changed

+9
-8
lines changed

drivers/gpu/drm/tegra/gem.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ static struct host1x_bo_mapping *tegra_bo_pin(struct device *dev, struct host1x_
8484
goto free;
8585
}
8686

87-
map->sgt = dma_buf_map_attachment(map->attach, direction);
87+
map->sgt = dma_buf_map_attachment_unlocked(map->attach, direction);
8888
if (IS_ERR(map->sgt)) {
8989
dma_buf_detach(buf, map->attach);
9090
err = PTR_ERR(map->sgt);
@@ -160,7 +160,8 @@ static struct host1x_bo_mapping *tegra_bo_pin(struct device *dev, struct host1x_
160160
static void tegra_bo_unpin(struct host1x_bo_mapping *map)
161161
{
162162
if (map->attach) {
163-
dma_buf_unmap_attachment(map->attach, map->sgt, map->direction);
163+
dma_buf_unmap_attachment_unlocked(map->attach, map->sgt,
164+
map->direction);
164165
dma_buf_detach(map->attach->dmabuf, map->attach);
165166
} else {
166167
dma_unmap_sgtable(map->dev, map->sgt, map->direction, 0);
@@ -181,7 +182,7 @@ static void *tegra_bo_mmap(struct host1x_bo *bo)
181182
if (obj->vaddr) {
182183
return obj->vaddr;
183184
} else if (obj->gem.import_attach) {
184-
ret = dma_buf_vmap(obj->gem.import_attach->dmabuf, &map);
185+
ret = dma_buf_vmap_unlocked(obj->gem.import_attach->dmabuf, &map);
185186
return ret ? NULL : map.vaddr;
186187
} else {
187188
return vmap(obj->pages, obj->num_pages, VM_MAP,
@@ -197,7 +198,7 @@ static void tegra_bo_munmap(struct host1x_bo *bo, void *addr)
197198
if (obj->vaddr)
198199
return;
199200
else if (obj->gem.import_attach)
200-
dma_buf_vunmap(obj->gem.import_attach->dmabuf, &map);
201+
dma_buf_vunmap_unlocked(obj->gem.import_attach->dmabuf, &map);
201202
else
202203
vunmap(addr);
203204
}
@@ -461,7 +462,7 @@ static struct tegra_bo *tegra_bo_import(struct drm_device *drm,
461462

462463
get_dma_buf(buf);
463464

464-
bo->sgt = dma_buf_map_attachment(attach, DMA_TO_DEVICE);
465+
bo->sgt = dma_buf_map_attachment_unlocked(attach, DMA_TO_DEVICE);
465466
if (IS_ERR(bo->sgt)) {
466467
err = PTR_ERR(bo->sgt);
467468
goto detach;
@@ -479,7 +480,7 @@ static struct tegra_bo *tegra_bo_import(struct drm_device *drm,
479480

480481
detach:
481482
if (!IS_ERR_OR_NULL(bo->sgt))
482-
dma_buf_unmap_attachment(attach, bo->sgt, DMA_TO_DEVICE);
483+
dma_buf_unmap_attachment_unlocked(attach, bo->sgt, DMA_TO_DEVICE);
483484

484485
dma_buf_detach(buf, attach);
485486
dma_buf_put(buf);
@@ -508,8 +509,8 @@ void tegra_bo_free_object(struct drm_gem_object *gem)
508509
tegra_bo_iommu_unmap(tegra, bo);
509510

510511
if (gem->import_attach) {
511-
dma_buf_unmap_attachment(gem->import_attach, bo->sgt,
512-
DMA_TO_DEVICE);
512+
dma_buf_unmap_attachment_unlocked(gem->import_attach, bo->sgt,
513+
DMA_TO_DEVICE);
513514
drm_prime_gem_destroy(gem, NULL);
514515
} else {
515516
tegra_bo_free(gem->dev, bo);

0 commit comments

Comments
 (0)