drm/amd/pm: zero unused SMU argument registers
Subsystems (3)
PATCH 1/1 drm/amd/pm: zero unused SMU argument registers
SMU messages may use fewer arguments than the available argument registers, the previous code only wrote used registers and left the rest unchanged, so stale values from a prior message could persist.
Write all argument registers for each message and zero the unused tail to keep command arguments deterministic and avoid unintended carry-over.
--- drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +6 -2
@@ -313,11 +313,15 @@ static void __smu_msg_v1_send(struct smu_msg_ctl *ctl, u16 index, {struct amdgpu_device *adev = ctl->smu->adev;struct smu_msg_config *cfg = &ctl->config; +u32 arg;int i;WREG32 (cfg->resp_reg,0 ); -for (i =0 ; i < args->num_args; i++) -WREG32 (cfg->arg_regs[i], args->args[i]); +for (i =0 ; i < ctl->config.num_arg_regs; i++) { +/* NOTE: Clear unused argument registers to avoid stale values. */ + arg = i < args->num_args ? args->args[i] :0 ; +WREG32 (cfg->arg_regs[i], arg); + }WREG32 (cfg->msg_reg, index); }
Signature · 1 line
2.47.3
AMD General
With minor nit below
Thanks & Regards
Asad
-----Original Message-----
From: Wang, Yang(Kevin) <[email protected]>
Sent: Monday, June 1, 2026 1:27 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Feng, Kenneth <[email protected]>; Kamal, Asad <[email protected]>; Lazar, Lijo <[email protected]>
Subject: [PATCH] drm/amd/pm: zero unused SMU argument registers
SMU messages may use fewer arguments than the available argument registers, the previous code only wrote used registers and left the rest unchanged, so stale values from a prior message could persist.
Write all argument registers for each message and zero the unused tail to keep command arguments deterministic and avoid unintended carry-over.
--- drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +2 -2
@@ -313,11 +313,15 @@ static void __smu_msg_v1_send(struct smu_msg_ctl *ctl, u16 index, {struct amdgpu_device *adev = ctl->smu->adev;struct smu_msg_config *cfg = &ctl->config; +u32 arg;int i;WREG32 (cfg->resp_reg,0 ); -for (i =0 ; i < args->num_args; i++) -WREG32 (cfg->arg_regs[i], args->args[i]); +for (i =0 ; i < ctl->config.num_arg_regs; i++) {
AK: Can directly use cfg as already defined as local variable
+ /* NOTE: Clear unused argument registers to avoid stale values. */
+ arg = i < args->num_args ? args->args[i] : 0;
+ WREG32(cfg->arg_regs[i], arg);
+ }
WREG32(cfg->msg_reg, index);}
--
2.47.3
AMD General
Quoted 56 lines
-----Original Message-----
From: Kamal, Asad <[email protected]>
Sent: Monday, June 1, 2026 5:00 PM
To: Wang, Yang(Kevin) <[email protected]>; amd- [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Feng, Kenneth <[email protected]>; Lazar, Lijo <[email protected]>
Subject: RE: [PATCH] drm/amd/pm: zero unused SMU argument registersAMD General
With minor nit below
Reviewed-by Asad Kamal <[email protected]>Thanks & Regards
Asad-----Original Message-----
From: Wang, Yang(Kevin) <[email protected]>
Sent: Monday, June 1, 2026 1:27 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>; Feng, Kenneth <[email protected]>; Kamal, Asad <[email protected]>; Lazar, Lijo <[email protected]>
Subject: [PATCH] drm/amd/pm: zero unused SMU argument registersSMU messages may use fewer arguments than the available argument registers, the previous code only wrote used registers and left the rest unchanged, so stale values from a prior message could persist.
Write all argument registers for each message and zero the unused tail to keep command arguments deterministic and avoid unintended carry-over.
Signed-off-by Yang Wang <[email protected]>--- drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +2
-2@@ -313,11 +313,15 @@ static void __smu_msg_v1_send(struct smu_msg_ctl *ctl, u16 index, { struct amdgpu_device *adev = ctl->smu->adev;struct smu_msg_config *cfg = &ctl->config; +u32 arg;int i;WREG32 (cfg->resp_reg,0 ); -for (i =0 ; i < args->num_args; i++) -WREG32 (cfg->arg_regs[i], args->args[i]); +for (i =0 ; i < ctl->config.num_arg_regs; i++) {
Quoted 1 line
AK: Can directly use cfg as already defined as local variable
Ok, this make sense.
Best Regards,
Kevin
Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +4
-1+/* NOTE: Clear unused argument registers to avoid stale values. */ + arg = i < args->num_args ? args->args[i] :0 ; +WREG32 (cfg->arg_regs[i], arg); + }WREG32 (cfg->msg_reg, index); } --2.47.3