[PATCH] drm/amdgpu: gpu reset run IB test once

Pan, Xinhui Xinhui.Pan at amd.com
Wed May 29 09:17:59 UTC 2019


currently gpu reset will schedule late_init_work which will do one IB
test. That would race with the IB test in gpu reset itself.

add another do_ip_late_init() function which skips the late_init_work.

Signed-off-by: xinhui pan <xinhui.pan at amd.com>
Suggested-by: Alex Deucher <alexander.deucher at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 30 +++++++++++++++++-----
 1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 241cd2c75433..a1dcee125d1d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1900,7 +1900,7 @@ static int amdgpu_device_set_pg_state(struct amdgpu_device *adev, enum amd_power
 }
 
 /**
- * amdgpu_device_ip_late_init - run late init for hardware IPs
+ * amdgpu_device_do_ip_late_init - run late init for hardware IPs
  *
  * @adev: amdgpu_device pointer
  *
@@ -1911,7 +1911,7 @@ static int amdgpu_device_set_pg_state(struct amdgpu_device *adev, enum amd_power
  * late in the init process.
  * Returns 0 on success, negative error code on failure.
  */
-static int amdgpu_device_ip_late_init(struct amdgpu_device *adev)
+static int amdgpu_device_do_ip_late_init(struct amdgpu_device *adev)
 {
 	int i = 0, r;
 
@@ -1932,14 +1932,32 @@ static int amdgpu_device_ip_late_init(struct amdgpu_device *adev)
 	amdgpu_device_set_cg_state(adev, AMD_CG_STATE_GATE);
 	amdgpu_device_set_pg_state(adev, AMD_PG_STATE_GATE);
 
-	queue_delayed_work(system_wq, &adev->late_init_work,
-			   msecs_to_jiffies(AMDGPU_RESUME_MS));
-
 	amdgpu_device_fill_reset_magic(adev);
 
 	return 0;
 }
 
+/**
+ * amdgpu_device_ip_late_init - run late init for hardware IPs
+ *
+ * @adev: amdgpu_device pointer
+ *
+ * schedule late_init_work after late_init.
+ * Return 0 on success.
+ */
+static int amdgpu_device_ip_late_init(struct amdgpu_device *adev)
+{
+	int r;
+
+	r = amdgpu_device_do_ip_late_init(adev);
+	if (r)
+		return r;
+
+	queue_delayed_work(system_wq, &adev->late_init_work,
+			   msecs_to_jiffies(AMDGPU_RESUME_MS));
+	return 0;
+}
+
 /**
  * amdgpu_device_ip_fini - run fini for hardware IPs
  *
@@ -3545,7 +3563,7 @@ static int amdgpu_do_asic_reset(struct amdgpu_hive_info *hive,
 				if (vram_lost)
 					amdgpu_device_fill_reset_magic(tmp_adev);
 
-				r = amdgpu_device_ip_late_init(tmp_adev);
+				r = amdgpu_device_do_ip_late_init(tmp_adev);
 				if (r)
 					goto out;
 
-- 
2.17.1



More information about the amd-gfx mailing list