If the engine is hung, we shouldn't need this since it won't be powered down, but we could potentially have a case where a queue can be preempted, but due to logic errors in the commands, the fence never signals. The engine could potentially go into the off state. Protect against that.
Signed-off-by: Alex Deucher <[email protected]> --- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c index f6a749fbdd8ee..7edae15adb16e 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c @@ -473,7 +473,9 @@ static int reset_queues_mes(struct device_queue_manager *dqm, struct queue *q) queue_input.remove_queue_after_reset = false; queue_input.xcc_id = ffs(dqm->dev->xcc_mask) - 1; /* pass the known bad queue info to the reset function */ + amdgpu_gfx_off_ctrl(adev, false); r = amdgpu_gfx_reset_mes_compute(adev, NULL, NULL, NULL, &num_hung, &queue_input); + amdgpu_gfx_off_ctrl(adev, true); if (r) goto fail; @@ -2454,7 +2456,10 @@ static int reset_hung_queues_sdma(struct device_queue_manager *dqm) continue; /* Reset engine and check. */ - if (amdgpu_sdma_reset_engine(dqm->dev->adev, i, false) || + amdgpu_gfx_off_ctrl(dqm->dev->adev, false); + r = amdgpu_sdma_reset_engine(dqm->dev->adev, i, false); + amdgpu_gfx_off_ctrl(dqm->dev->adev, true); + if (r || dqm->dev->kfd2kgd->hqd_sdma_get_doorbell(dqm->dev->adev, i, j) || !set_sdma_queue_as_reset(dqm, doorbell_off)) { r = -ENOTRECOVERABLE; -- 2.55.0
