History

drm/msm: Don't overwrite hw fence in hw_init

Prior to the last commit, this could result in setting the GPU written fence value back to an older value, if we had missed updating completed_fence prior to suspend. This was mostly harmless as the GPU would eventually overwrite it again with the correct value. But we should just not do this. Instead just leave a sanity check that the fence looks plausible (in case the GPU scribbled on memory).

Rob Clark committed 4 years ago

Commit c8af2191 parent 3c7a5222 files · +9 −4Browse files

Unified · Split

2 files
  1. drivers/gpu/drm/msm/adreno/adreno_gpu.c +8 −3
  2. drivers/gpu/drm/msm/msm_gpu.c +1 −1
drivers/gpu/drm/msm/adreno/adreno_gpu.c+8−3
@@ -498,10 +498,15 @@ int adreno_hw_init(struct msm_gpu *gpu) · 497 unmodified lines
498 498
499 ring->cur = ring->start;499 ring->cur = ring->start;
500 ring->next = ring->start;500 ring->next = ring->start;
501
502 /* reset completed fence seqno: */
503 ring->memptrs->fence = ring->fctx->completed_fence;
504 ring->memptrs->rptr = 0;501 ring->memptrs->rptr = 0;
502
503 /* Detect and clean up an impossible fence, ie. if GPU managed
504 * to scribble something invalid, we don't want that to confuse
505 * us into mistakingly believing that submits have completed.
506 */
507 if (fence_before(ring->fctx->last_fence, ring->memptrs->fence)) {
508 ring->memptrs->fence = ring->fctx->last_fence;
509 }
505 }510 }
506 511
507 return 0;512 return 0;
drivers/gpu/drm/msm/msm_gpu.c+1−1
@@ -418,7 +418,7 @@ static void recover_worker(struct kthread_work *work) · 417 unmodified lines
418 * one more to clear the faulting submit418 * one more to clear the faulting submit
419 */419 */
420 if (ring == cur_ring)420 if (ring == cur_ring)
421 fence++;421 ring->memptrs->fence = ++fence;
422 422
423 msm_update_fence(ring->fctx, fence);423 msm_update_fence(ring->fctx, fence);
424 }424 }