Skip to contentSkip to conversation

drm/amdgpu: Fix GFX hang on SteamDeck when amdgpu is reloaded

PATCH Superseded Rodrigo Siqueira 2 participants 3 messages Oct 16, 2025

Subsystems (2)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/amdgpu: Fix GFX hang on SteamDeck when amdgpu is reloaded

When trying to unload amdgpu in the SteamDeck (TTY mode), the following set of errors happens and the system gets unstable:

[..]
[drm] Initialized amdgpu 3.64.0 for 0000:04:00.0 on minor 0
amdgpu 0000:04:00.0: [drm:amdgpu_ib_ring_tests [amdgpu]] *ERROR* IB test failed on gfx_0.0.0 (-110). amdgpu 0000:04:00.0: amdgpu: ib ring test failed (-110).
[..]
amdgpu 0000:04:00.0: amdgpu: SMU: I'm not done with your previous command: SMN_C2PMSG_66:0x0000001E SMN_C2PMSG_82:0x00000000 amdgpu 0000:04:00.0: amdgpu: Failed to disable gfxoff!
amdgpu 0000:04:00.0: amdgpu: SMU: I'm not done with your previous command: SMN_C2PMSG_66:0x0000001E SMN_C2PMSG_82:0x00000000 amdgpu 0000:04:00.0: amdgpu: Failed to disable gfxoff!
[..]

When the driver initializes the GPU, the PSP validates all the firmware loaded, and after that, it is not possible to load any other firmware unless the device is reset. What is happening in the load/unload situation is that PSP halts the GC engine because it suspects that something is amiss. To address this issue, this commit ensures that the GPU is reset (mode 2 reset) in the unload sequence.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +12 -1
index 0d5585bc3b04..78009b93855b 100644
@@ -3613,7 +3613,7 @@ static void amdgpu_device_smu_fini_early(struct amdgpu_device *adev)
 
 static int amdgpu_device_ip_fini_early(struct amdgpu_device *adev)
 {
-	int i, r;
+	int i, r, current_reset_method;
 
 	for (i = 0; i < adev->num_ip_blocks; i++) {
 		if (!adev->ip_blocks[i].version->funcs->early_fini)
@@ -3649,6 +3649,17 @@ static int amdgpu_device_ip_fini_early(struct amdgpu_device *adev)
 				"failed to release exclusive mode on fini\n");
 	}
 
+	/* Reset the device before entirely removing it to avoid load issues
+	 * caused by firmware validation.
+	 */
+	current_reset_method = amdgpu_reset_method;
+	amdgpu_reset_method = AMD_RESET_METHOD_MODE2;
+	r = amdgpu_asic_reset(adev);
+	if (r)
+		dev_err(adev->dev, "asic reset on %s failed\n", __func__);
+
+	amdgpu_reset_method = current_reset_method;
+
 	return 0;
 }
 
Signature · 1 line
2.51.0
#1 lore raw
Quoted 42 lines · Rodrigo Siqueira

When trying to unload amdgpu in the SteamDeck (TTY mode), the following set of errors happens and the system gets unstable:

[..]
[drm] Initialized amdgpu 3.64.0 for 0000:04:00.0 on minor 0
amdgpu 0000:04:00.0: [drm:amdgpu_ib_ring_tests [amdgpu]] *ERROR* IB test failed on gfx_0.0.0 (-110). amdgpu 0000:04:00.0: amdgpu: ib ring test failed (-110).
[..]
amdgpu 0000:04:00.0: amdgpu: SMU: I'm not done with your previous command: SMN_C2PMSG_66:0x0000001E SMN_C2PMSG_82:0x00000000 amdgpu 0000:04:00.0: amdgpu: Failed to disable gfxoff!
amdgpu 0000:04:00.0: amdgpu: SMU: I'm not done with your previous command: SMN_C2PMSG_66:0x0000001E SMN_C2PMSG_82:0x00000000 amdgpu 0000:04:00.0: amdgpu: Failed to disable gfxoff!
[..]

When the driver initializes the GPU, the PSP validates all the firmware loaded, and after that, it is not possible to load any other firmware unless the device is reset. What is happening in the load/unload situation is that PSP halts the GC engine because it suspects that something is amiss. To address this issue, this commit ensures that the GPU is reset (mode 2 reset) in the unload sequence.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
index 0d5585bc3b04..78009b93855b 100644
@@ -3613,7 +3613,7 @@ static void amdgpu_device_smu_fini_early(struct amdgpu_device *adev)
 
 static int amdgpu_device_ip_fini_early(struct amdgpu_device *adev)
 {
-       int i, r;
+       int i, r, current_reset_method;
 
        for (i = 0; i < adev->num_ip_blocks; i++) {
                if (!adev->ip_blocks[i].version->funcs->early_fini)

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_ip_fini_early(struct amdgpu_device *adev) · line 3656

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -0
@@ -3649,6 +3649,17 @@ static int amdgpu_device_ip_fini_early(struct amdgpu_device *adev)
                                "failed to release exclusive mode on fini\n");
        }
 
+       /* Reset the device before entirely removing it to avoid load issues
+        * caused by firmware validation.
+        */
+       current_reset_method = amdgpu_reset_method;
+       amdgpu_reset_method = AMD_RESET_METHOD_MODE2;

This would only be needed if the user has overridden the reset method via a kernel module parameter. If they've done that they get to keep the pieces. MODE2 reset is only used on certain chips so this won't work generally. Better to just drop this. amdgpu_asic_reset() will automatically default to the right reset method for the chip. Alternative is to set AMD_RESET_METHOD_NONE which is the automatic setting.

Alex

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 -1
+       r = amdgpu_asic_reset(adev);
+       if (r)
+               dev_err(adev->dev, "asic reset on %s failed\n", __func__);
+
+       amdgpu_reset_method = current_reset_method;
+
        return 0;
 }
 
--

2.51.0

#2 lore raw
Quoted 46 lines · Alex Deucher
Quoted 45 lines · Rodrigo Siqueira

When trying to unload amdgpu in the SteamDeck (TTY mode), the following set of errors happens and the system gets unstable:

[..]
[drm] Initialized amdgpu 3.64.0 for 0000:04:00.0 on minor 0
amdgpu 0000:04:00.0: [drm:amdgpu_ib_ring_tests [amdgpu]] *ERROR* IB test failed on gfx_0.0.0 (-110). amdgpu 0000:04:00.0: amdgpu: ib ring test failed (-110).
[..]
amdgpu 0000:04:00.0: amdgpu: SMU: I'm not done with your previous command: SMN_C2PMSG_66:0x0000001E SMN_C2PMSG_82:0x00000000 amdgpu 0000:04:00.0: amdgpu: Failed to disable gfxoff!
amdgpu 0000:04:00.0: amdgpu: SMU: I'm not done with your previous command: SMN_C2PMSG_66:0x0000001E SMN_C2PMSG_82:0x00000000 amdgpu 0000:04:00.0: amdgpu: Failed to disable gfxoff!
[..]

When the driver initializes the GPU, the PSP validates all the firmware loaded, and after that, it is not possible to load any other firmware unless the device is reset. What is happening in the load/unload situation is that PSP halts the GC engine because it suspects that something is amiss. To address this issue, this commit ensures that the GPU is reset (mode 2 reset) in the unload sequence.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
index 0d5585bc3b04..78009b93855b 100644
@@ -3613,7 +3613,7 @@ static void amdgpu_device_smu_fini_early(struct amdgpu_device *adev)
 
 static int amdgpu_device_ip_fini_early(struct amdgpu_device *adev)
 {
-       int i, r;
+       int i, r, current_reset_method;
 
        for (i = 0; i < adev->num_ip_blocks; i++) {
                if (!adev->ip_blocks[i].version->funcs->early_fini)
@@ -3649,6 +3649,17 @@ static int amdgpu_device_ip_fini_early(struct amdgpu_device *adev)
                                "failed to release exclusive mode on fini\n");
        }
 
Quoted 13 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_ip_fini_early(struct amdgpu_device *adev) · line 3656

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -0
+       /* Reset the device before entirely removing it to avoid load issues
+        * caused by firmware validation.
+        */
+       current_reset_method = amdgpu_reset_method;
+       amdgpu_reset_method = AMD_RESET_METHOD_MODE2;

This would only be needed if the user has overridden the reset method via a kernel module parameter. If they've done that they get to keep the pieces. MODE2 reset is only used on certain chips so this won't work generally. Better to just drop this. amdgpu_asic_reset() will automatically default to the right reset method for the chip. Alternative is to set AMD_RESET_METHOD_NONE which is the automatic setting.

I'll send a V3 whithout the method mode 2 setup.

Thanks a lot

Quoted 15 lines

Alex

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 -1
+       r = amdgpu_asic_reset(adev);
+       if (r)
+               dev_err(adev->dev, "asic reset on %s failed\n", __func__);
+
+       amdgpu_reset_method = current_reset_method;
+
        return 0;
 }
 
--

2.51.0

Signature · 1 line
Rodrigo Siqueira