[v5 3/6] drm/amdgpu: switch amdgpu_sdma_reset_engine to use the new sdma function pointers
Alex Deucher
alexdeucher at gmail.com
Fri Apr 11 15:52:04 UTC 2025
On Fri, Apr 11, 2025 at 4:30 AM Jesse.zhang at amd.com <jesse.zhang at amd.com> wrote:
>
> From: "Jesse.zhang at amd.com" <Jesse.zhang at amd.com>
>
> Replace old callback mechanism with direct calls to stop/start functions.
>
> Suggested-by: Alex Deucher <alexander.deucher at amd.com>
> Signed-off-by: Jesse Zhang <jesse.zhang at amd.com>
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 34 +++---------------------
> 1 file changed, 4 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
> index c3c6f03190c8..7139d574c23e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
> @@ -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
> --
> 2.25.1
>
More information about the amd-gfx
mailing list