From 23a2ffd786ff23898094c922bc6636659899013b Mon Sep 17 00:00:00 2001 From: Asahi Lina Date: Wed, 22 Nov 2023 14:01:51 +0900 Subject: [PATCH] drm/shmem-helper: Add lockdep asserts to vmap/vunmap Since commit 21aa27ddc582 ("drm/shmem-helper: Switch to reservation lock"), the drm_gem_shmem_vmap and drm_gem_shmem_vunmap functions require that the caller holds the DMA reservation lock for the object. Add lockdep assertions to help validate this. Signed-off-by: Asahi Lina --- drivers/gpu/drm/drm_gem_shmem_helper.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c index c5b3ec05372396..168f5ccd820cd3 100644 --- a/drivers/gpu/drm/drm_gem_shmem_helper.c +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c @@ -313,6 +313,8 @@ int drm_gem_shmem_vmap(struct drm_gem_shmem_object *shmem, struct drm_gem_object *obj = &shmem->base; int ret = 0; + dma_resv_assert_held(obj->resv); + if (obj->import_attach) { ret = dma_buf_vmap(obj->import_attach->dmabuf, map); if (!ret) { @@ -379,6 +381,8 @@ void drm_gem_shmem_vunmap(struct drm_gem_shmem_object *shmem, { struct drm_gem_object *obj = &shmem->base; + dma_resv_assert_held(obj->resv); + if (obj->import_attach) { dma_buf_vunmap(obj->import_attach->dmabuf, map); } else {