aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
index a8e531d604fa..c5bb36275e93 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
@@ -173,9 +173,14 @@ static void amdgpu_ctx_do_release(struct kref *ref)
173 173
174 ctx = container_of(ref, struct amdgpu_ctx, refcount); 174 ctx = container_of(ref, struct amdgpu_ctx, refcount);
175 175
176 for (i = 0; i < ctx->adev->num_rings; i++) 176 for (i = 0; i < ctx->adev->num_rings; i++) {
177
178 if (ctx->adev->rings[i] == &ctx->adev->gfx.kiq.ring)
179 continue;
180
177 drm_sched_entity_fini(&ctx->adev->rings[i]->sched, 181 drm_sched_entity_fini(&ctx->adev->rings[i]->sched,
178 &ctx->rings[i].entity); 182 &ctx->rings[i].entity);
183 }
179 184
180 amdgpu_ctx_fini(ref); 185 amdgpu_ctx_fini(ref);
181} 186}
@@ -452,12 +457,17 @@ void amdgpu_ctx_mgr_entity_fini(struct amdgpu_ctx_mgr *mgr)
452 if (!ctx->adev) 457 if (!ctx->adev)
453 return; 458 return;
454 459
455 for (i = 0; i < ctx->adev->num_rings; i++) 460 for (i = 0; i < ctx->adev->num_rings; i++) {
461
462 if (ctx->adev->rings[i] == &ctx->adev->gfx.kiq.ring)
463 continue;
464
456 if (kref_read(&ctx->refcount) == 1) 465 if (kref_read(&ctx->refcount) == 1)
457 drm_sched_entity_do_release(&ctx->adev->rings[i]->sched, 466 drm_sched_entity_do_release(&ctx->adev->rings[i]->sched,
458 &ctx->rings[i].entity); 467 &ctx->rings[i].entity);
459 else 468 else
460 DRM_ERROR("ctx %p is still alive\n", ctx); 469 DRM_ERROR("ctx %p is still alive\n", ctx);
470 }
461 } 471 }
462} 472}
463 473
@@ -474,12 +484,17 @@ void amdgpu_ctx_mgr_entity_cleanup(struct amdgpu_ctx_mgr *mgr)
474 if (!ctx->adev) 484 if (!ctx->adev)
475 return; 485 return;
476 486
477 for (i = 0; i < ctx->adev->num_rings; i++) 487 for (i = 0; i < ctx->adev->num_rings; i++) {
488
489 if (ctx->adev->rings[i] == &ctx->adev->gfx.kiq.ring)
490 continue;
491
478 if (kref_read(&ctx->refcount) == 1) 492 if (kref_read(&ctx->refcount) == 1)
479 drm_sched_entity_cleanup(&ctx->adev->rings[i]->sched, 493 drm_sched_entity_cleanup(&ctx->adev->rings[i]->sched,
480 &ctx->rings[i].entity); 494 &ctx->rings[i].entity);
481 else 495 else
482 DRM_ERROR("ctx %p is still alive\n", ctx); 496 DRM_ERROR("ctx %p is still alive\n", ctx);
497 }
483 } 498 }
484} 499}
485 500