[PATCH 06/14] drm/amdgpu: add post soft reset ip func

Chunming Zhou David1.Zhou at amd.com
Tue Jul 19 08:13:46 UTC 2016


It is used to resume engine/IP block after soft reset.

Change-Id: I0904927d9214f3619c08607b24f77541422a9bce
Signed-off-by: Chunming Zhou <David1.Zhou at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 18 ++++++++++++++++++
 drivers/gpu/drm/amd/include/amd_shared.h   |  2 ++
 2 files changed, 20 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 4521725..16d78a9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2018,6 +2018,23 @@ static int amdgpu_soft_reset(struct amdgpu_device *adev)
 	return 0;
 }
 
+static int amdgpu_post_soft_reset(struct amdgpu_device *adev)
+{
+	int i, r = 0;
+
+	for (i = 0; i < adev->num_ip_blocks; i++) {
+		if (!adev->ip_block_status[i].valid)
+			continue;
+		if (adev->ip_block_status[i].hang &&
+		    adev->ip_blocks[i].funcs->post_soft_reset)
+			r = adev->ip_blocks[i].funcs->post_soft_reset(adev);
+		if (r)
+			return r;
+	}
+
+	return 0;
+}
+
 /**
  * amdgpu_gpu_reset - reset the asic
  *
@@ -2060,6 +2077,7 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev)
 	if (!amdgpu_need_full_reset(adev)) {
 		amdgpu_pre_soft_reset(adev);
 		r = amdgpu_soft_reset(adev);
+		amdgpu_post_soft_reset(adev);
 		if (!amdgpu_check_soft_reset(adev))
 			goto out;
 	}
diff --git a/drivers/gpu/drm/amd/include/amd_shared.h b/drivers/gpu/drm/amd/include/amd_shared.h
index 7104085..d938c2a 100644
--- a/drivers/gpu/drm/amd/include/amd_shared.h
+++ b/drivers/gpu/drm/amd/include/amd_shared.h
@@ -174,6 +174,8 @@ struct amd_ip_funcs {
 	int (*pre_soft_reset)(void *handle);
 	/* soft reset the IP block */
 	int (*soft_reset)(void *handle);
+	/* post soft reset the IP block */
+	int (*post_soft_reset)(void *handle);
 	/* enable/disable cg for the IP block */
 	int (*set_clockgating_state)(void *handle,
 				     enum amd_clockgating_state state);
-- 
1.9.1



More information about the amd-gfx mailing list