Skip to contentSkip to conversation

drm/amdgpu: Use default reset method handler

PATCH In review Lijo Lazar 2 participants 2 messages Sep 6, 2023 – Sep 7, 2023

Subsystems (2)
lore
Share & tools
lore

Lijo Lazar

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Use default reset method handler

When reset method is not passed in reset context, look for the handler for default reset method. On Aldebaran, default reset method for SOCs connected to CPU over XGMI is MODE2.

---
 drivers/gpu/drm/amd/amdgpu/aldebaran.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/aldebaran.c +7 -9
index 82e1c83a7ccc..5d2516210a3a 100644
@@ -50,6 +50,13 @@ aldebaran_get_reset_handler(struct amdgpu_reset_control *reset_ctl,
 	struct amdgpu_device *adev = (struct amdgpu_device *)reset_ctl->handle;
 	int i;
 
+	if (reset_context->method == AMD_RESET_METHOD_NONE) {
+		if (aldebaran_is_mode2_default(reset_ctl))
+			reset_context->method = AMD_RESET_METHOD_MODE2;
+		else
+			reset_context->method = amdgpu_asic_reset_method(adev);
+	}
+
 	if (reset_context->method != AMD_RESET_METHOD_NONE) {
 		dev_dbg(adev->dev, "Getting reset handler for method %d\n",
 			reset_context->method);
@@ -59,15 +66,6 @@ aldebaran_get_reset_handler(struct amdgpu_reset_control *reset_ctl,
 		}
 	}
 
-	if (aldebaran_is_mode2_default(reset_ctl)) {
-		for_each_handler(i, handler, reset_ctl)	{
-			if (handler->reset_method == AMD_RESET_METHOD_MODE2) {
-				reset_context->method = AMD_RESET_METHOD_MODE2;
-				return handler;
-			}
-		}
-	}
-
 	dev_dbg(adev->dev, "Reset handler not found!\n");
 
 	return NULL;
Signature · 1 line
2.25.1
Reviewed-by Tested-by on v1 1/1
#1 lore raw

[AMD Official Use Only - General]

Thanks & Regards
Asad

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, September 6, 2023 4:56 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Kamal, Asad <[email protected]>
Subject: [PATCH] drm/amdgpu: Use default reset method handler

When reset method is not passed in reset context, look for the handler for default reset method. On Aldebaran, default reset method for SOCs connected to CPU over XGMI is MODE2.

---
 drivers/gpu/drm/amd/amdgpu/aldebaran.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/aldebaran.c +7 -9
index 82e1c83a7ccc..5d2516210a3a 100644
@@ -50,6 +50,13 @@ aldebaran_get_reset_handler(struct amdgpu_reset_control *reset_ctl,
        struct amdgpu_device *adev = (struct amdgpu_device *)reset_ctl->handle;
        int i;
 
+       if (reset_context->method == AMD_RESET_METHOD_NONE) {
+               if (aldebaran_is_mode2_default(reset_ctl))
+                       reset_context->method = AMD_RESET_METHOD_MODE2;
+               else
+                       reset_context->method = amdgpu_asic_reset_method(adev);
+       }
+
        if (reset_context->method != AMD_RESET_METHOD_NONE) {
                dev_dbg(adev->dev, "Getting reset handler for method %d\n",
                        reset_context->method);
@@ -59,15 +66,6 @@ aldebaran_get_reset_handler(struct amdgpu_reset_control *reset_ctl,
                }
        }
 
-       if (aldebaran_is_mode2_default(reset_ctl)) {
-               for_each_handler(i, handler, reset_ctl) {
-                       if (handler->reset_method == AMD_RESET_METHOD_MODE2) {
-                               reset_context->method = AMD_RESET_METHOD_MODE2;
-                               return handler;
-                       }
-               }
-       }
-
        dev_dbg(adev->dev, "Reset handler not found!\n");
 
        return NULL;

--
2.25.1