]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/pm: Don't clear SI SMC table when setting power limit
authorTimur Kristóf <timur.kristof@gmail.com>
Mon, 19 Jan 2026 20:36:23 +0000 (21:36 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 21 Jan 2026 19:55:33 +0000 (14:55 -0500)
There is no reason to clear the SMC table.
We also don't need to recalculate the power limit then.

Fixes: 841686df9f7d ("drm/amdgpu: add SI DPM support (v4)")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit e214d626253f5b180db10dedab161b7caa41f5e9)

drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c

index 9a6f4f584c1baa831f8006d9b2117bfb0b9869cb..85f2b9540eabd65aa712d528c4333707cee52482 100644 (file)
@@ -2273,8 +2273,6 @@ static int si_populate_smc_tdp_limits(struct amdgpu_device *adev,
                if (scaling_factor == 0)
                        return -EINVAL;
 
-               memset(smc_table, 0, sizeof(SISLANDS_SMC_STATETABLE));
-
                ret = si_calculate_adjusted_tdp_limits(adev,
                                                       false, /* ??? */
                                                       adev->pm.dpm.tdp_adjustment,
@@ -2328,16 +2326,8 @@ static int si_populate_smc_tdp_limits_2(struct amdgpu_device *adev,
 
        if (ni_pi->enable_power_containment) {
                SISLANDS_SMC_STATETABLE *smc_table = &si_pi->smc_statetable;
-               u32 scaling_factor = si_get_smc_power_scaling_factor(adev);
                int ret;
 
-               memset(smc_table, 0, sizeof(SISLANDS_SMC_STATETABLE));
-
-               smc_table->dpm2Params.NearTDPLimit =
-                       cpu_to_be32(si_scale_power_for_smc(adev->pm.dpm.near_tdp_limit_adjusted, scaling_factor) * 1000);
-               smc_table->dpm2Params.SafePowerLimit =
-                       cpu_to_be32(si_scale_power_for_smc((adev->pm.dpm.near_tdp_limit_adjusted * SISLANDS_DPM2_TDP_SAFE_LIMIT_PERCENT) / 100, scaling_factor) * 1000);
-
                ret = amdgpu_si_copy_bytes_to_smc(adev,
                                                  (si_pi->state_table_start +
                                                   offsetof(SISLANDS_SMC_STATETABLE, dpm2Params) +