[PATCH] drm/radeon: fix UVD suspend error

Leo Liu leo.liu at amd.com
Mon Jan 17 20:05:00 UTC 2022


On 2022-01-17 2:47 a.m., Qiang Ma wrote:
> I met a bug recently and the kernel log:
>
> [  330.171875] radeon 0000:03:00.0: couldn't schedule ib
> [  330.175781] [drm:radeon_uvd_suspend [radeon]] *ERROR* Error destroying UVD (-22)!
>
> In radeon drivers, using UVD suspend is as follows:
>
> if (rdev->has_uvd) {
>          uvd_v1_0_fini(rdev);
>          radeon_uvd_suspend(rdev);
> }
>
> In radeon_ib_schedule function, we check the 'ring->ready' state,
> but in uvd_v1_0_fini funciton, we've cleared the ready state.
> So, just modify the suspend code flow to fix error.

It seems reasonable to me. The suspend sends the destroy message if 
there is still incomplete job, so it should be before the fini which 
stops the hardware.

The series are:

Reviewed-by: Leo Liu <leo.liu at amd.com>


>
> Signed-off-by: Qiang Ma <maqianga at uniontech.com>
> ---
>   drivers/gpu/drm/radeon/cik.c       | 2 +-
>   drivers/gpu/drm/radeon/evergreen.c | 2 +-
>   drivers/gpu/drm/radeon/ni.c        | 2 +-
>   drivers/gpu/drm/radeon/r600.c      | 2 +-
>   drivers/gpu/drm/radeon/rv770.c     | 2 +-
>   drivers/gpu/drm/radeon/si.c        | 2 +-
>   6 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
> index 81b4de7be9f2..5819737c21c6 100644
> --- a/drivers/gpu/drm/radeon/cik.c
> +++ b/drivers/gpu/drm/radeon/cik.c
> @@ -8517,8 +8517,8 @@ int cik_suspend(struct radeon_device *rdev)
>   	cik_cp_enable(rdev, false);
>   	cik_sdma_enable(rdev, false);
>   	if (rdev->has_uvd) {
> -		uvd_v1_0_fini(rdev);
>   		radeon_uvd_suspend(rdev);
> +		uvd_v1_0_fini(rdev);
>   	}
>   	if (rdev->has_vce)
>   		radeon_vce_suspend(rdev);
> diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
> index eeb590d2dec2..455f8036aa54 100644
> --- a/drivers/gpu/drm/radeon/evergreen.c
> +++ b/drivers/gpu/drm/radeon/evergreen.c
> @@ -5156,8 +5156,8 @@ int evergreen_suspend(struct radeon_device *rdev)
>   	radeon_pm_suspend(rdev);
>   	radeon_audio_fini(rdev);
>   	if (rdev->has_uvd) {
> -		uvd_v1_0_fini(rdev);
>   		radeon_uvd_suspend(rdev);
> +		uvd_v1_0_fini(rdev);
>   	}
>   	r700_cp_stop(rdev);
>   	r600_dma_stop(rdev);
> diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c
> index 4a364ca7a1be..927e5f42e97d 100644
> --- a/drivers/gpu/drm/radeon/ni.c
> +++ b/drivers/gpu/drm/radeon/ni.c
> @@ -2323,8 +2323,8 @@ int cayman_suspend(struct radeon_device *rdev)
>   	cayman_cp_enable(rdev, false);
>   	cayman_dma_stop(rdev);
>   	if (rdev->has_uvd) {
> -		uvd_v1_0_fini(rdev);
>   		radeon_uvd_suspend(rdev);
> +		uvd_v1_0_fini(rdev);
>   	}
>   	evergreen_irq_suspend(rdev);
>   	radeon_wb_disable(rdev);
> diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
> index ca3fcae2adb5..dd78fc499402 100644
> --- a/drivers/gpu/drm/radeon/r600.c
> +++ b/drivers/gpu/drm/radeon/r600.c
> @@ -3232,8 +3232,8 @@ int r600_suspend(struct radeon_device *rdev)
>   	radeon_audio_fini(rdev);
>   	r600_cp_stop(rdev);
>   	if (rdev->has_uvd) {
> -		uvd_v1_0_fini(rdev);
>   		radeon_uvd_suspend(rdev);
> +		uvd_v1_0_fini(rdev);
>   	}
>   	r600_irq_suspend(rdev);
>   	radeon_wb_disable(rdev);
> diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
> index e592e57be1bb..38796af4fadd 100644
> --- a/drivers/gpu/drm/radeon/rv770.c
> +++ b/drivers/gpu/drm/radeon/rv770.c
> @@ -1894,8 +1894,8 @@ int rv770_suspend(struct radeon_device *rdev)
>   	radeon_pm_suspend(rdev);
>   	radeon_audio_fini(rdev);
>   	if (rdev->has_uvd) {
> -		uvd_v1_0_fini(rdev);
>   		radeon_uvd_suspend(rdev);
> +		uvd_v1_0_fini(rdev);
>   	}
>   	r700_cp_stop(rdev);
>   	r600_dma_stop(rdev);
> diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
> index 013e44ed0f39..8d5e4b25609d 100644
> --- a/drivers/gpu/drm/radeon/si.c
> +++ b/drivers/gpu/drm/radeon/si.c
> @@ -6800,8 +6800,8 @@ int si_suspend(struct radeon_device *rdev)
>   	si_cp_enable(rdev, false);
>   	cayman_dma_stop(rdev);
>   	if (rdev->has_uvd) {
> -		uvd_v1_0_fini(rdev);
>   		radeon_uvd_suspend(rdev);
> +		uvd_v1_0_fini(rdev);
>   	}
>   	if (rdev->has_vce)
>   		radeon_vce_suspend(rdev);


More information about the dri-devel mailing list