<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Only vega and newer have the concept of profiles in the SMU.  Vegas has a set of profiles that the SMU tracks directly.  SMU7 parts don't really have profiles per se; there just one "state" and the driver loads all the params into that state when you request
 a profile (custom or hardcoded).</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Alex</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Russell, Kent <Kent.Russell@amd.com><br>
<b>Sent:</b> Friday, March 29, 2019 7:07 AM<br>
<b>To:</b> Quan, Evan; amd-gfx@lists.freedesktop.org<br>
<b>Subject:</b> RE: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on Vega10/20 v2</font>
<div> </div>
</div>
<style>
<!--
@font-face
        {font-family:"Cambria Math"}
@font-face
        {font-family:Calibri}
p.x_MsoNormal, li.x_MsoNormal, div.x_MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif}
a:link, span.x_MsoHyperlink
        {color:blue;
        text-decoration:underline}
a:visited, span.x_MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline}
p.x_msonormal0, li.x_msonormal0, div.x_msonormal0
        {margin-right:0in;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif}
span.x_EmailStyle18
        {font-family:"Calibri",sans-serif;
        color:windowtext}
span.x_EmailStyle20
        {font-family:"Calibri",sans-serif;
        color:windowtext}
.x_MsoChpDefault
        {font-size:10.0pt}
@page WordSection1
        {margin:1.0in 1.25in 1.0in 1.25in}
div.x_WordSection1
        {}
-->
</style>
<div lang="EN-US" link="blue" vlink="purple">
<div class="x_WordSection1">
<p class="x_MsoNormal">Sorry for all of the questions, Evan. I see that we store the CUSTOM profile for Vega10/Fiji, but is that a limitation of the HW not being able to store it via the SMU? It seems like a lot of extra work to store a local copy, when we
 can just get the copy from the GPU itself, especially if we don’t need to do that on future ASICs. I would assume that the CUSTOM profile that is kept on the GPU is valid, but would it be simpler to just initialize the CUSTOM profile to the same values as
 the BOOTUP values when we initialize the ASIC, then submit that to the GPU, thus ensuring that the CUSTOM profile always has some valid values? Or conversely, zeroing out the CUSTOM profile on initialization, so that the check is still valid.</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">I have no problem doing the work, I just want to make sure that it makes the most sense and that we’re not having to redo it later if the SMU standardizes things and actually allows all future ASICs to store the CUSTOM profile on the
 GPU. Thanks!</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">Kent</p>
<div>
<div style="border:none; border-top:solid #E1E1E1 1.0pt; padding:3.0pt 0in 0in 0in">
<p class="x_MsoNormal"><b>From:</b> Quan, Evan <br>
<b>Sent:</b> Thursday, March 28, 2019 10:47 AM<br>
<b>To:</b> Russell, Kent <Kent.Russell@amd.com>; amd-gfx@lists.freedesktop.org<br>
<b>Subject:</b> RE: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on Vega10/20 v2</p>
</div>
</div>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">OK, I see. Yep, the new settings will be stored in SMU.</p>
<p class="x_MsoNormal">But as I know, the SMU comes with some default settings for CUSTOM profile.
</p>
<p class="x_MsoNormal">I suspect “activity_monitor.Soc_BoosterFreqType != 0” will be also true even without your first CUSTOM profile settings(with input parameters).</p>
<p class="x_MsoNormal">So, I would prefer to have a local copy of previous custom settigns(as what we do on vega10 and smu7).</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">Evan</p>
<div style="border:none; border-left:solid blue 1.5pt; padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none; border-top:solid #E1E1E1 1.0pt; padding:3.0pt 0in 0in 0in">
<p class="x_MsoNormal"><b>From:</b> Russell, Kent <<a href="mailto:Kent.Russell@amd.com">Kent.Russell@amd.com</a>>
<br>
<b>Sent:</b> Thursday, March 28, 2019 5:29 PM<br>
<b>To:</b> Quan, Evan <<a href="mailto:Evan.Quan@amd.com">Evan.Quan@amd.com</a>>;
<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><br>
<b>Subject:</b> Re: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on Vega10/20 v2</p>
</div>
</div>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">Am I mistaken in thinking that activity monitor gets the existing CUSTOM profile from the SMU? When I tested it, the CUSTOM profile was saved and could be retrieved through this method. I specifically set the profile to something ridiculous
 (1 2 3 4 5 6 7 8 9 10) and these values were retained when switching to VR and back to CUSTOM, so I was under the impression that it was saved to the SMU when we submit it to the SMU.<br>
<br>
Kent<br>
<br>
KENT RUSSELL<br>
Sr. Software Engineer | Linux Compute Kernel<br>
1 Commerce Valley Drive East<br>
Markham, ON L3T 7X6<br>
O +(1) 289-695-2122 | Ext 72122</p>
<div class="x_MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="x_divRplyFwdMsg">
<p class="x_MsoNormal"><b><span style="color:black">From:</span></b><span style="color:black"> Quan, Evan<br>
<b>Sent:</b> Wednesday, March 27, 2019 9:36:02 PM<br>
<b>To:</b> Russell, Kent; <a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><br>
<b>Cc:</b> Russell, Kent<br>
<b>Subject:</b> RE: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on Vega10/20 v2</span>
</p>
<div>
<p class="x_MsoNormal"> </p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">For vega20, activity_monitor is also a temporary structure and you should not rely on that for judging existence of custom profile.<br>
<br>
Regards<br>
Evan<br>
> -----Original Message-----<br>
> From: amd-gfx <<a href="mailto:amd-gfx-bounces@lists.freedesktop.org">amd-gfx-bounces@lists.freedesktop.org</a>> On Behalf Of<br>
> Russell, Kent<br>
> Sent: Wednesday, March 27, 2019 9:59 PM<br>
> To: <a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><br>
> Cc: Russell, Kent <<a href="mailto:Kent.Russell@amd.com">Kent.Russell@amd.com</a>><br>
> Subject: [PATCH 1/2] drm/amdgpu: Allow switching to CUSTOM profile on<br>
> Vega10/20 v2<br>
> <br>
> Don't return an error if the CUSTOM profile is selected, just apply it with the<br>
> values saved to the GPU<br>
> <br>
> v2: Remove reference to fixed bug, check that CUSTOM profile was set<br>
> <br>
> Change-Id: I114cc9783226ee9ebb146863897e951527a85e20<br>
> Signed-off-by: Kent Russell <<a href="mailto:kent.russell@amd.com">kent.russell@amd.com</a>><br>
> ---<br>
>  drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 14<br>
> +++++++++++++-<br>
> drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 14<br>
> +++++++++++++-<br>
>  2 files changed, 26 insertions(+), 2 deletions(-)<br>
> <br>
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c<br>
> b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c<br>
> index 85a536924571..7e9e7e254a0d 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c<br>
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c<br>
> @@ -4910,9 +4910,20 @@ static int vega10_set_power_profile_mode(struct<br>
> pp_hwmgr *hwmgr, long *input, ui<br>
>                                                1 << power_profile_mode);<br>
> <br>
>        if (power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {<br>
> -             if (size == 0 || size > 4)<br>
> +             if (size != 0 && size != 4)<br>
>                        return -EINVAL;<br>
> <br>
> +             /* If size = 0 and the CUSTOM profile has been set already<br>
> +              * (check BUSY_SET_POINT since that is always >0 for a valid<br>
> +              * profile) then just apply the profile.<br>
> +              */<br>
> +             if (size == 0) {<br>
> +                     if (data->custom_profile_mode[0] != 0)<br>
> +                             goto out;<br>
> +                     else<br>
> +                             return -EINVAL;<br>
> +             }<br>
> +<br>
>                data->custom_profile_mode[0] = busy_set_point = input[0];<br>
>                data->custom_profile_mode[1] = FPS = input[1];<br>
>                data->custom_profile_mode[2] = use_rlc_busy = input[2];<br>
> @@ -4923,6 +4934,7 @@ static int vega10_set_power_profile_mode(struct<br>
> pp_hwmgr *hwmgr, long *input, ui<br>
>                                        use_rlc_busy << 16 |<br>
> min_active_level<<24);<br>
>        }<br>
> <br>
> +out:<br>
>        hwmgr->power_profile_mode = power_profile_mode;<br>
> <br>
>        return 0;<br>
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c<br>
> b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c<br>
> index 70dc641bf94d..6dc16a9e766b 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c<br>
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c<br>
> @@ -3843,7 +3843,7 @@ static int vega20_set_power_profile_mode(struct<br>
> pp_hwmgr *hwmgr, long *input, ui<br>
>        }<br>
> <br>
>        if (power_profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) {<br>
> -             if (size < 10)<br>
> +             if (size < 10 && size != 0)<br>
>                        return -EINVAL;<br>
> <br>
>                result = vega20_get_activity_monitor_coeff(hwmgr,<br>
> @@ -3853,6 +3853,17 @@ static int vega20_set_power_profile_mode(struct<br>
> pp_hwmgr *hwmgr, long *input, ui<br>
>                                "[SetPowerProfile] Failed to get activity<br>
> monitor!",<br>
>                                return result);<br>
> <br>
> +             /* If size = 0 and the CUSTOM profile has been set already<br>
> +              * (check BoosterFreqType since that is always >0 for a valid<br>
> +              * profile) then just apply the profile.<br>
> +              */<br>
> +             if (size == 0) {<br>
> +                     if (activity_monitor.Soc_BoosterFreqType != 0)<br>
> +                             goto out;<br>
> +                     else<br>
> +                             return -EINVAL;<br>
> +             }<br>
> +<br>
>                switch (input[0]) {<br>
>                case 0: /* Gfxclk */<br>
>                        activity_monitor.Gfx_FPS = input[1]; @@ -3908,6<br>
> +3919,7 @@ static int vega20_set_power_profile_mode(struct pp_hwmgr<br>
> *hwmgr, long *input, ui<br>
>                                return result);<br>
>        }<br>
> <br>
> +out:<br>
>        /* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */<br>
>        workload_type =<br>
> <br>
>        conv_power_profile_to_pplib_workload(power_profile_mode);<br>
> --<br>
> 2.17.1<br>
> <br>
> _______________________________________________<br>
> amd-gfx mailing list<br>
> <a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>