[PATCH 2/2] drm/amdgpu: only hw fini SMU fisrt for ASICs need that

Wang, Yang(Kevin) KevinYang.Wang at amd.com
Wed Dec 8 10:09:42 UTC 2021


[AMD Official Use Only]

Reviewed-by: Kevin Wang <kevinyang.wang at amd.com>

Best Regards,
Kevin
________________________________
From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> on behalf of Lang Yu <lang.yu at amd.com>
Sent: Wednesday, December 8, 2021 5:26 PM
To: amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>
Cc: Deucher, Alexander <Alexander.Deucher at amd.com>; Yu, Lang <Lang.Yu at amd.com>; Lazar, Lijo <Lijo.Lazar at amd.com>; Huang, Ray <Ray.Huang at amd.com>
Subject: [PATCH 2/2] drm/amdgpu: only hw fini SMU fisrt for ASICs need that

We found some headaches on ASICs don't need that,
so remove that for them.

Suggested-by: Lijo Lazar <lijo.lazar at amd.com>
Signed-off-by: Lang Yu <lang.yu at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 47 +++++++++++++++-------
 1 file changed, 32 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 3c5afa45173c..b5b32a582c51 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2656,6 +2656,36 @@ static int amdgpu_device_ip_late_init(struct amdgpu_device *adev)
         return 0;
 }

+/**
+ * amdgpu_device_smu_fini_early - smu hw_fini wrapper
+ *
+ * @adev: amdgpu_device pointer
+ *
+ * For ASICs need to disable SMC first
+ */
+static void amdgpu_device_smu_fini_early(struct amdgpu_device *adev)
+{
+       int i, r;
+
+       if (adev->ip_versions[GC_HWIP][0] > IP_VERSION(9, 0, 0))
+               return;
+
+       for (i = 0; i < adev->num_ip_blocks; i++) {
+               if (!adev->ip_blocks[i].status.hw)
+                       continue;
+               if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_SMC) {
+                       r = adev->ip_blocks[i].version->funcs->hw_fini((void *)adev);
+                       /* XXX handle errors */
+                       if (r) {
+                               DRM_DEBUG("hw_fini of IP block <%s> failed %d\n",
+                                         adev->ip_blocks[i].version->funcs->name, r);
+                       }
+                       adev->ip_blocks[i].status.hw = false;
+                       break;
+               }
+       }
+}
+
 static int amdgpu_device_ip_fini_early(struct amdgpu_device *adev)
 {
         int i, r;
@@ -2676,21 +2706,8 @@ static int amdgpu_device_ip_fini_early(struct amdgpu_device *adev)
         amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE);
         amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE);

-       /* need to disable SMC first */
-       for (i = 0; i < adev->num_ip_blocks; i++) {
-               if (!adev->ip_blocks[i].status.hw)
-                       continue;
-               if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_SMC) {
-                       r = adev->ip_blocks[i].version->funcs->hw_fini((void *)adev);
-                       /* XXX handle errors */
-                       if (r) {
-                               DRM_DEBUG("hw_fini of IP block <%s> failed %d\n",
-                                         adev->ip_blocks[i].version->funcs->name, r);
-                       }
-                       adev->ip_blocks[i].status.hw = false;
-                       break;
-               }
-       }
+       /* Workaroud for ASICs need to disable SMC first */
+       amdgpu_device_smu_fini_early(adev);

         for (i = adev->num_ip_blocks - 1; i >= 0; i--) {
                 if (!adev->ip_blocks[i].status.hw)
--
2.25.1

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20211208/1dcab885/attachment.htm>


More information about the amd-gfx mailing list