Skip to contentSkip to conversation

drm/amdgpu: error out on mode1 reset failure

PATCH In review Evan Quan 3 participants 8 messages Mar 15, 2019 – Mar 22, 2019 5 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Evan Quan

author
#0 lore raw

PATCH 1/3 drm/amdgpu: error out on mode1 reset failure

The error return value should be correctly reflected.

Change-Id I93bf6fa77193d4e3f102a4e223aa8cb18cb525cc
---
 drivers/gpu/drm/amd/amdgpu/soc15.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/soc15.c +5 -2
index 0c5ce4bd6feb..9d33a5d73072 100644
@@ -393,6 +393,7 @@ void soc15_program_register_sequence(struct amdgpu_device *adev,
 static int soc15_asic_mode1_reset(struct amdgpu_device *adev)
 {
 	u32 i;
+	int ret = 0;
 
 	amdgpu_atombios_scratch_regs_engine_hung(adev, true);
 
@@ -403,7 +404,9 @@ static int soc15_asic_mode1_reset(struct amdgpu_device *adev)
 
 	pci_save_state(adev->pdev);
 
-	psp_gpu_reset(adev);
+	ret = psp_gpu_reset(adev);
+	if (ret)
+		dev_err(adev->dev, "GPU mode1 reset failed\n");
 
 	pci_restore_state(adev->pdev);
 
@@ -418,7 +421,7 @@ static int soc15_asic_mode1_reset(struct amdgpu_device *adev)
 
 	amdgpu_atombios_scratch_regs_engine_hung(adev, false);
 
-	return 0;
+	return ret;
 }
 
 static int soc15_asic_get_baco_capability(struct amdgpu_device *adev, bool *cap)
Signature · 6 lines
2.21.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#2 lore raw

PATCH 2/3 drm/amdgpu: trivial typo fix

"error" was not correctly spelled.

Change-Id Idc3acb6172469c1d63227cb5f0df75f912c10871
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -2
index 07c6b23b3e2b..0243f1bdfeb6 100644
@@ -2396,7 +2396,7 @@ static void amdgpu_device_xgmi_reset_func(struct work_struct *__work)
 
 	adev->asic_reset_res =  amdgpu_asic_reset(adev);
 	if (adev->asic_reset_res)
-		DRM_WARN("ASIC reset failed with err r, %d for drm dev, %s",
+		DRM_WARN("ASIC reset failed with error, %d for drm dev, %s",
 			 adev->asic_reset_res, adev->ddev->unique);
 }
 
@@ -3396,7 +3396,7 @@ static int amdgpu_do_asic_reset(struct amdgpu_hive_info *hive,
 				r = amdgpu_asic_reset(tmp_adev);
 
 			if (r) {
-				DRM_ERROR("ASIC reset failed with err r, %d for drm dev, %s",
+				DRM_ERROR("ASIC reset failed with error, %d for drm dev, %s",
 					 r, tmp_adev->ddev->unique);
 				break;
 			}
Signature · 6 lines
2.21.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

Reviewed-by
#4 lore raw

Re: [PATCH 2/3] drm/amdgpu: trivial typo fix

Am 15.03.19 um 07:01 schrieb Evan Quan:

Quoted 4 lines

"error" was not correctly spelled.

Change-Id Idc3acb6172469c1d63227cb5f0df75f912c10871
Quoted 18 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
index 07c6b23b3e2b..0243f1bdfeb6 100644
@@ -2396,7 +2396,7 @@ static void amdgpu_device_xgmi_reset_func(struct work_struct *__work)
 
  	adev->asic_reset_res =  amdgpu_asic_reset(adev);
  	if (adev->asic_reset_res)
-		DRM_WARN("ASIC reset failed with err r, %d for drm dev, %s",
+		DRM_WARN("ASIC reset failed with error, %d for drm dev, %s",
  			 adev->asic_reset_res, adev->ddev->unique);
  }
 

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_do_asic_reset(struct amdgpu_hive_info *hive, · line 3402

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
@@ -3396,7 +3396,7 @@ static int amdgpu_do_asic_reset(struct amdgpu_hive_info *hive,
  				r = amdgpu_asic_reset(tmp_adev);
 
  			if (r) {
-				DRM_ERROR("ASIC reset failed with err r, %d for drm dev, %s",
+				DRM_ERROR("ASIC reset failed with error, %d for drm dev, %s",
  					 r, tmp_adev->ddev->unique);
  				break;
  			}

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author
#5 lore raw

PATCH 3/3 drm/amdgpu: add more debug friendly prompts

In reply to a message not in the archive

Large piece of codes share one error prompt. That
is not friendly for debugging.

Change-Id I15f77210af6a409981fe44cf5dd3aa8ce48d948f
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 38 ++++++++++++++++++-------
 1 file changed, 28 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +28 -10
index 32388b5218e9..5888e24219d9 100644
@@ -136,7 +136,7 @@ psp_cmd_submit_buf(struct psp_context *psp,
 
 	while (*((unsigned int *)psp->fence_buf) != index) {
 		if (--timeout == 0)
-			return -EINVAL;
+			break;
 		msleep(1);
 	}
 
@@ -147,12 +147,14 @@ psp_cmd_submit_buf(struct psp_context *psp,
 	 * during psp initialization to avoid breaking hw_init and it doesn't
 	 * return -EINVAL.
 	 */
-	if (psp->cmd_buf_mem->resp.status) {
+	if (psp->cmd_buf_mem->resp.status || !timeout) {
 		if (ucode)
 			DRM_WARN("failed to load ucode id (%d) ",
 				  ucode->ucode_id);
 		DRM_WARN("psp command failed and response status is (%d)\n",
 			  psp->cmd_buf_mem->resp.status);
+		if (!timeout)
+			return -EINVAL;
 	}
 
 	/* get xGMI session id from response buffer */
@@ -677,25 +679,35 @@ static int psp_hw_start(struct psp_context *psp)
 
 	if (!amdgpu_sriov_vf(adev) || !adev->in_gpu_reset) {
 		ret = psp_bootloader_load_sysdrv(psp);
-		if (ret)
+		if (ret) {
+			DRM_ERROR("PSP load sysdrv failed!\n");
 			return ret;
+		}
 
 		ret = psp_bootloader_load_sos(psp);
-		if (ret)
+		if (ret) {
+			DRM_ERROR("PSP load sos failed!\n");
 			return ret;
+		}
 	}
 
 	ret = psp_ring_create(psp, PSP_RING_TYPE__KM);
-	if (ret)
+	if (ret) {
+		DRM_ERROR("PSP create ring failed!\n");
 		return ret;
+	}
 
 	ret = psp_tmr_load(psp);
-	if (ret)
+	if (ret) {
+		DRM_ERROR("PSP load tmr failed!\n");
 		return ret;
+	}
 
 	ret = psp_asd_load(psp);
-	if (ret)
+	if (ret) {
+		DRM_ERROR("PSP load asd failed!\n");
 		return ret;
+	}
 
 	if (adev->gmc.xgmi.num_physical_nodes > 1) {
 		ret = psp_xgmi_initialize(psp);
@@ -890,16 +902,22 @@ static int psp_load_fw(struct amdgpu_device *adev)
 	memset(psp->fence_buf, 0, PSP_FENCE_BUFFER_SIZE);
 
 	ret = psp_ring_init(psp, PSP_RING_TYPE__KM);
-	if (ret)
+	if (ret) {
+		DRM_ERROR("PSP ring init failed!\n");
 		goto failed_mem;
+	}
 
 	ret = psp_tmr_init(psp);
-	if (ret)
+	if (ret) {
+		DRM_ERROR("PSP tmr init failed!\n");
 		goto failed_mem;
+	}
 
 	ret = psp_asd_init(psp);
-	if (ret)
+	if (ret) {
+		DRM_ERROR("PSP asd init failed!\n");
 		goto failed_mem;
+	}
 
 skip_memalloc:
 	ret = psp_hw_start(psp);
Signature · 6 lines
2.21.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#7 lore raw

RE: [PATCH 3/3] drm/amdgpu: add more debug friendly prompts

Ping..

Quoted 115 lines

-----Original Message-----
From: Evan Quan <[email protected]>
Sent: 2019年3月15日 14:02
To: [email protected]
Cc: Quan, Evan <[email protected]>
Subject: [PATCH 3/3] drm/amdgpu: add more debug friendly prompts

Large piece of codes share one error prompt. That is not friendly for debugging.

Change-Id I15f77210af6a409981fe44cf5dd3aa8ce48d948f
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 38 ++++++++++++++++++-
------
 1 file changed, 28 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +4 -2
index 32388b5218e9..5888e24219d9 100644
@@ -136,7 +136,7 @@ psp_cmd_submit_buf(struct psp_context *psp,
 
 	while (*((unsigned int *)psp->fence_buf) != index) {
 		if (--timeout == 0)
-			return -EINVAL;
+			break;
 		msleep(1);
 	}
 
@@ -147,12 +147,14 @@ psp_cmd_submit_buf(struct psp_context *psp,
 	 * during psp initialization to avoid breaking hw_init and it doesn't
 	 * return -EINVAL.
 	 */
-	if (psp->cmd_buf_mem->resp.status) {
+	if (psp->cmd_buf_mem->resp.status || !timeout) {
 		if (ucode)
 			DRM_WARN("failed to load ucode id (%d) ",
 				  ucode->ucode_id);
 		DRM_WARN("psp command failed and response status is
 (%d)\n",
 			  psp->cmd_buf_mem->resp.status);
+		if (!timeout)
+			return -EINVAL;
 	}
 

/* get xGMI session id from response buffer */ @@ -677,25 +679,35
@@ static int psp_hw_start(struct psp_context *psp)

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +24 -8
 	if (!amdgpu_sriov_vf(adev) || !adev->in_gpu_reset) {
 		ret = psp_bootloader_load_sysdrv(psp);
-		if (ret)
+		if (ret) {
+			DRM_ERROR("PSP load sysdrv failed!\n");
 			return ret;
+		}
 
 		ret = psp_bootloader_load_sos(psp);
-		if (ret)
+		if (ret) {
+			DRM_ERROR("PSP load sos failed!\n");
 			return ret;
+		}
 	}
 
 	ret = psp_ring_create(psp, PSP_RING_TYPE__KM);
-	if (ret)
+	if (ret) {
+		DRM_ERROR("PSP create ring failed!\n");
 		return ret;
+	}
 
 	ret = psp_tmr_load(psp);
-	if (ret)
+	if (ret) {
+		DRM_ERROR("PSP load tmr failed!\n");
 		return ret;
+	}
 
 	ret = psp_asd_load(psp);
-	if (ret)
+	if (ret) {
+		DRM_ERROR("PSP load asd failed!\n");
 		return ret;
+	}
 
 	if (adev->gmc.xgmi.num_physical_nodes > 1) {
 		ret = psp_xgmi_initialize(psp);
@@ -890,16 +902,22 @@ static int psp_load_fw(struct amdgpu_device
 *adev)
 	memset(psp->fence_buf, 0, PSP_FENCE_BUFFER_SIZE);
 
 	ret = psp_ring_init(psp, PSP_RING_TYPE__KM);
-	if (ret)
+	if (ret) {
+		DRM_ERROR("PSP ring init failed!\n");
 		goto failed_mem;
+	}
 
 	ret = psp_tmr_init(psp);
-	if (ret)
+	if (ret) {
+		DRM_ERROR("PSP tmr init failed!\n");
 		goto failed_mem;
+	}
 
 	ret = psp_asd_init(psp);
-	if (ret)
+	if (ret) {
+		DRM_ERROR("PSP asd init failed!\n");
 		goto failed_mem;
+	}
 
 skip_memalloc:
Quoted 3 lines

ret = psp_hw_start(psp);
--
2.21.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): MN2PR12MB3344D46779A9EE3EA9BE03F6E4430-rweVpJHSKToDMgCC8P//[email protected]

Reviewed-by Feifei Xu
#9 lore raw

RE: [PATCH 3/3] drm/amdgpu: add more debug friendly prompts

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Quan, Evan
Sent: Friday, March 22, 2019 4:31 PM
To: Quan, Evan <[email protected]>; [email protected]
Subject: RE: [PATCH 3/3] drm/amdgpu: add more debug friendly prompts

Ping..

Quoted 114 lines

-----Original Message-----
From: Evan Quan <[email protected]>
Sent: 2019年3月15日 14:02
To: [email protected]
Cc: Quan, Evan <[email protected]>
Subject: [PATCH 3/3] drm/amdgpu: add more debug friendly prompts

Large piece of codes share one error prompt. That is not friendly for debugging.

Change-Id I15f77210af6a409981fe44cf5dd3aa8ce48d948f
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 38 ++++++++++++++++++-
------
 1 file changed, 28 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +4 -2
index 32388b5218e9..5888e24219d9 100644
@@ -136,7 +136,7 @@ psp_cmd_submit_buf(struct psp_context *psp,
 
 	while (*((unsigned int *)psp->fence_buf) != index) {
 		if (--timeout == 0)
-			return -EINVAL;
+			break;
 		msleep(1);
 	}
 
@@ -147,12 +147,14 @@ psp_cmd_submit_buf(struct psp_context *psp,
 	 * during psp initialization to avoid breaking hw_init and it doesn't
 	 * return -EINVAL.
 	 */
-	if (psp->cmd_buf_mem->resp.status) {
+	if (psp->cmd_buf_mem->resp.status || !timeout) {
 		if (ucode)
 			DRM_WARN("failed to load ucode id (%d) ",
 				  ucode->ucode_id);
 		DRM_WARN("psp command failed and response status is (%d)\n",
 			  psp->cmd_buf_mem->resp.status);
+		if (!timeout)
+			return -EINVAL;
 	}
 
 	/* get xGMI session id from response buffer */ @@ -677,25 +679,35 @@ 

static int psp_hw_start(struct psp_context *psp)

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +24 -8
 	if (!amdgpu_sriov_vf(adev) || !adev->in_gpu_reset) {
 		ret = psp_bootloader_load_sysdrv(psp);
-		if (ret)
+		if (ret) {
+			DRM_ERROR("PSP load sysdrv failed!\n");
 			return ret;
+		}
 
 		ret = psp_bootloader_load_sos(psp);
-		if (ret)
+		if (ret) {
+			DRM_ERROR("PSP load sos failed!\n");
 			return ret;
+		}
 	}
 
 	ret = psp_ring_create(psp, PSP_RING_TYPE__KM);
-	if (ret)
+	if (ret) {
+		DRM_ERROR("PSP create ring failed!\n");
 		return ret;
+	}
 
 	ret = psp_tmr_load(psp);
-	if (ret)
+	if (ret) {
+		DRM_ERROR("PSP load tmr failed!\n");
 		return ret;
+	}
 
 	ret = psp_asd_load(psp);
-	if (ret)
+	if (ret) {
+		DRM_ERROR("PSP load asd failed!\n");
 		return ret;
+	}
 
 	if (adev->gmc.xgmi.num_physical_nodes > 1) {
 		ret = psp_xgmi_initialize(psp);
@@ -890,16 +902,22 @@ static int psp_load_fw(struct amdgpu_device
 *adev)
 	memset(psp->fence_buf, 0, PSP_FENCE_BUFFER_SIZE);
 
 	ret = psp_ring_init(psp, PSP_RING_TYPE__KM);
-	if (ret)
+	if (ret) {
+		DRM_ERROR("PSP ring init failed!\n");
 		goto failed_mem;
+	}
 
 	ret = psp_tmr_init(psp);
-	if (ret)
+	if (ret) {
+		DRM_ERROR("PSP tmr init failed!\n");
 		goto failed_mem;
+	}
 
 	ret = psp_asd_init(psp);
-	if (ret)
+	if (ret) {
+		DRM_ERROR("PSP asd init failed!\n");
 		goto failed_mem;
+	}
 
 skip_memalloc:
Quoted 3 lines

ret = psp_hw_start(psp);
--
2.21.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author
#10 lore raw
In reply to a message not in the archive

Ping..

Quoted 49 lines

-----Original Message-----
From: Evan Quan <[email protected]>
Sent: 2019年3月15日 14:02
To: [email protected]
Cc: Quan, Evan <[email protected]>
Subject: [PATCH 1/3] drm/amdgpu: error out on mode1 reset failure

The error return value should be correctly reflected.

Change-Id I93bf6fa77193d4e3f102a4e223aa8cb18cb525cc
---
 drivers/gpu/drm/amd/amdgpu/soc15.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/soc15.c +0 -0
index 0c5ce4bd6feb..9d33a5d73072 100644
@@ -393,6 +393,7 @@ void soc15_program_register_sequence(struct

amdgpu_device *adev, static int soc15_asic_mode1_reset(struct amdgpu_device *adev) {

drivers/gpu/drm/amd/amdgpu/soc15.c +5 -2
 	u32 i;
+	int ret = 0;
 
 	amdgpu_atombios_scratch_regs_engine_hung(adev, true);
@@ -403,7 +404,9 @@ static int soc15_asic_mode1_reset(struct
 amdgpu_device *adev)
 
 	pci_save_state(adev->pdev);
 
-	psp_gpu_reset(adev);
+	ret = psp_gpu_reset(adev);
+	if (ret)
+		dev_err(adev->dev, "GPU mode1 reset failed\n");
 
 	pci_restore_state(adev->pdev);
@@ -418,7 +421,7 @@ static int soc15_asic_mode1_reset(struct
 amdgpu_device *adev)
 
 	amdgpu_atombios_scratch_regs_engine_hung(adev, false);
 
-	return 0;
+	return ret;
 }
 
Quoted 4 lines

static int soc15_asic_get_baco_capability(struct amdgpu_device *adev, bool
*cap)
--
2.21.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): MN2PR12MB3344B70F5DA8EEB34412D592E4430-rweVpJHSKToDMgCC8P//[email protected]

Reviewed-by Feifei Xu
#12 lore raw

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Quan, Evan
Sent: Friday, March 22, 2019 4:32 PM
To: Quan, Evan <[email protected]>; [email protected]
Subject: RE: [PATCH 1/3] drm/amdgpu: error out on mode1 reset failure

Ping..

Quoted 49 lines

-----Original Message-----
From: Evan Quan <[email protected]>
Sent: 2019年3月15日 14:02
To: [email protected]
Cc: Quan, Evan <[email protected]>
Subject: [PATCH 1/3] drm/amdgpu: error out on mode1 reset failure

The error return value should be correctly reflected.

Change-Id I93bf6fa77193d4e3f102a4e223aa8cb18cb525cc
---
 drivers/gpu/drm/amd/amdgpu/soc15.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/soc15.c +0 -0
index 0c5ce4bd6feb..9d33a5d73072 100644
@@ -393,6 +393,7 @@ void soc15_program_register_sequence(struct

amdgpu_device *adev, static int soc15_asic_mode1_reset(struct amdgpu_device *adev) {

drivers/gpu/drm/amd/amdgpu/soc15.c +5 -2
 	u32 i;
+	int ret = 0;
 
 	amdgpu_atombios_scratch_regs_engine_hung(adev, true);
@@ -403,7 +404,9 @@ static int soc15_asic_mode1_reset(struct 
 amdgpu_device *adev)
 
 	pci_save_state(adev->pdev);
 
-	psp_gpu_reset(adev);
+	ret = psp_gpu_reset(adev);
+	if (ret)
+		dev_err(adev->dev, "GPU mode1 reset failed\n");
 
 	pci_restore_state(adev->pdev);
@@ -418,7 +421,7 @@ static int soc15_asic_mode1_reset(struct 
 amdgpu_device *adev)
 
 	amdgpu_atombios_scratch_regs_engine_hung(adev, false);
 
-	return 0;
+	return ret;
 }
 
Quoted 5 lines

static int soc15_asic_get_baco_capability(struct amdgpu_device *adev,
bool
*cap)
--
2.21.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx