On Tue, Mar 11, 2025 at 5:03 AM Kenneth Feng <kenneth.feng@xxxxxxx> wrote: > > This is a bug fix. The scenario is that the same client can add the certain > workload type refcount multiple times. Then the same client can not remove > this setting when it wants to get back to the default bootup workload. This will break the ref count handling. Alex > > Signed-off-by: Kenneth Feng <kenneth.feng@xxxxxxx> > --- > drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c > index 8cfb07549f54..592bf54015c6 100644 > --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c > +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c > @@ -2273,7 +2273,8 @@ static int smu_bump_power_profile_mode(struct smu_context *smu, > static void smu_power_profile_mode_get(struct smu_context *smu, > enum PP_SMC_POWER_PROFILE profile_mode) > { > - smu->workload_refcount[profile_mode]++; > + if (!smu->workload_refcount[profile_mode]) > + smu->workload_refcount[profile_mode]++; > } > > static void smu_power_profile_mode_put(struct smu_context *smu, > -- > 2.34.1 >