drm/amd/pm: add 5s custom timeout for unload messages

The default SMU message timeout may be too short for the
PrepareMp1ForUnload message on smu_v15_0_8, leading to spurious
-ETIME errors under load or slow firmware response conditions.

Introduce SMU_V15_0_8_MSG_TIMEOUT_US (5 seconds) and apply it to:
  - smu_v15_0_8_notify_unload(): switch from smu_cmn_send_smc_msg()
    to smu_cmn_send_smc_msg_with_params_ext() to pass the explicit
    timeout.
v2: Use c2pmsgctl and args directly (Lijo)

Signed-off-by: Asad Kamal <asad.kamal@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Asad Kamal 2026-06-30 21:37:11 +08:00 committed by Alex Deucher
parent 90580da8ce
commit 93eca5a03b

View File

@ -72,6 +72,9 @@
#define NUM_JPEG_RINGS_FW 10
/* Custom 5-second timeout (in us) for unload messages */
#define SMU_V15_0_8_MSG_TIMEOUT_US (5 * 1000 * 1000)
#define to_amdgpu_device(x) (container_of(x, struct amdgpu_device, pm.smu_i2c))
#define SMU_15_0_8_FEA_MAP(smu_feature, smu_15_0_8_feature) \
@ -1279,12 +1282,18 @@ static int smu_v15_0_8_register_irq_handler(struct smu_context *smu)
static int smu_v15_0_8_notify_unload(struct smu_context *smu)
{
struct smu_msg_ctl *ctl = &smu->msg_ctl;
struct smu_msg_args args = {
.msg = SMU_MSG_PrepareMp1ForUnload,
.timeout = SMU_V15_0_8_MSG_TIMEOUT_US,
};
if (amdgpu_in_reset(smu->adev))
return 0;
dev_dbg(smu->adev->dev, "Notify PMFW about driver unload");
/* Ignore return, just intimate FW that driver is not going to be there */
smu_cmn_send_smc_msg(smu, SMU_MSG_PrepareMp1ForUnload, NULL);
ctl->ops->send_msg(ctl, &args);
return 0;
}