aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChunming Zhou <David1.Zhou@amd.com>2016-07-14 23:19:20 -0400
committerAlex Deucher <alexander.deucher@amd.com>2016-08-08 11:32:00 -0400
commit63fbf42f7307a5911237fed3285e669d9d4d0d1a (patch)
tree41ad327f379df42ac305aeb3bd5da13057b23cb3 /drivers
parent5c6c201ccbaf9d3901f829441d457293f7ca8ef4 (diff)
drm/amdgpu: add check_soft_reset ip func
It is used to identify if the ip block is hang. Signed-off-by: Chunming Zhou <David1.Zhou@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu.h1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c23
-rw-r--r--drivers/gpu/drm/amd/include/amd_shared.h2
3 files changed, 26 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 8ebc5f1eb4c0..a21b342ab2a3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1956,6 +1956,7 @@ struct amdgpu_ip_block_status {
1956 bool valid; 1956 bool valid;
1957 bool sw; 1957 bool sw;
1958 bool hw; 1958 bool hw;
1959 bool hang;
1959}; 1960};
1960 1961
1961struct amdgpu_device { 1962struct amdgpu_device {
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index df7ab2458e50..fd7698a56f3b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1937,6 +1937,24 @@ int amdgpu_resume_kms(struct drm_device *dev, bool resume, bool fbcon)
1937 return 0; 1937 return 0;
1938} 1938}
1939 1939
1940static bool amdgpu_check_soft_reset(struct amdgpu_device *adev)
1941{
1942 int i;
1943 bool asic_hang = false;
1944
1945 for (i = 0; i < adev->num_ip_blocks; i++) {
1946 if (!adev->ip_block_status[i].valid)
1947 continue;
1948 if (adev->ip_blocks[i].funcs->check_soft_reset)
1949 adev->ip_blocks[i].funcs->check_soft_reset(adev);
1950 if (adev->ip_block_status[i].hang) {
1951 DRM_INFO("IP block:%d is hang!\n", i);
1952 asic_hang = true;
1953 }
1954 }
1955 return asic_hang;
1956}
1957
1940/** 1958/**
1941 * amdgpu_gpu_reset - reset the asic 1959 * amdgpu_gpu_reset - reset the asic
1942 * 1960 *
@@ -1950,6 +1968,11 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev)
1950 int i, r; 1968 int i, r;
1951 int resched; 1969 int resched;
1952 1970
1971 if (!amdgpu_check_soft_reset(adev)) {
1972 DRM_INFO("No hardware hang detected. Did some blocks stall?\n");
1973 return 0;
1974 }
1975
1953 atomic_inc(&adev->gpu_reset_counter); 1976 atomic_inc(&adev->gpu_reset_counter);
1954 1977
1955 /* block TTM */ 1978 /* block TTM */
diff --git a/drivers/gpu/drm/amd/include/amd_shared.h b/drivers/gpu/drm/amd/include/amd_shared.h
index a74a0d2ff1ca..fe4aa09252ab 100644
--- a/drivers/gpu/drm/amd/include/amd_shared.h
+++ b/drivers/gpu/drm/amd/include/amd_shared.h
@@ -159,6 +159,8 @@ struct amd_ip_funcs {
159 bool (*is_idle)(void *handle); 159 bool (*is_idle)(void *handle);
160 /* poll for idle */ 160 /* poll for idle */
161 int (*wait_for_idle)(void *handle); 161 int (*wait_for_idle)(void *handle);
162 /* check soft reset the IP block */
163 int (*check_soft_reset)(void *handle);
162 /* soft reset the IP block */ 164 /* soft reset the IP block */
163 int (*soft_reset)(void *handle); 165 int (*soft_reset)(void *handle);
164 /* enable/disable cg for the IP block */ 166 /* enable/disable cg for the IP block */