mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-09-01 16:21:30 +00:00
drm/amdgpu: switch amdgpu_sdma_reset_engine to use the new sdma function pointers
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>
This commit is contained in:
parent
a5c34299d8
commit
b22659d5d3
@ -559,16 +559,10 @@ void amdgpu_sdma_register_on_reset_callbacks(struct amdgpu_device *adev, struct
|
|||||||
* @adev: Pointer to the AMDGPU device
|
* @adev: Pointer to the AMDGPU device
|
||||||
* @instance_id: ID of the SDMA engine instance to reset
|
* @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.
|
* Returns: 0 on success, or a negative error code on failure.
|
||||||
*/
|
*/
|
||||||
int amdgpu_sdma_reset_engine(struct amdgpu_device *adev, uint32_t instance_id)
|
int amdgpu_sdma_reset_engine(struct amdgpu_device *adev, uint32_t instance_id)
|
||||||
{
|
{
|
||||||
struct sdma_on_reset_funcs *funcs;
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct amdgpu_sdma_instance *sdma_instance = &adev->sdma.instance[instance_id];
|
struct amdgpu_sdma_instance *sdma_instance = &adev->sdma.instance[instance_id];
|
||||||
struct amdgpu_ring *gfx_ring = &sdma_instance->ring;
|
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;
|
page_sched_stopped = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Invoke all registered pre_reset callbacks */
|
if (sdma_instance->funcs->stop_kernel_queue)
|
||||||
list_for_each_entry(funcs, &adev->sdma.reset_callback_list, list) {
|
sdma_instance->funcs->stop_kernel_queue(gfx_ring);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Perform the SDMA reset for the specified instance */
|
/* Perform the SDMA reset for the specified instance */
|
||||||
ret = amdgpu_dpm_reset_sdma(adev, 1 << instance_id);
|
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;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Invoke all registered post_reset callbacks */
|
if (sdma_instance->funcs->start_kernel_queue)
|
||||||
list_for_each_entry(funcs, &adev->sdma.reset_callback_list, list) {
|
sdma_instance->funcs->start_kernel_queue(gfx_ring);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
/* Restart the scheduler's work queue for the GFX and page rings
|
/* Restart the scheduler's work queue for the GFX and page rings
|
||||||
|
Loading…
Reference in New Issue
Block a user