diff mbox series

[06/10] accel/ivpu: Fix for missing lock around drm_gem_shmem_vmap()

Message ID 20240105112218.351265-7-jacek.lawrynowicz@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series accel/ivpu fixes for 6.8 | expand

Commit Message

Jacek Lawrynowicz Jan. 5, 2024, 11:22 a.m. UTC
drm_gem_shmem_vmap/vunmap requires dma resv lock to be held.
This was missed during conversion to shmem helper.

Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
---
 drivers/accel/ivpu/ivpu_gem.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Jeffrey Hugo Jan. 5, 2024, 4:36 p.m. UTC | #1
On 1/5/2024 4:22 AM, Jacek Lawrynowicz wrote:
> drm_gem_shmem_vmap/vunmap requires dma resv lock to be held.
> This was missed during conversion to shmem helper.
>  > Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>

Fixes tag?

Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Jacek Lawrynowicz Jan. 9, 2024, 12:51 p.m. UTC | #2
On 05.01.2024 17:36, Jeffrey Hugo wrote:
> On 1/5/2024 4:22 AM, Jacek Lawrynowicz wrote:
>> drm_gem_shmem_vmap/vunmap requires dma resv lock to be held.
>> This was missed during conversion to shmem helper.
>>  > Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
> 
> Fixes tag?

Sure, I'll add it.
diff mbox series

Patch

diff --git a/drivers/accel/ivpu/ivpu_gem.c b/drivers/accel/ivpu/ivpu_gem.c
index 1dda4f38ea25..6890d33cf352 100644
--- a/drivers/accel/ivpu/ivpu_gem.c
+++ b/drivers/accel/ivpu/ivpu_gem.c
@@ -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);
 }