On 11/19/25 01:22, Rodrigo Siqueira wrote:
> 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.

Mhm doing that on unload sounds like a bad idea to me.

We should rather do that on re-load to also cover the case of aborted VMs for 
example.

Regards,
Christian.

> 
> Suggested-by: Alex Deucher <[email protected]>
> Signed-off-by: Rodrigo Siqueira <[email protected]>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 860ac1f9e35d..80d00475bc9f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -3680,6 +3680,15 @@ 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.
> +      */
> +     if ((adev->flags & AMD_IS_APU) && !adev->gmc.is_app_apu) {
> +             r = amdgpu_asic_reset(adev);
> +             if (r)
> +                     dev_err(adev->dev, "asic reset on %s failed\n", 
> __func__);
> +     }
> +
>       return 0;
>  }
>  

Reply via email to