<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">with this patch, there should be no difference between AGT and sysfs.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Best Regards</p>
<p style="margin-top:0;margin-bottom:0">Rex</p>
<br>
<div style="color: rgb(0, 0, 0);">
<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> Huang, JinHuiEric<br>
<b>Sent:</b> Thursday, April 5, 2018 12:00 AM<br>
<b>To:</b> Zhu, Rex; amd-gfx@lists.freedesktop.org<br>
<b>Subject:</b> Re: [PATCH 2/3] drm/amd/pp: Refine get_gpu_power for VI</font>
<div> </div>
</div>
<div style="background-color:#FFFFFF">
<p>So you didn't compare the result with AGT, but I did. The reality is not like your speculation.</p>
<p><br>
</p>
<p>Regards,</p>
<p>Eric<br>
</p>
<br>
<div class="x_moz-cite-prefix">On 2018-04-04 11:50 AM, Zhu, Rex wrote:<br>
</div>
<blockquote type="cite">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p style="margin-top:0; margin-bottom:0">If user send <span style="">message PPSMC_MSG_GetCurrPkgPwr, firmware will return the pkgpwr immediately as current power value.</span></p>
<p style="margin-top:0; margin-bottom:0"><span style="">as no <span style="">PPSMC_MSG_GetCurrPkgPwr support, so send message let firmware write <span style="">pkgpwr to <span style="">ixSMU_PM_STATUS_94,</span></span></span></span></p>
<p style="margin-top:0; margin-bottom:0"><span style=""><span style=""><span style=""><span style="">and driver delay 10ms to read
<span style="">ixSMU_PM_STATUS_94.</span></span></span></span></span></p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">I don't think there is any problem. otherwise, there is same issue on polaris/vega.</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">I clean <span style="">ixSMU_PM_STATUS_94 before let smu write it.</span></p>
<p style="margin-top:0; margin-bottom:0"><span style="">The delay time is enough unless we got 0 from
<span style="">ixSMU_PM_STATUS_94 </span>.</span></p>
<p style="margin-top:0; margin-bottom:0"><span style=""><br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">Best Regards</p>
<p style="margin-top:0; margin-bottom:0">Rex</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<br>
<div style="color:rgb(0,0,0)">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> amd-gfx
<a class="x_moz-txt-link-rfc2396E" href="mailto:amd-gfx-bounces@lists.freedesktop.org" id="LPlnk680627" previewremoved="true">
<amd-gfx-bounces@lists.freedesktop.org></a> on behalf of Eric Huang <a class="x_moz-txt-link-rfc2396E" href="mailto:jinhuieric.huang@amd.com" id="LPlnk55605" previewremoved="true">
<jinhuieric.huang@amd.com></a><br>
<b>Sent:</b> Wednesday, April 4, 2018 11:36 PM<br>
<b>To:</b> <a class="x_moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org" id="LPlnk367731" previewremoved="true">
amd-gfx@lists.freedesktop.org</a><br>
<b>Subject:</b> Re: [PATCH 2/3] drm/amd/pp: Refine get_gpu_power for VI</font>
<div> </div>
</div>
<div class="x_BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="x_PlainText">Sampling period is too short. The power reading value will be not
<br>
aligned with AGT's. It will confuse user that why AMD provides two <br>
different power results.<br>
<br>
Regards,<br>
Eric<br>
<br>
On 2018-04-04 04:25 AM, Rex Zhu wrote:<br>
> 1. On polaris10/11/12, Sending smu message PPSMC_MSG_GetCurrPkgPwr to<br>
> read currentpkgpwr directly.<br>
> 2. On Fiji/tonga/bonaire/hawwii, no PPSMC_MSG_GetCurrPkgPwr support.<br>
> Send PPSMC_MSG_PmStatusLogStart to let smu write currentpkgpwr<br>
> to ixSMU_PM_STATUS_94. this is asynchronous. need to delay no less<br>
> than 1ms.<br>
> 3. Clean ixSMU_PM_STATUS_94 immediately when send PPSMC_MSG_PmStatusLogStart<br>
> to avoid read old value.<br>
> 4. delay 10 ms instand of 20 ms. so the result will more similar to<br>
> the output of PPSMC_MSG_GetCurrPkgPwr.<br>
> 5. remove max power/vddc/vddci output to keep consistent with vega.<br>
> 6. for vddc/vddci power, we can calculate the average value per<br>
> [10ms, 4s] in other interface if needed.<br>
><br>
> Signed-off-by: Rex Zhu <a class="x_moz-txt-link-rfc2396E" href="mailto:Rex.Zhu@amd.com" id="LPlnk268038" previewremoved="true">
<Rex.Zhu@amd.com></a><br>
> ---<br>
> drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 45 +++++++++++-------------<br>
> 1 file changed, 21 insertions(+), 24 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c<br>
> index 40f2f87..c0ce672 100644<br>
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c<br>
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c<br>
> @@ -3363,30 +3363,27 @@ static int smu7_get_pp_table_entry(struct pp_hwmgr *hwmgr,<br>
> static int smu7_get_gpu_power(struct pp_hwmgr *hwmgr,<br>
> struct pp_gpu_power *query)<br>
> {<br>
> - PP_ASSERT_WITH_CODE(!smum_send_msg_to_smc(hwmgr,<br>
> - PPSMC_MSG_PmStatusLogStart),<br>
> - "Failed to start pm status log!",<br>
> - return -1);<br>
> -<br>
> - msleep_interruptible(20);<br>
> -<br>
> - PP_ASSERT_WITH_CODE(!smum_send_msg_to_smc(hwmgr,<br>
> - PPSMC_MSG_PmStatusLogSample),<br>
> - "Failed to sample pm status log!",<br>
> - return -1);<br>
> -<br>
> - query->vddc_power = cgs_read_ind_register(hwmgr->device,<br>
> - CGS_IND_REG__SMC,<br>
> - ixSMU_PM_STATUS_40);<br>
> - query->vddci_power = cgs_read_ind_register(hwmgr->device,<br>
> - CGS_IND_REG__SMC,<br>
> - ixSMU_PM_STATUS_49);<br>
> - query->max_gpu_power = cgs_read_ind_register(hwmgr->device,<br>
> - CGS_IND_REG__SMC,<br>
> - ixSMU_PM_STATUS_94);<br>
> - query->average_gpu_power = cgs_read_ind_register(hwmgr->device,<br>
> - CGS_IND_REG__SMC,<br>
> - ixSMU_PM_STATUS_95);<br>
> + if (!query)<br>
> + return -EINVAL;<br>
> +<br>
> + memset(query, 0, sizeof *query);<br>
> +<br>
> + if (hwmgr->chip_id >= CHIP_POLARIS10) {<br>
> + smum_send_msg_to_smc(hwmgr, PPSMC_MSG_GetCurrPkgPwr);<br>
> + query->average_gpu_power = cgs_read_register(hwmgr->device, mmSMC_MSG_ARG_0);<br>
> + } else {<br>
> + smum_send_msg_to_smc(hwmgr, PPSMC_MSG_PmStatusLogStart);<br>
> + cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC,<br>
> + ixSMU_PM_STATUS_94, 0);<br>
> +<br>
> + msleep_interruptible(10);<br>
> +<br>
> + smum_send_msg_to_smc(hwmgr, PPSMC_MSG_PmStatusLogSample);<br>
> +<br>
> + query->average_gpu_power = cgs_read_ind_register(hwmgr->device,<br>
> + CGS_IND_REG__SMC,<br>
> + ixSMU_PM_STATUS_94);<br>
> + }<br>
> <br>
> return 0;<br>
> }<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
<a class="x_moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org" id="LPlnk801665" previewremoved="true">amd-gfx@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" id="LPlnk731909" previewremoved="true">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a>
<div id="LPBorder_GT_15228562333390.979542144089784" style="margin-bottom:20px; overflow:auto; width:100%; text-indent:0px" contenteditable="false">
<table id="LPContainer_15228562333280.30238014676002334" cellspacing="0" style="width:90%; background-color:rgb(255,255,255); overflow:auto; padding-top:20px; padding-bottom:20px; margin-top:20px; border-top:1px dotted rgb(200,200,200); border-bottom:1px dotted rgb(200,200,200)">
<tbody>
<tr valign="top" style="border-spacing:0px">
<td id="x_TextCell_15228562333320.0901521230341924" colspan="2" style="vertical-align:top; padding:0px; display:table-cell">
<div id="LPTitle_15228562333330.17088493377011438" style=""><a id="LPUrlAnchor_15228562333350.45851088175032095" href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" target="_blank" style="text-decoration:none">amd-gfx Info Page - freedesktop.org</a></div>
<div id="LPMetadata_15228562333360.9650973279775443" style="">lists.freedesktop.org</div>
<div id="LPDescription_15228562333370.9839175290800748" style="">Subscribing to amd-gfx: Subscribe to amd-gfx by filling out the following form. Use of all freedesktop.org lists is subject to our Code of Conduct.</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<br>
</div>
</span></font></div>
</div>
</div>
</blockquote>
<br>
</div>
</div>
</div>
</body>
</html>