diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c index d7b595e3f115..ff5a55f5f3c9 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c @@ -2244,7 +2244,8 @@ int amdgpu_gfx_reset_mes_compute(struct amdgpu_device *adev, struct amdgpu_ring *ring, struct amdgpu_fence *guilty_fence, struct amdgpu_usermode_queue *uq, - unsigned int *hung_queue_count) + unsigned int *hung_queue_count, + void *faulty_queue_input) { struct amdgpu_mes_hung_queue_hqd_info *hqd_info = (struct amdgpu_mes_hung_queue_hqd_info *) @@ -2252,6 +2253,7 @@ int amdgpu_gfx_reset_mes_compute(struct amdgpu_device *adev, int i, r, pipe, queue, queue_type; unsigned int num_hung = 0; bool use_mmio = adev->gfx.mec.use_mmio_for_reset; + struct mes_remove_queue_input *queue_input = (struct mes_remove_queue_input *)faulty_queue_input; guard(mutex)(&adev->gfx.mec.reset_mutex); /* stop the drm schedulers for all compute queues */ @@ -2306,6 +2308,20 @@ int amdgpu_gfx_reset_mes_compute(struct amdgpu_device *adev, if (r) goto out; } + + /* MES doesn't detect any hung queue but we have a known bad queue + * and it is not KCQ + */ + if (!num_hung && queue_input && !ring) { + /* MES suspend_all is successful means this bad queue is + * preempted successfuly. Remove it before resume all so it + * doesn't get mapped back + */ + amdgpu_mes_lock(&adev->mes); + r = adev->mes.funcs->remove_hw_queue(&adev->mes, queue_input); + amdgpu_mes_unlock(&adev->mes); + } + out: /* resume all will enable the non-hung queues */ amdgpu_mes_resume(adev, 0); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h index d40bc86a6178..4003360c7d9a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h @@ -651,7 +651,8 @@ int amdgpu_gfx_reset_mes_compute(struct amdgpu_device *adev, struct amdgpu_ring *ring, struct amdgpu_fence *guilty_fence, struct amdgpu_usermode_queue *uq, - unsigned int *hung_queue_count); + unsigned int *hung_queue_count, + void *faulty_queue_input); void amdgpu_gfx_ras_error_func(struct amdgpu_device *adev, void *ras_error_status, void (*func)(struct amdgpu_device *adev, void *ras_error_status, diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c index 5f0f8a5e3b7d..4e3bd505c368 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c @@ -141,7 +141,7 @@ static void amdgpu_userq_hang_detect_work(struct work_struct *work) int r; if (queue->queue_type == AMDGPU_HW_IP_COMPUTE) - r = amdgpu_gfx_reset_mes_compute(adev, NULL, NULL, NULL, NULL); + r = amdgpu_gfx_reset_mes_compute(adev, NULL, NULL, NULL, NULL, NULL); else r = userq_funcs->reset(queue); if (r) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c index 244c51c70c7e..0bd9d8a21f5e 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c @@ -6835,7 +6835,7 @@ static int gfx_v11_0_reset_kcq(struct amdgpu_ring *ring, { struct amdgpu_device *adev = ring->adev; - return amdgpu_gfx_reset_mes_compute(adev, ring, timedout_fence, NULL, NULL); + return amdgpu_gfx_reset_mes_compute(adev, ring, timedout_fence, NULL, NULL, NULL); } static void gfx_v11_ip_print(struct amdgpu_ip_block *ip_block, struct drm_printer *p) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c index 1334402d211d..380ba062134e 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c @@ -5261,7 +5261,7 @@ static int gfx_v12_0_reset_kcq(struct amdgpu_ring *ring, { struct amdgpu_device *adev = ring->adev; - return amdgpu_gfx_reset_mes_compute(adev, ring, timedout_fence, NULL, NULL); + return amdgpu_gfx_reset_mes_compute(adev, ring, timedout_fence, NULL, NULL, NULL); } static void gfx_v12_0_ring_begin_use(struct amdgpu_ring *ring) 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 6054c8e216b8..744b6c65107f 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c @@ -464,7 +464,7 @@ static int reset_queues_mes(struct device_queue_manager *dqm) goto fail; } - r = amdgpu_gfx_reset_mes_compute(adev, NULL, NULL, NULL, &num_hung); + r = amdgpu_gfx_reset_mes_compute(adev, NULL, NULL, NULL, &num_hung, NULL); if (r) goto fail;