drm/amd: Drop superfluous call to set_power_limit()
Subsystems (3)
PATCH 1/1 drm/amd: Drop superfluous call to set_power_limit()
smu_set_power_limit() will call set_power_limit() if the limit type isn't default ppt, but after a bound check will call set_power_limit() regardless.
The first callpath is not necessary, remove it and do the bounds check for all calls.
--- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -4
@@ -2939,10 +2939,6 @@ static int smu_set_power_limit(void *handle, uint32_t limit)return -EOPNOTSUPP ; limit &= (1 <<24 )-1 ; -if (limit_type !=SMU_DEFAULT_PPT_LIMIT ) -if (smu->ppt_funcs->set_power_limit) -return smu->ppt_funcs->set_power_limit (smu, limit_type, limit); -if ((limit > smu->max_power_limit) || (limit < smu->min_power_limit)) { dev_err(smu->adev->dev, "New power limit (%d) is out of range [%d,%d]\n",
Signature · 1 line
2.51.0
[Public]
This is because currently only Vangogh has Fast PPT limit. The limit for that is not the same as default one. It will be higher than the max_power_limit. Since this is Vangogh-only, it's left to the implementation to handle that check.
Thanks,
Lijo
-----Original Message-----
From: Limonciello, Mario <[email protected]>
Sent: Wednesday, October 1, 2025 10:44 PM
To: Limonciello, Mario <[email protected]>; [email protected]
Cc: Lazar, Lijo <[email protected]>
Subject: [PATCH] drm/amd: Drop superfluous call to set_power_limit()
smu_set_power_limit() will call set_power_limit() if the limit type isn't default ppt, but after a bound check will call set_power_limit() regardless.
The first callpath is not necessary, remove it and do the bounds check for all calls.
--- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -4
@@ -2939,10 +2939,6 @@ static int smu_set_power_limit(void *handle, uint32_t limit)return -EOPNOTSUPP ; limit &= (1 <<24 )-1 ; -if (limit_type !=SMU_DEFAULT_PPT_LIMIT ) -if (smu->ppt_funcs->set_power_limit) -return smu->ppt_funcs->set_power_limit (smu, limit_type, limit); -if ((limit > smu->max_power_limit) || (limit < smu->min_power_limit)) { dev_err(smu->adev->dev, "New power limit (%d) is out of range [%d,%d]\n",
--
2.51.0
Got it thanks. Will disregard this one.
Quoted 42 lines · Lijo
[Public]
This is because currently only Vangogh has Fast PPT limit. The limit for that is not the same as default one. It will be higher than the
max_power_limit. Since this is Vangogh-only, it's left to the implementation to handle that check.Thanks,
Lijo
-----Original Message-----
From: Limonciello, Mario <[email protected]>
Sent: Wednesday, October 1, 2025 10:44 PM
To: Limonciello, Mario <[email protected]>; [email protected]
Cc: Lazar, Lijo <[email protected]>
Subject: [PATCH] drm/amd: Drop superfluous call toset_power_limit()
smu_set_power_limit()will callset_power_limit()if the limit type isn't default ppt, but after a bound check will callset_power_limit()regardless.The first callpath is not necessary, remove it and do the bounds check for all calls.
Cc Lijo Lazar <[email protected]>Signed-off-by Mario Limonciello <[email protected]>--- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 4 ---- 1 file changed, 4 deletions(-)drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0
-5@@ -2939,10 +2939,6 @@ static int smu_set_power_limit(void *handle, uint32_t limit)return -EOPNOTSUPP ; limit &= (1 <<24 )-1 ; -if (limit_type !=SMU_DEFAULT_PPT_LIMIT ) -if (smu->ppt_funcs->set_power_limit) -return smu->ppt_funcs->set_power_limit (smu, limit_type, limit); -if ((limit > smu->max_power_limit) || (limit < smu->min_power_limit)) { dev_err(smu->adev->dev, "New power limit (%d) is out of range [%d,%d]\n", --2.51.0