]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
accel/ivpu: Fix for missing lock around drm_gem_shmem_vmap()
authorJacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Mon, 15 Jan 2024 13:44:30 +0000 (14:44 +0100)
committerJacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Mon, 22 Jan 2024 09:28:43 +0000 (10:28 +0100)
drm_gem_shmem_vmap/vunmap requires dma resv lock to be held.
This was missed during conversion to shmem helper.

Fixes: 8d88e4cdce4f ("accel/ivpu: Use GEM shmem helper for all buffers")
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240115134434.493839-6-jacek.lawrynowicz@linux.intel.com
drivers/accel/ivpu/ivpu_gem.c

index 1dda4f38ea25cd356cc9efadcaa8d35394c6b19f..6890d33cf3528014de1ef8d1e6491898d00be20e 100644 (file)
@@ -361,7 +361,9 @@ ivpu_bo_alloc_internal(struct ivpu_device *vdev, u64 vpu_addr, u64 size, u32 fla
        if (ret)
                goto err_put;
 
+       dma_resv_lock(bo->base.base.resv, NULL);
        ret = drm_gem_shmem_vmap(&bo->base, &map);
+       dma_resv_unlock(bo->base.base.resv);
        if (ret)
                goto err_put;
 
@@ -376,7 +378,10 @@ void ivpu_bo_free_internal(struct ivpu_bo *bo)
 {
        struct iosys_map map = IOSYS_MAP_INIT_VADDR(bo->base.vaddr);
 
+       dma_resv_lock(bo->base.base.resv, NULL);
        drm_gem_shmem_vunmap(&bo->base, &map);
+       dma_resv_unlock(bo->base.base.resv);
+
        drm_gem_object_put(&bo->base.base);
 }