<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<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:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
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:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
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:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
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">Oops, sorry, missed that. That will be fine.<o:p></o:p></p>
<p class="MsoNormal">Reviewed-by: Evan Quan <evan.quan@amd.com><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Evan<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></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="MsoNormal"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org>
<b>On Behalf Of </b>Russell, Kent<br>
<b>Sent:</b> Thursday, March 28, 2019 5:25 PM<br>
<b>To:</b> Quan, Evan <Evan.Quan@amd.com>; amd-gfx@lists.freedesktop.org<br>
<b>Subject:</b> Re: [PATCH 2/2] drm/amdgpu: Allow switching to CUSTOM profile on smu7 v2<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hi Evan,<br>
<br>
I set tmp=smu7_profiling[PP_SMC_PROFILE_CUSTOM] before checking the bupdate parameters (see below). That way I don't have ugly 100-character-long checks in the if size==0 check. Then if its invalid I just return -EINVAL, or if it'svalid then we use it to writeto
the SMU. If parameters are passed in, tmp is overwritten with the passed-in values and we use it as before.<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="color:black">From:</span></b><span style="color:black"> Quan, Evan<br>
<b>Sent:</b> Wednesday, March 27, 2019 9:26:41 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 2/2] drm/amdgpu: Allow switching to CUSTOM profile on smu7 v2</span>
<o:p></o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">I think you should use smu7_profiling[PP_SMC_POWER_PROFILE_CUSTOM].bupdate_sclk/bupdate_mclk to judge whether there is saved custom profile.<br>
That's where previous custom profile settings store in.<br>
'tmp' is a temporary structures and you should not rely on that.<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 2/2] drm/amdgpu: Allow switching to CUSTOM profile on<br>
> smu7 v2<br>
> <br>
> Allow changing to the CUSTOM profile without requiring the parameters<br>
> being passed in each time. Store the values in the smu7_profiling table since<br>
> it's defined here anyways<br>
> <br>
> v2: Add check that CUSTOM was previously set<br>
> <br>
> Change-Id: I6c5e3a1487e12410a6a7670a5cf1a6599253344d<br>
> Signed-off-by: Kent Russell <<a href="mailto:kent.russell@amd.com">kent.russell@amd.com</a>><br>
> ---<br>
> .../gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 32 ++++++++++++--<br>
> -----<br>
> 1 file changed, 21 insertions(+), 11 deletions(-)<br>
> <br>
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c<br>
> b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c<br>
> index 83d3d935f3ac..048757e8f494 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c<br>
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c<br>
> @@ -77,7 +77,7 @@<br>
> #define PCIE_BUS_CLK 10000<br>
> #define TCLK (PCIE_BUS_CLK / 10)<br>
> <br>
> -static const struct profile_mode_setting smu7_profiling[7] =<br>
> +static struct profile_mode_setting smu7_profiling[7] =<br>
> {{0, 0, 0, 0, 0, 0, 0, 0},<br>
> {1, 0, 100, 30, 1, 0, 100, 10},<br>
> {1, 10, 0, 30, 0, 0, 0, 0},<br>
> @@ -4984,17 +4984,27 @@ static int smu7_set_power_profile_mode(struct<br>
> pp_hwmgr *hwmgr, long *input, uint<br>
> mode = input[size];<br>
> switch (mode) {<br>
> case PP_SMC_POWER_PROFILE_CUSTOM:<br>
> - if (size < 8)<br>
> + if (size < 8 && size != 0)<br>
> return -EINVAL;<br>
> -<br>
> - tmp.bupdate_sclk = input[0];<br>
> - tmp.sclk_up_hyst = input[1];<br>
> - tmp.sclk_down_hyst = input[2];<br>
> - tmp.sclk_activity = input[3];<br>
> - tmp.bupdate_mclk = input[4];<br>
> - tmp.mclk_up_hyst = input[5];<br>
> - tmp.mclk_down_hyst = input[6];<br>
> - tmp.mclk_activity = input[7];<br>
> + /* If only CUSTOM is passed in, use the saved values. Check<br>
> + * that we actually have a CUSTOM profile by ensuring that<br>
> + * the "use sclk" or the "use mclk" bits are set<br>
> + */<br>
> + tmp = smu7_profiling[PP_SMC_POWER_PROFILE_CUSTOM];<br>
> + if (size == 0) {<br>
> + if (tmp.bupdate_sclk == 0 && tmp.bupdate_mclk ==<br>
> 0)<br>
> + return -EINVAL;<br>
> + } else {<br>
> + tmp.bupdate_sclk = input[0];<br>
> + tmp.sclk_up_hyst = input[1];<br>
> + tmp.sclk_down_hyst = input[2];<br>
> + tmp.sclk_activity = input[3];<br>
> + tmp.bupdate_mclk = input[4];<br>
> + tmp.mclk_up_hyst = input[5];<br>
> + tmp.mclk_down_hyst = input[6];<br>
> + tmp.mclk_activity = input[7];<br>
> + smu7_profiling[PP_SMC_POWER_PROFILE_CUSTOM]<br>
> = tmp;<br>
> + }<br>
> if (!smum_update_dpm_settings(hwmgr, &tmp)) {<br>
> memcpy(&data->current_profile_setting, &tmp,<br>
> sizeof(struct profile_mode_setting));<br>
> hwmgr->power_profile_mode = 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><o:p></o:p></p>
</div>
</div>
</div>
</div>
</body>
</html>