Commit 7dd8c205 authored by Evan Quan's avatar Evan Quan Committed by Alex Deucher

drm/amdgpu: code cleanup around gpu reset

Make code more readable.
Signed-off-by: default avatarEvan Quan <evan.quan@amd.com>
Reviewed-by: default avatarAndrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 9e94d22c
...@@ -4130,7 +4130,8 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev, ...@@ -4130,7 +4130,8 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
struct amdgpu_job *job) struct amdgpu_job *job)
{ {
struct list_head device_list, *device_list_handle = NULL; struct list_head device_list, *device_list_handle = NULL;
bool need_full_reset, job_signaled; bool need_full_reset = false;
bool job_signaled = false;
struct amdgpu_hive_info *hive = NULL; struct amdgpu_hive_info *hive = NULL;
struct amdgpu_device *tmp_adev = NULL; struct amdgpu_device *tmp_adev = NULL;
int i, r = 0; int i, r = 0;
...@@ -4151,13 +4152,9 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev, ...@@ -4151,13 +4152,9 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
emergency_restart(); emergency_restart();
} }
need_full_reset = job_signaled = false;
dev_info(adev->dev, "GPU %s begin!\n", dev_info(adev->dev, "GPU %s begin!\n",
(in_ras_intr && !use_baco) ? "jobs stop":"reset"); (in_ras_intr && !use_baco) ? "jobs stop":"reset");
hive = amdgpu_get_xgmi_hive(adev, true);
/* /*
* Here we trylock to avoid chain of resets executing from * Here we trylock to avoid chain of resets executing from
* either trigger by jobs on different adevs in XGMI hive or jobs on * either trigger by jobs on different adevs in XGMI hive or jobs on
...@@ -4165,7 +4162,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev, ...@@ -4165,7 +4162,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
* We always reset all schedulers for device and all devices for XGMI * We always reset all schedulers for device and all devices for XGMI
* hive so that should take care of them too. * hive so that should take care of them too.
*/ */
hive = amdgpu_get_xgmi_hive(adev, true);
if (hive && !mutex_trylock(&hive->reset_lock)) { if (hive && !mutex_trylock(&hive->reset_lock)) {
DRM_INFO("Bailing on TDR for s_job:%llx, hive: %llx as another already in progress", DRM_INFO("Bailing on TDR for s_job:%llx, hive: %llx as another already in progress",
job ? job->base.id : -1, hive->hive_id); job ? job->base.id : -1, hive->hive_id);
...@@ -4232,7 +4229,6 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev, ...@@ -4232,7 +4229,6 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
} }
} }
if (in_ras_intr && !use_baco) if (in_ras_intr && !use_baco)
goto skip_sched_resume; goto skip_sched_resume;
...@@ -4243,10 +4239,8 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev, ...@@ -4243,10 +4239,8 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
* job->base holds a reference to parent fence * job->base holds a reference to parent fence
*/ */
if (job && job->base.s_fence->parent && if (job && job->base.s_fence->parent &&
dma_fence_is_signaled(job->base.s_fence->parent)) dma_fence_is_signaled(job->base.s_fence->parent)) {
job_signaled = true; job_signaled = true;
if (job_signaled) {
dev_info(adev->dev, "Guilty job already signaled, skipping HW reset"); dev_info(adev->dev, "Guilty job already signaled, skipping HW reset");
goto skip_hw_reset; goto skip_hw_reset;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment