[PATCH] drm/amdgpu: Maintain suspend-resume call consistency in gpu recovery

Andrey Grodzovsky Andrey.Grodzovsky at amd.com
Thu Feb 1 19:53:10 UTC 2018



On 02/01/2018 02:44 PM, mikita.lipski at amd.com wrote:
> From: Mikita Lipski <mikita.lipski at amd.com>
>
> Call dm_suspend function instead of drm_kms suspend function in
> order to cache current state
>
> Call DM_resume first to restore dc hardware, then amdgpu_dm_display_resume
> to restore dal's cached state.
>
> Signed-off-by: Mikita Lipski <mikita.lipski at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 10 ++++------
>   1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 850453e..b55c929 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -2616,7 +2616,6 @@ static int amdgpu_device_reset_sriov(struct amdgpu_device *adev,
>   int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
>   			      struct amdgpu_job *job, bool force)
>   {
> -	struct drm_atomic_state *state = NULL;
>   	uint64_t reset_flags = 0;
>   	int i, r, resched;
>   
> @@ -2640,9 +2639,9 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
>   	/* block TTM */
>   	resched = ttm_bo_lock_delayed_workqueue(&adev->mman.bdev);
>   	/* store modesetting */
> -	if (amdgpu_device_has_dc_support(adev))
> -		state = drm_atomic_helper_suspend(adev->ddev);
> -
> +	if (amdgpu_device_has_dc_support(adev)){
> +		adev->ip_blocks[5].version->funcs->suspend(adev);
> +	}

Use if(adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_DCE instead)

Thanks,
Andrey

>   	/* block scheduler */
>   	for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
>   		struct amdgpu_ring *ring = adev->rings[i];
> @@ -2727,8 +2726,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
>   	}
>   
>   	if (amdgpu_device_has_dc_support(adev)) {
> -		if (drm_atomic_helper_resume(adev->ddev, state))
> -			dev_info(adev->dev, "drm resume failed:%d\n", r);
> +		adev->ip_blocks[5].version->funcs->resume(adev);
>   		amdgpu_dm_display_resume(adev);
>   	} else {
>   		drm_helper_resume_force_mode(adev->ddev);



More information about the amd-gfx mailing list