<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"MS PGothic";
        panose-1:2 11 6 0 7 2 5 8 2 4;}
@font-face
        {font-family:"\@MS PGothic";}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"MS PGothic",sans-serif;
        mso-fareast-language:JA;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"MS PGothic",sans-serif;
        mso-fareast-language:JA;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:ZH-CN">That seems a bug. I will fix that.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:ZH-CN">It’s OK to store previous CUSTOM profile settings in driver and switch back to that with no need to pass in settings again. That makes sense.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:ZH-CN">But you may need to update the patch(to check whether there is previous custom profile settings).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:ZH-CN"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:ZH-CN">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:ZH-CN">Evan<o:p></o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> amd-gfx <amd-gfx-bounces@lists.freedesktop.org>
<b>On Behalf Of </b>Russell, Kent<br>
<b>Sent:</b> 2019</span><span lang="JA" style="font-size:11.0pt">年</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">3</span><span lang="JA" style="font-size:11.0pt">月</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">26</span><span lang="JA" style="font-size:11.0pt">日</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">
 0:00<br>
<b>To:</b> Quan, Evan <Evan.Quan@amd.com>; amd-gfx@lists.freedesktop.org<br>
<b>Subject:</b> Re: [PATCH 1/3] drm/amdgpu: Stop returning EINVAL during profile switch<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I set CUSTOM to a weird value like "1 2 3 4 5 6" , then switched to VR profile, then switched back to CUSTOM (just with "echo 6 > profile), and it kept my custom values. Before this patch, it throws EINVAL but still switches it to CUSTOM
 with the saved values, on both vega10 and vega20.<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<o:p></o:p></p>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> Quan, Evan<br>
<b>Sent:</b> Monday, March 25, 2019 10:14:03 AM<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/3] drm/amdgpu: Stop returning EINVAL during profile switch</span>
<o:p></o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">How can you tell whether it was already applied before or 1st time to switch to compute mode?<br>
For the latter case, other settings/parameters do need.<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: 2019<span lang="JA">年</span>3<span lang="JA">月</span>25<span lang="JA">日</span> 20:42<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/3] drm/amdgpu: Stop returning EINVAL during profile<br>
> switch<br>
> <br>
> Don't return an error after switching to the CUSTOM profile, if there aren't<br>
> any CUSTOM values passed in. The CUSTOM profile is already applied, so if<br>
> no other arguments are passed, just return instead of throwing -EINVAL<br>
> when successful<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 | 6 +++++-<br>
> drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 5 ++++-<br>
>  2 files changed, 9 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 ed6c638700f5..a98b927282ac 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c<br>
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c<br>
> @@ -4911,7 +4911,11 @@ static int vega10_set_power_profile_mode(struct<br>
> pp_hwmgr *hwmgr, long *input, ui<br>
>                                                1<<hwmgr-<br>
> >power_profile_mode);<br>
> <br>
>        if (hwmgr->power_profile_mode ==<br>
> PP_SMC_POWER_PROFILE_CUSTOM) {<br>
> -             if (size == 0 || size > 4)<br>
> +             /* If size = 0, then just return, it was applied above */<br>
> +             if (size == 0)<br>
> +                     return 0;<br>
> +<br>
> +             if (size != 4)<br>
>                        return -EINVAL;<br>
> <br>
>                data->custom_profile_mode[0] = busy_set_point = input[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 664544e7fcdc..225b2102c82c 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c<br>
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c<br>
> @@ -3828,8 +3828,11 @@ static int vega20_set_power_profile_mode(struct<br>
> pp_hwmgr *hwmgr, long *input, ui<br>
>        }<br>
> <br>
>        if (hwmgr->power_profile_mode ==<br>
> PP_SMC_POWER_PROFILE_CUSTOM) {<br>
> -             if (size < 10)<br>
> +             if (size < 10 && size != 0)<br>
>                        return -EINVAL;<br>
> +             /* If size = 0, then just return, it was applied above */<br>
> +             if (size == 0)<br>
> +                     return 0;<br>
> <br>
>                result = vega20_get_activity_monitor_coeff(hwmgr,<br>
>                                (uint8_t *)(&activity_monitor),<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><o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</body>
</html>