* [PATCH] drm/amdgpu/swm14: Update power limit logic
@ 2025-08-08 20:29 Alex Deucher
2025-08-12 17:39 ` Alex Deucher
0 siblings, 1 reply; 4+ messages in thread
From: Alex Deucher @ 2025-08-08 20:29 UTC (permalink / raw)
To: amd-gfx; +Cc: Alex Deucher
Take into account the limits from the vbios. Ported
from the SMU13 code.
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4352
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
.../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c | 30 +++++++++++++++----
1 file changed, 25 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
index 3aea32baea3da..f32474af90b34 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
@@ -1697,9 +1697,11 @@ static int smu_v14_0_2_get_power_limit(struct smu_context *smu,
uint32_t *min_power_limit)
{
struct smu_table_context *table_context = &smu->smu_table;
+ struct smu_14_0_2_powerplay_table *powerplay_table =
+ table_context->power_play_table;
PPTable_t *pptable = table_context->driver_pptable;
CustomSkuTable_t *skutable = &pptable->CustomSkuTable;
- uint32_t power_limit;
+ uint32_t power_limit, od_percent_upper = 0, od_percent_lower = 0;
uint32_t msg_limit = pptable->SkuTable.MsgLimits.Power[PPT_THROTTLER_PPT0][POWER_SOURCE_AC];
if (smu_v14_0_get_current_power_limit(smu, &power_limit))
@@ -1712,11 +1714,29 @@ static int smu_v14_0_2_get_power_limit(struct smu_context *smu,
if (default_power_limit)
*default_power_limit = power_limit;
- if (max_power_limit)
- *max_power_limit = msg_limit;
+ if (powerplay_table) {
+ if (smu->od_enabled &&
+ smu_v14_0_2_is_od_feature_supported(smu, PP_OD_FEATURE_PPT_BIT)) {
+ od_percent_upper = pptable->SkuTable.OverDriveLimitsBasicMax.Ppt;
+ od_percent_lower = pptable->SkuTable.OverDriveLimitsBasicMin.Ppt;
+ } else if (smu_v14_0_2_is_od_feature_supported(smu, PP_OD_FEATURE_PPT_BIT)) {
+ od_percent_upper = 0;
+ od_percent_lower = pptable->SkuTable.OverDriveLimitsBasicMin.Ppt;
+ }
+ }
+
+ dev_dbg(smu->adev->dev, "od percent upper:%d, od percent lower:%d (default power: %d)\n",
+ od_percent_upper, od_percent_lower, power_limit);
+
+ if (max_power_limit) {
+ *max_power_limit = msg_limit * (100 + od_percent_upper);
+ *max_power_limit /= 100;
+ }
- if (min_power_limit)
- *min_power_limit = 0;
+ if (min_power_limit) {
+ *min_power_limit = power_limit * (100 + od_percent_lower);
+ *min_power_limit /= 100;
+ }
return 0;
}
--
2.50.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/amdgpu/swm14: Update power limit logic
2025-08-08 20:29 [PATCH] drm/amdgpu/swm14: Update power limit logic Alex Deucher
@ 2025-08-12 17:39 ` Alex Deucher
2025-08-13 10:11 ` Zhang, Jesse(Jie)
2025-08-13 11:16 ` Feng, Kenneth
0 siblings, 2 replies; 4+ messages in thread
From: Alex Deucher @ 2025-08-12 17:39 UTC (permalink / raw)
To: Alex Deucher, Kenneth Feng; +Cc: amd-gfx
Ping?
Alex
On Fri, Aug 8, 2025 at 4:29 PM Alex Deucher <alexander.deucher@amd.com> wrote:
>
> Take into account the limits from the vbios. Ported
> from the SMU13 code.
>
> Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4352
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
> .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c | 30 +++++++++++++++----
> 1 file changed, 25 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
> index 3aea32baea3da..f32474af90b34 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
> @@ -1697,9 +1697,11 @@ static int smu_v14_0_2_get_power_limit(struct smu_context *smu,
> uint32_t *min_power_limit)
> {
> struct smu_table_context *table_context = &smu->smu_table;
> + struct smu_14_0_2_powerplay_table *powerplay_table =
> + table_context->power_play_table;
> PPTable_t *pptable = table_context->driver_pptable;
> CustomSkuTable_t *skutable = &pptable->CustomSkuTable;
> - uint32_t power_limit;
> + uint32_t power_limit, od_percent_upper = 0, od_percent_lower = 0;
> uint32_t msg_limit = pptable->SkuTable.MsgLimits.Power[PPT_THROTTLER_PPT0][POWER_SOURCE_AC];
>
> if (smu_v14_0_get_current_power_limit(smu, &power_limit))
> @@ -1712,11 +1714,29 @@ static int smu_v14_0_2_get_power_limit(struct smu_context *smu,
> if (default_power_limit)
> *default_power_limit = power_limit;
>
> - if (max_power_limit)
> - *max_power_limit = msg_limit;
> + if (powerplay_table) {
> + if (smu->od_enabled &&
> + smu_v14_0_2_is_od_feature_supported(smu, PP_OD_FEATURE_PPT_BIT)) {
> + od_percent_upper = pptable->SkuTable.OverDriveLimitsBasicMax.Ppt;
> + od_percent_lower = pptable->SkuTable.OverDriveLimitsBasicMin.Ppt;
> + } else if (smu_v14_0_2_is_od_feature_supported(smu, PP_OD_FEATURE_PPT_BIT)) {
> + od_percent_upper = 0;
> + od_percent_lower = pptable->SkuTable.OverDriveLimitsBasicMin.Ppt;
> + }
> + }
> +
> + dev_dbg(smu->adev->dev, "od percent upper:%d, od percent lower:%d (default power: %d)\n",
> + od_percent_upper, od_percent_lower, power_limit);
> +
> + if (max_power_limit) {
> + *max_power_limit = msg_limit * (100 + od_percent_upper);
> + *max_power_limit /= 100;
> + }
>
> - if (min_power_limit)
> - *min_power_limit = 0;
> + if (min_power_limit) {
> + *min_power_limit = power_limit * (100 + od_percent_lower);
> + *min_power_limit /= 100;
> + }
>
> return 0;
> }
> --
> 2.50.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] drm/amdgpu/swm14: Update power limit logic
2025-08-12 17:39 ` Alex Deucher
@ 2025-08-13 10:11 ` Zhang, Jesse(Jie)
2025-08-13 11:16 ` Feng, Kenneth
1 sibling, 0 replies; 4+ messages in thread
From: Zhang, Jesse(Jie) @ 2025-08-13 10:11 UTC (permalink / raw)
To: Alex Deucher, Deucher, Alexander, Feng, Kenneth
Cc: amd-gfx@lists.freedesktop.org
[AMD Official Use Only - AMD Internal Distribution Only]
This patch is:
Reviewed-by: Jesse Zhang <Jesse.Zhang@amd.com>
-----Original Message-----
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Alex Deucher
Sent: Wednesday, August 13, 2025 1:39 AM
To: Deucher, Alexander <Alexander.Deucher@amd.com>; Feng, Kenneth <Kenneth.Feng@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdgpu/swm14: Update power limit logic
Ping?
Alex
On Fri, Aug 8, 2025 at 4:29 PM Alex Deucher <alexander.deucher@amd.com> wrote:
>
> Take into account the limits from the vbios. Ported from the SMU13
> code.
>
> Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4352
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
> .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c | 30
> +++++++++++++++----
> 1 file changed, 25 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
> b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
> index 3aea32baea3da..f32474af90b34 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
> @@ -1697,9 +1697,11 @@ static int smu_v14_0_2_get_power_limit(struct smu_context *smu,
> uint32_t *min_power_limit) {
> struct smu_table_context *table_context = &smu->smu_table;
> + struct smu_14_0_2_powerplay_table *powerplay_table =
> + table_context->power_play_table;
> PPTable_t *pptable = table_context->driver_pptable;
> CustomSkuTable_t *skutable = &pptable->CustomSkuTable;
> - uint32_t power_limit;
> + uint32_t power_limit, od_percent_upper = 0, od_percent_lower =
> + 0;
> uint32_t msg_limit =
> pptable->SkuTable.MsgLimits.Power[PPT_THROTTLER_PPT0][POWER_SOURCE_AC]
> ;
>
> if (smu_v14_0_get_current_power_limit(smu, &power_limit)) @@
> -1712,11 +1714,29 @@ static int smu_v14_0_2_get_power_limit(struct smu_context *smu,
> if (default_power_limit)
> *default_power_limit = power_limit;
>
> - if (max_power_limit)
> - *max_power_limit = msg_limit;
> + if (powerplay_table) {
> + if (smu->od_enabled &&
> + smu_v14_0_2_is_od_feature_supported(smu, PP_OD_FEATURE_PPT_BIT)) {
> + od_percent_upper = pptable->SkuTable.OverDriveLimitsBasicMax.Ppt;
> + od_percent_lower = pptable->SkuTable.OverDriveLimitsBasicMin.Ppt;
> + } else if (smu_v14_0_2_is_od_feature_supported(smu, PP_OD_FEATURE_PPT_BIT)) {
> + od_percent_upper = 0;
> + od_percent_lower = pptable->SkuTable.OverDriveLimitsBasicMin.Ppt;
> + }
> + }
> +
> + dev_dbg(smu->adev->dev, "od percent upper:%d, od percent lower:%d (default power: %d)\n",
> + od_percent_upper,
> + od_percent_lower, power_limit);
> +
> + if (max_power_limit) {
> + *max_power_limit = msg_limit * (100 + od_percent_upper);
> + *max_power_limit /= 100;
> + }
>
> - if (min_power_limit)
> - *min_power_limit = 0;
> + if (min_power_limit) {
> + *min_power_limit = power_limit * (100 + od_percent_lower);
> + *min_power_limit /= 100;
> + }
>
> return 0;
> }
> --
> 2.50.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] drm/amdgpu/swm14: Update power limit logic
2025-08-12 17:39 ` Alex Deucher
2025-08-13 10:11 ` Zhang, Jesse(Jie)
@ 2025-08-13 11:16 ` Feng, Kenneth
1 sibling, 0 replies; 4+ messages in thread
From: Feng, Kenneth @ 2025-08-13 11:16 UTC (permalink / raw)
To: Alex Deucher, Deucher, Alexander; +Cc: amd-gfx@lists.freedesktop.org
[AMD Official Use Only - AMD Internal Distribution Only]
Reviewed-by: Kenneth Feng <kenneth.feng@amd.com>
-----Original Message-----
From: Alex Deucher <alexdeucher@gmail.com>
Sent: Wednesday, August 13, 2025 1:39 AM
To: Deucher, Alexander <Alexander.Deucher@amd.com>; Feng, Kenneth <Kenneth.Feng@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdgpu/swm14: Update power limit logic
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
Ping?
Alex
On Fri, Aug 8, 2025 at 4:29 PM Alex Deucher <alexander.deucher@amd.com> wrote:
>
> Take into account the limits from the vbios. Ported from the SMU13
> code.
>
> Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4352
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
> .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c | 30
> +++++++++++++++----
> 1 file changed, 25 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
> b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
> index 3aea32baea3da..f32474af90b34 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
> @@ -1697,9 +1697,11 @@ static int smu_v14_0_2_get_power_limit(struct smu_context *smu,
> uint32_t *min_power_limit) {
> struct smu_table_context *table_context = &smu->smu_table;
> + struct smu_14_0_2_powerplay_table *powerplay_table =
> + table_context->power_play_table;
> PPTable_t *pptable = table_context->driver_pptable;
> CustomSkuTable_t *skutable = &pptable->CustomSkuTable;
> - uint32_t power_limit;
> + uint32_t power_limit, od_percent_upper = 0, od_percent_lower =
> + 0;
> uint32_t msg_limit =
> pptable->SkuTable.MsgLimits.Power[PPT_THROTTLER_PPT0][POWER_SOURCE_AC]
> ;
>
> if (smu_v14_0_get_current_power_limit(smu, &power_limit)) @@
> -1712,11 +1714,29 @@ static int smu_v14_0_2_get_power_limit(struct smu_context *smu,
> if (default_power_limit)
> *default_power_limit = power_limit;
>
> - if (max_power_limit)
> - *max_power_limit = msg_limit;
> + if (powerplay_table) {
> + if (smu->od_enabled &&
> + smu_v14_0_2_is_od_feature_supported(smu, PP_OD_FEATURE_PPT_BIT)) {
> + od_percent_upper = pptable->SkuTable.OverDriveLimitsBasicMax.Ppt;
> + od_percent_lower = pptable->SkuTable.OverDriveLimitsBasicMin.Ppt;
> + } else if (smu_v14_0_2_is_od_feature_supported(smu, PP_OD_FEATURE_PPT_BIT)) {
> + od_percent_upper = 0;
> + od_percent_lower = pptable->SkuTable.OverDriveLimitsBasicMin.Ppt;
> + }
> + }
> +
> + dev_dbg(smu->adev->dev, "od percent upper:%d, od percent lower:%d (default power: %d)\n",
> + od_percent_upper,
> + od_percent_lower, power_limit);
> +
> + if (max_power_limit) {
> + *max_power_limit = msg_limit * (100 + od_percent_upper);
> + *max_power_limit /= 100;
> + }
>
> - if (min_power_limit)
> - *min_power_limit = 0;
> + if (min_power_limit) {
> + *min_power_limit = power_limit * (100 + od_percent_lower);
> + *min_power_limit /= 100;
> + }
>
> return 0;
> }
> --
> 2.50.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-08-13 11:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-08 20:29 [PATCH] drm/amdgpu/swm14: Update power limit logic Alex Deucher
2025-08-12 17:39 ` Alex Deucher
2025-08-13 10:11 ` Zhang, Jesse(Jie)
2025-08-13 11:16 ` Feng, Kenneth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).