Skip to contentSkip to conversation

drm/amdgpu: add mode1 (psp) reset for navi asic

PATCH In review Wang, Kevin(Yang) 1 participant 2 messages Jul 5, 2019 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: add mode1 (psp) reset for navi asic

add mode1 (by psp) reset for navi asic.

Change-Id Id2e7cb11eb7026296d1488c7c39f895b100f206c
---
 drivers/gpu/drm/amd/amdgpu/nv.c | 35 +++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
drivers/gpu/drm/amd/amdgpu/nv.c +35 -0
index f6f152e6ade4..05fd4736bc0c 100644
@@ -256,6 +256,39 @@ static void nv_gpu_pci_config_reset(struct amdgpu_device *adev)
 }
 #endif
 
+static int nv_asic_mode1_reset(struct amdgpu_device *adev)
+{
+	u32 i;
+	int ret = 0;
+
+	amdgpu_atombios_scratch_regs_engine_hung(adev, true);
+
+	dev_info(adev->dev, "GPU mode1 reset\n");
+
+	/* disable BM */
+	pci_clear_master(adev->pdev);
+
+	pci_save_state(adev->pdev);
+
+	ret = psp_gpu_reset(adev);
+	if (ret)
+		dev_err(adev->dev, "GPU mode1 reset failed\n");
+
+	pci_restore_state(adev->pdev);
+
+	/* wait for asic to come out of reset */
+	for (i = 0; i < adev->usec_timeout; i++) {
+		u32 memsize = adev->nbio_funcs->get_memsize(adev);
+
+		if (memsize != 0xffffffff)
+			break;
+		udelay(1);
+	}
+
+	amdgpu_atombios_scratch_regs_engine_hung(adev, false);
+
+	return ret;
+}
 static int nv_asic_reset(struct amdgpu_device *adev)
 {
 
@@ -272,6 +305,8 @@ static int nv_asic_reset(struct amdgpu_device *adev)
 
 	if (smu_baco_is_support(smu)) {
 		ret = smu_baco_reset(smu);
+	} else {
+		ret = nv_asic_mode1_reset(adev);
 	}
 
 	return ret;
Signature · 6 lines
2.22.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): DM5PR12MB141852448B0C14F9A544533EFCF50@DM5PR12MB1418.namprd12.prod.outlook.com

A message that is not in the archive (sent off-list or not yet received): DM5PR12MB141852448B0C14F9A544533EFCF50-2J9CzHegvk81aAVlcVN8UQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

author Reviewed-by Hawking Zhang
#3 lore raw

okay, thanks.

Best Regards,

Kevin

________________________________
From: Zhang, Hawking
Sent: Friday, July 5, 2019 1:02:08 PM
To: Wang, Kevin(Yang); [email protected]
Cc: Xiao, Jack; [email protected]
Subject: RE: [PATCH] drm/amdgpu: add mode1 (psp) reset for navi asic

        if (smu_baco_is_support(smu)) {
                 ret = smu_baco_reset(smu);
+       } else {
+               ret = nv_asic_mode1_reset(adev);
         }

We don’t need {} for single statements. With that fixed, the patch is

Regards,
Hawking

-----Original Message-----
From: Wang, Kevin(Yang) <[email protected]>
Sent: 2019年7月5日 12:58
To: [email protected]
Cc: Xiao, Jack <[email protected]>; [email protected]; Zhang, Hawking <[email protected]>; Wang, Kevin(Yang) <[email protected]>
Subject: [PATCH] drm/amdgpu: add mode1 (psp) reset for navi asic

add mode1 (by psp) reset for navi asic.

Change-Id Id2e7cb11eb7026296d1488c7c39f895b100f206c
---
 drivers/gpu/drm/amd/amdgpu/nv.c | 35 +++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
drivers/gpu/drm/amd/amdgpu/nv.c +34 -0
@@ -256,6 +256,39 @@ static void nv_gpu_pci_config_reset(struct amdgpu_device *adev)  }  #endif
 
+static int nv_asic_mode1_reset(struct amdgpu_device *adev) {
+       u32 i;
+       int ret = 0;
+
+       amdgpu_atombios_scratch_regs_engine_hung(adev, true);
+
+       dev_info(adev->dev, "GPU mode1 reset\n");
+
+       /* disable BM */
+       pci_clear_master(adev->pdev);
+
+       pci_save_state(adev->pdev);
+
+       ret = psp_gpu_reset(adev);
+       if (ret)
+               dev_err(adev->dev, "GPU mode1 reset failed\n");
+
+       pci_restore_state(adev->pdev);
+
+       /* wait for asic to come out of reset */
+       for (i = 0; i < adev->usec_timeout; i++) {
+               u32 memsize = adev->nbio_funcs->get_memsize(adev);
+
+               if (memsize != 0xffffffff)
+                       break;
+               udelay(1);
+       }
+
+       amdgpu_atombios_scratch_regs_engine_hung(adev, false);
+
+       return ret;
+}
 static int nv_asic_reset(struct amdgpu_device *adev)  {
 
@@ -272,6 +305,8 @@ static int nv_asic_reset(struct amdgpu_device *adev)
 
         if (smu_baco_is_support(smu)) {
                 ret = smu_baco_reset(smu);
+       } else {
+               ret = nv_asic_mode1_reset(adev);
         }
 
         return ret;

--
2.22.0

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