Skip to contentSkip to conversation

drm/amd: Drop superfluous call to set_power_limit()

PATCH In review Mario Limonciello 2 participants 3 messages Oct 1, 2025 – Oct 6, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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
index ac99bb7e2e7b..431333060b72 100644
@@ -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
#1 lore raw

[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
index ac99bb7e2e7b..431333060b72 100644
@@ -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

#2 lore raw

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 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 -5
index ac99bb7e2e7b..431333060b72 100644
@@ -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