From: "Sundararaju, Sathishkumar" <sathishkumar.sundararaju@amd.com>
To: "Lazar, Lijo" <lijo.lazar@amd.com>, amd-gfx@lists.freedesktop.org
Cc: Alexander Deucher <Alexander.Deucher@amd.com>
Subject: Re: [PATCH] drm/amd/pm: update smartshift powerboost calc for smu13
Date: Wed, 11 May 2022 17:33:40 +0530 [thread overview]
Message-ID: <78bbb31c-ad1b-a0a2-5890-5dd9b332b58f@amd.com> (raw)
In-Reply-To: <ad73bd91-ff2a-e1ff-a4e3-4c4b4a634448@amd.com>
On 5/11/2022 5:27 PM, Lazar, Lijo wrote:
>
>
> On 5/11/2022 5:16 PM, Sathishkumar S wrote:
>> smartshift apu and dgpu power boost are reported as percentage
>> with respect to their power limits. adjust the units of power before
>> calculating the percentage of boost.
>>
>> Signed-off-by: Sathishkumar S <sathishkumar.sundararaju@amd.com>
>> ---
>> .../drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c | 60 ++++++++++++++-----
>> 1 file changed, 44 insertions(+), 16 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c
>> b/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c
>> index e2d099409123..35fbeb72c05c 100644
>> --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c
>> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c
>> @@ -276,6 +276,40 @@ static int yellow_carp_mode2_reset(struct
>> smu_context *smu)
>> return yellow_carp_mode_reset(smu, SMU_RESET_MODE_2);
>> }
>> +
>> +static void yellow_carp_get_ss_power_percent(SmuMetrics_t *metrics,
>> + uint32_t *apu_percent, uint32_t *dgpu_percent)
>> +{
>> + uint32_t apu_boost = 0;
>> + uint32_t dgpu_boost = 0;
>> + uint16_t apu_limit = 0;
>> + uint16_t dgpu_limit = 0;
>> + uint16_t apu_power = 0;
>> + uint16_t dgpu_power = 0;
>> +
>> + apu_power = metrics->ApuPower/1000;
>> + apu_limit = metrics->StapmOpnLimit;
>> + if (apu_power > apu_limit && apu_limit != 0)
>> + apu_boost = ((apu_power - apu_limit) * 100) / apu_limit;
>> + apu_boost = (apu_boost > 100) ? 100 : apu_boost;
>> +
>> + dgpu_power = metrics->dGpuPower/1000;
>
> Before submitting (not expecting another version here), may add a
> comment that APU/dGPU power values are reported in milli Watts and
> STAPM power limits in Watts.
Okay, will add the comment here . Thank you.
>
> Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
>
> Thanks,
> Lijo
>
>> + if (metrics->StapmCurrentLimit > metrics->StapmOpnLimit)
>> + dgpu_limit = metrics->StapmCurrentLimit -
>> metrics->StapmOpnLimit;
>> + if (dgpu_power > dgpu_limit && dgpu_limit != 0)
>> + dgpu_boost = ((dgpu_power - dgpu_limit) * 100) / dgpu_limit;
>> + dgpu_boost = (dgpu_boost > 100) ? 100 : dgpu_boost;
>> +
>> + if (dgpu_boost >= apu_boost)
>> + apu_boost = 0;
>> + else
>> + dgpu_boost = 0;
>> +
>> + *apu_percent = apu_boost;
>> + *dgpu_percent = dgpu_boost;
>> +
>> +}
>> +
>> static int yellow_carp_get_smu_metrics_data(struct smu_context *smu,
>> MetricsMember_t member,
>> uint32_t *value)
>> @@ -284,6 +318,8 @@ static int
>> yellow_carp_get_smu_metrics_data(struct smu_context *smu,
>> SmuMetrics_t *metrics = (SmuMetrics_t
>> *)smu_table->metrics_table;
>> int ret = 0;
>> + uint32_t apu_percent = 0;
>> + uint32_t dgpu_percent = 0;
>> ret = smu_cmn_get_metrics_table(smu, NULL, false);
>> if (ret)
>> @@ -332,26 +368,18 @@ static int
>> yellow_carp_get_smu_metrics_data(struct smu_context *smu,
>> *value = metrics->Voltage[1];
>> break;
>> case METRICS_SS_APU_SHARE:
>> - /* return the percentage of APU power with respect to APU's
>> power limit.
>> - * percentage is reported, this isn't boost value.
>> Smartshift power
>> - * boost/shift is only when the percentage is more than 100.
>> + /* return the percentage of APU power boost
>> + * with respect to APU's power limit.
>> */
>> - if (metrics->StapmOpnLimit > 0)
>> - *value = (metrics->ApuPower * 100) /
>> metrics->StapmOpnLimit;
>> - else
>> - *value = 0;
>> + yellow_carp_get_ss_power_percent(metrics, &apu_percent,
>> &dgpu_percent);
>> + *value = apu_percent;
>> break;
>> case METRICS_SS_DGPU_SHARE:
>> - /* return the percentage of dGPU power with respect to
>> dGPU's power limit.
>> - * percentage is reported, this isn't boost value.
>> Smartshift power
>> - * boost/shift is only when the percentage is more than 100.
>> + /* return the percentage of dGPU power boost
>> + * with respect to dGPU's power limit.
>> */
>> - if ((metrics->dGpuPower > 0) &&
>> - (metrics->StapmCurrentLimit > metrics->StapmOpnLimit))
>> - *value = (metrics->dGpuPower * 100) /
>> - (metrics->StapmCurrentLimit -
>> metrics->StapmOpnLimit);
>> - else
>> - *value = 0;
>> + yellow_carp_get_ss_power_percent(metrics, &apu_percent,
>> &dgpu_percent);
>> + *value = dgpu_percent;
>> break;
>> default:
>> *value = UINT_MAX;
>>
prev parent reply other threads:[~2022-05-11 12:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-11 11:46 [PATCH] drm/amd/pm: update smartshift powerboost calc for smu13 Sathishkumar S
2022-05-11 11:57 ` Lazar, Lijo
2022-05-11 12:03 ` Sundararaju, Sathishkumar [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=78bbb31c-ad1b-a0a2-5890-5dd9b332b58f@amd.com \
--to=sathishkumar.sundararaju@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=lijo.lazar@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox