drm/amdgpu: switch amdgpu_sdma_reset_engine to use the new sdma function pointers
authorJesse.zhang@amd.com <Jesse.zhang@amd.com>
Fri, 11 Apr 2025 06:48:52 +0000 (14:48 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 21 Apr 2025 14:56:49 +0000 (10:56 -0400)
Replace old callback mechanism with direct calls to stop/start functions.

Suggested-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jesse Zhang <jesse.zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c

index c3c6f03190c8986365c7cb7d1edc47892102f9f1..7139d574c23e605ba7119d5819a5a2e066654253 100644 (file)
@@ -559,16 +559,10 @@ void amdgpu_sdma_register_on_reset_callbacks(struct amdgpu_device *adev, struct
  * @adev: Pointer to the AMDGPU device
  * @instance_id: ID of the SDMA engine instance to reset
  *
- * This function performs the following steps:
- * 1. Calls all registered pre_reset callbacks to allow KFD and AMDGPU to save their state.
- * 2. Resets the specified SDMA engine instance.
- * 3. Calls all registered post_reset callbacks to allow KFD and AMDGPU to restore their state.
- *
  * Returns: 0 on success, or a negative error code on failure.
  */
 int amdgpu_sdma_reset_engine(struct amdgpu_device *adev, uint32_t instance_id)
 {
-       struct sdma_on_reset_funcs *funcs;
        int ret = 0;
        struct amdgpu_sdma_instance *sdma_instance = &adev->sdma.instance[instance_id];
        struct amdgpu_ring *gfx_ring = &sdma_instance->ring;
@@ -590,18 +584,8 @@ int amdgpu_sdma_reset_engine(struct amdgpu_device *adev, uint32_t instance_id)
                page_sched_stopped = true;
        }
 
-       /* Invoke all registered pre_reset callbacks */
-       list_for_each_entry(funcs, &adev->sdma.reset_callback_list, list) {
-               if (funcs->pre_reset) {
-                       ret = funcs->pre_reset(adev, instance_id);
-                       if (ret) {
-                               dev_err(adev->dev,
-                               "beforeReset callback failed for instance %u: %d\n",
-                                       instance_id, ret);
-                               goto exit;
-                       }
-               }
-       }
+       if (sdma_instance->funcs->stop_kernel_queue)
+               sdma_instance->funcs->stop_kernel_queue(gfx_ring);
 
        /* Perform the SDMA reset for the specified instance */
        ret = amdgpu_dpm_reset_sdma(adev, 1 << instance_id);
@@ -610,18 +594,8 @@ int amdgpu_sdma_reset_engine(struct amdgpu_device *adev, uint32_t instance_id)
                goto exit;
        }
 
-       /* Invoke all registered post_reset callbacks */
-       list_for_each_entry(funcs, &adev->sdma.reset_callback_list, list) {
-               if (funcs->post_reset) {
-                       ret = funcs->post_reset(adev, instance_id);
-                       if (ret) {
-                               dev_err(adev->dev,
-                               "afterReset callback failed for instance %u: %d\n",
-                                       instance_id, ret);
-                               goto exit;
-                       }
-               }
-       }
+       if (sdma_instance->funcs->start_kernel_queue)
+               sdma_instance->funcs->start_kernel_queue(gfx_ring);
 
 exit:
        /* Restart the scheduler's work queue for the GFX and page rings