]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amdgpu: Refactor mode2 reset logic for v11.0.7
authorVictor Zhao <Victor.Zhao@amd.com>
Thu, 13 Oct 2022 07:53:19 +0000 (15:53 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 19 Oct 2022 02:08:40 +0000 (22:08 -0400)
- refactor mode2 on v11.0.7 to align with aldebaran
- comment out using mode2 reset as default for now, will introduce
another controller to replace previous reset_level_mask

v2: squash in unused variable removal (Alex)

Signed-off-by: Victor Zhao <Victor.Zhao@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/sienna_cichlid.c

index 7aa570c1ce4a96139201339d7d1b7bdf23fa71c5..81a6d5b94987f106d3225be7d774cf1f7cf55098 100644 (file)
 #include "amdgpu_psp.h"
 #include "amdgpu_xgmi.h"
 
+static bool sienna_cichlid_is_mode2_default(struct amdgpu_reset_control *reset_ctl)
+{
+#if 0
+       struct amdgpu_device *adev = (struct amdgpu_device *)reset_ctl->handle;
+
+       if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(11, 0, 7) &&
+           adev->pm.fw_version >= 0x3a5500 && !amdgpu_sriov_vf(adev))
+               return true;
+#endif
+       return false;
+}
+
 static struct amdgpu_reset_handler *
 sienna_cichlid_get_reset_handler(struct amdgpu_reset_control *reset_ctl,
                            struct amdgpu_reset_context *reset_context)
 {
        struct amdgpu_reset_handler *handler;
-       struct amdgpu_device *adev = (struct amdgpu_device *)reset_ctl->handle;
 
        if (reset_context->method != AMD_RESET_METHOD_NONE) {
                list_for_each_entry(handler, &reset_ctl->reset_handlers,
@@ -44,15 +55,13 @@ sienna_cichlid_get_reset_handler(struct amdgpu_reset_control *reset_ctl,
                        if (handler->reset_method == reset_context->method)
                                return handler;
                }
-       } else {
-               list_for_each_entry(handler, &reset_ctl->reset_handlers,
+       }
+
+       if (sienna_cichlid_is_mode2_default(reset_ctl)) {
+               list_for_each_entry (handler, &reset_ctl->reset_handlers,
                                     handler_list) {
-                       if (handler->reset_method == AMD_RESET_METHOD_MODE2 &&
-                           adev->pm.fw_version >= 0x3a5500 &&
-                           !amdgpu_sriov_vf(adev)) {
-                               reset_context->method = AMD_RESET_METHOD_MODE2;
+                       if (handler->reset_method == AMD_RESET_METHOD_MODE2)
                                return handler;
-                       }
                }
        }