Commit 63fbf42f authored by Chunming Zhou's avatar Chunming Zhou Committed by Alex Deucher

drm/amdgpu: add check_soft_reset ip func

It is used to identify if the ip block is hang.
Signed-off-by: default avatarChunming Zhou <David1.Zhou@amd.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 5c6c201c
...@@ -1956,6 +1956,7 @@ struct amdgpu_ip_block_status { ...@@ -1956,6 +1956,7 @@ struct amdgpu_ip_block_status {
bool valid; bool valid;
bool sw; bool sw;
bool hw; bool hw;
bool hang;
}; };
struct amdgpu_device { struct amdgpu_device {
......
...@@ -1937,6 +1937,24 @@ int amdgpu_resume_kms(struct drm_device *dev, bool resume, bool fbcon) ...@@ -1937,6 +1937,24 @@ int amdgpu_resume_kms(struct drm_device *dev, bool resume, bool fbcon)
return 0; return 0;
} }
static bool amdgpu_check_soft_reset(struct amdgpu_device *adev)
{
int i;
bool asic_hang = false;
for (i = 0; i < adev->num_ip_blocks; i++) {
if (!adev->ip_block_status[i].valid)
continue;
if (adev->ip_blocks[i].funcs->check_soft_reset)
adev->ip_blocks[i].funcs->check_soft_reset(adev);
if (adev->ip_block_status[i].hang) {
DRM_INFO("IP block:%d is hang!\n", i);
asic_hang = true;
}
}
return asic_hang;
}
/** /**
* amdgpu_gpu_reset - reset the asic * amdgpu_gpu_reset - reset the asic
* *
...@@ -1950,6 +1968,11 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev) ...@@ -1950,6 +1968,11 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev)
int i, r; int i, r;
int resched; int resched;
if (!amdgpu_check_soft_reset(adev)) {
DRM_INFO("No hardware hang detected. Did some blocks stall?\n");
return 0;
}
atomic_inc(&adev->gpu_reset_counter); atomic_inc(&adev->gpu_reset_counter);
/* block TTM */ /* block TTM */
......
...@@ -159,6 +159,8 @@ struct amd_ip_funcs { ...@@ -159,6 +159,8 @@ struct amd_ip_funcs {
bool (*is_idle)(void *handle); bool (*is_idle)(void *handle);
/* poll for idle */ /* poll for idle */
int (*wait_for_idle)(void *handle); int (*wait_for_idle)(void *handle);
/* check soft reset the IP block */
int (*check_soft_reset)(void *handle);
/* soft reset the IP block */ /* soft reset the IP block */
int (*soft_reset)(void *handle); int (*soft_reset)(void *handle);
/* enable/disable cg for the IP block */ /* enable/disable cg for the IP block */
......
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