diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/vce_v4_0.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/vce_v4_0.c | 26 | 
1 files changed, 17 insertions, 9 deletions
| diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c index 8e238dea7bef..90910d19db12 100644 --- a/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c +++ b/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c @@ -25,6 +25,7 @@   */  #include <linux/firmware.h> +#include <drm/drm_drv.h>  #include "amdgpu.h"  #include "amdgpu_vce.h" @@ -555,16 +556,19 @@ static int vce_v4_0_hw_fini(void *handle)  static int vce_v4_0_suspend(void *handle)  {  	struct amdgpu_device *adev = (struct amdgpu_device *)handle; -	int r; +	int r, idx;  	if (adev->vce.vcpu_bo == NULL)  		return 0; -	if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) { -		unsigned size = amdgpu_bo_size(adev->vce.vcpu_bo); -		void *ptr = adev->vce.cpu_addr; +	if (drm_dev_enter(&adev->ddev, &idx)) { +		if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) { +			unsigned size = amdgpu_bo_size(adev->vce.vcpu_bo); +			void *ptr = adev->vce.cpu_addr; -		memcpy_fromio(adev->vce.saved_bo, ptr, size); +			memcpy_fromio(adev->vce.saved_bo, ptr, size); +		} +		drm_dev_exit(idx);  	}  	r = vce_v4_0_hw_fini(adev); @@ -577,16 +581,20 @@ static int vce_v4_0_suspend(void *handle)  static int vce_v4_0_resume(void *handle)  {  	struct amdgpu_device *adev = (struct amdgpu_device *)handle; -	int r; +	int r, idx;  	if (adev->vce.vcpu_bo == NULL)  		return -EINVAL;  	if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) { -		unsigned size = amdgpu_bo_size(adev->vce.vcpu_bo); -		void *ptr = adev->vce.cpu_addr; -		memcpy_toio(ptr, adev->vce.saved_bo, size); +		if (drm_dev_enter(&adev->ddev, &idx)) { +			unsigned size = amdgpu_bo_size(adev->vce.vcpu_bo); +			void *ptr = adev->vce.cpu_addr; + +			memcpy_toio(ptr, adev->vce.saved_bo, size); +			drm_dev_exit(idx); +		}  	} else {  		r = amdgpu_vce_resume(adev);  		if (r) | 
