summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/msm/msm_gpu.c
diff options
context:
space:
mode:
authorRob Clark <robdclark@chromium.org>2020-10-23 19:51:10 +0300
committerRob Clark <robdclark@chromium.org>2020-11-05 03:00:56 +0300
commit6c0e3ea25047694f97d01fb88c23ed5c4ed44da3 (patch)
tree64dc00d616e4ccd0ae54b5cafedabb43c3710337 /drivers/gpu/drm/msm/msm_gpu.c
parent9184b6831bbe8ffd8843eff66721981bc2cc6eff (diff)
downloadlinux-6c0e3ea25047694f97d01fb88c23ed5c4ed44da3.tar.xz
drm/msm/gem: Switch over to obj->resv for locking
This also converts the special msm_gem_get_vaddr_active() to expect the lock to already be held. There are two call-sites for this, one already has the lock held, so it is more straightforward to just open-code the locking for the other caller. Signed-off-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Signed-off-by: Rob Clark <robdclark@chromium.org>
Diffstat (limited to 'drivers/gpu/drm/msm/msm_gpu.c')
-rw-r--r--drivers/gpu/drm/msm/msm_gpu.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index 4426f5074dfc..fb368b1791fe 100644
--- a/drivers/gpu/drm/msm/msm_gpu.c
+++ b/drivers/gpu/drm/msm/msm_gpu.c
@@ -323,7 +323,9 @@ static void msm_gpu_crashstate_get_bo(struct msm_gpu_state *state,
if (!state_bo->data)
goto out;
+ msm_gem_lock(&obj->base);
ptr = msm_gem_get_vaddr_active(&obj->base);
+ msm_gem_unlock(&obj->base);
if (IS_ERR(ptr)) {
kvfree(state_bo->data);
state_bo->data = NULL;
@@ -467,14 +469,22 @@ static void recover_worker(struct kthread_work *work)
put_task_struct(task);
}
+ /* msm_rd_dump_submit() needs bo locked to dump: */
+ for (i = 0; i < submit->nr_bos; i++)
+ msm_gem_lock(&submit->bos[i].obj->base);
+
if (comm && cmd) {
DRM_DEV_ERROR(dev->dev, "%s: offending task: %s (%s)\n",
gpu->name, comm, cmd);
msm_rd_dump_submit(priv->hangrd, submit,
"offending task: %s (%s)", comm, cmd);
- } else
+ } else {
msm_rd_dump_submit(priv->hangrd, submit, NULL);
+ }
+
+ for (i = 0; i < submit->nr_bos; i++)
+ msm_gem_unlock(&submit->bos[i].obj->base);
}
/* Record the crash state */
@@ -779,7 +789,7 @@ void msm_gpu_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit)
/* submit takes a reference to the bo and iova until retired: */
drm_gem_object_get(&msm_obj->base);
- msm_gem_get_and_pin_iova(&msm_obj->base, submit->aspace, &iova);
+ msm_gem_get_and_pin_iova_locked(&msm_obj->base, submit->aspace, &iova);
if (submit->bos[i].flags & MSM_SUBMIT_BO_WRITE)
dma_resv_add_excl_fence(drm_obj->resv, submit->fence);