diff options
author | Christian König <christian.koenig@amd.com> | 2018-08-21 10:45:29 +0200 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-08-27 11:11:16 -0500 |
commit | 12938fad234a3924cc9b82080db4f62fe1cf52bb (patch) | |
tree | 3b784794d8d219b95dd22cd5544a05177ea9ec10 /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |
parent | 1849e73748be3c80bf752e4c4877fe90a8da4822 (diff) |
drm/amdgpu: cleanup GPU recovery check a bit (v2)
Check if we should call the function instead of providing the forced
flag.
v2: rebase on KFD changes (Alex)
Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index c961e781430d..8f431740c424 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -3244,31 +3244,43 @@ error: } /** + * amdgpu_device_should_recover_gpu - check if we should try GPU recovery + * + * @adev: amdgpu device pointer + * + * Check amdgpu_gpu_recovery and SRIOV status to see if we should try to recover + * a hung GPU. + */ +bool amdgpu_device_should_recover_gpu(struct amdgpu_device *adev) +{ + if (!amdgpu_device_ip_check_soft_reset(adev)) { + DRM_INFO("Timeout, but no hardware hang detected.\n"); + return false; + } + + if (amdgpu_gpu_recovery == 0 || (amdgpu_gpu_recovery == -1 && + !amdgpu_sriov_vf(adev))) { + DRM_INFO("GPU recovery disabled.\n"); + return false; + } + + return true; +} + +/** * amdgpu_device_gpu_recover - reset the asic and recover scheduler * * @adev: amdgpu device pointer * @job: which job trigger hang - * @force: forces reset regardless of amdgpu_gpu_recovery * * Attempt to reset the GPU if it has hung (all asics). * Returns 0 for success or an error on failure. */ int amdgpu_device_gpu_recover(struct amdgpu_device *adev, - struct amdgpu_job *job, bool force) + struct amdgpu_job *job) { int i, r, resched; - if (!force && !amdgpu_device_ip_check_soft_reset(adev)) { - DRM_INFO("No hardware hang detected. Did some blocks stall?\n"); - return 0; - } - - if (!force && (amdgpu_gpu_recovery == 0 || - (amdgpu_gpu_recovery == -1 && !amdgpu_sriov_vf(adev)))) { - DRM_INFO("GPU recovery disabled.\n"); - return 0; - } - dev_info(adev->dev, "GPU reset begin!\n"); mutex_lock(&adev->lock_reset); |