<div dir="ltr"><div>Nice cleanup. Patch is:<br></div>Reviewed-by: Alex Deucher <<a href="mailto:alexander.deucher@amd.com">alexander.deucher@amd.com</a>><br><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 9, 2018 at 5:55 AM, Zhu, Rex <span dir="ltr"><<a href="mailto:Rex.Zhu@amd.com" target="_blank">Rex.Zhu@amd.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div id="m_7239844958464048745divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Hi Alex,</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">The avfs btc state is only used in driver
<font size="2"><span style="font-size:11pt">and not interact with HW.</span></font></p>
<p style="margin-top:0;margin-bottom:0"><font size="2"><span style="font-size:11pt"></span></font>and we only need to know whether this feature is supported or not by HW.</p>
<p style="margin-top:0;margin-bottom:0">so delete the complex define of avfs btc state and simplify related code.</p>
<p style="margin-top:0;margin-bottom:0">Please review the attached patch.</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<br>
</p>
<br>
<div style="color:rgb(0,0,0)">
<hr style="display:inline-block;width:98%">
<div id="m_7239844958464048745divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Alex Deucher <<a href="mailto:alexdeucher@gmail.com" target="_blank">alexdeucher@gmail.com</a>><br>
<b>Sent:</b> Thursday, March 8, 2018 1:12 AM<br>
<b>To:</b> Zhu, Rex<br>
<b>Cc:</b> amd-gfx list<br>
<b>Subject:</b> Re: [PATCH 1/8] drm/amd/pp: Refine code for smu7 in powerplay</font>
<div> </div>
</div>
<div class="m_7239844958464048745BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="m_7239844958464048745PlainText"><div><div class="h5">On Wed, Mar 7, 2018 at 5:46 AM, Rex Zhu <<a href="mailto:Rex.Zhu@amd.com" target="_blank">Rex.Zhu@amd.com</a>> wrote:<br>
> 1. Add avfs_support in hwmgr to avoid to visit smu backend struct in<br>
> hwmgr.so do not need to include smu7_smumgr.h under hwmgr folder.<br>
> 2. simplify the list of enum AVFS_BTC_STATUS<br>
><br>
> Change-Id: I04c769972deff797229339f3ccb1c<wbr>442b35768a2<br>
> Signed-off-by: Rex Zhu <<a href="mailto:Rex.Zhu@amd.com" target="_blank">Rex.Zhu@amd.com</a>><br>
> ---<br>
> drivers/gpu/drm/amd/powerplay/<wbr>hwmgr/smu7_hwmgr.c | 14 ++------------<br>
> drivers/gpu/drm/amd/powerplay/<wbr>inc/hwmgr.h | 2 +-<br>
> drivers/gpu/drm/amd/powerplay/<wbr>inc/smumgr.h | 10 +---------<br>
> drivers/gpu/drm/amd/powerplay/<wbr>smumgr/fiji_smumgr.c | 4 +++-<br>
> drivers/gpu/drm/amd/powerplay/<wbr>smumgr/polaris10_smumgr.c | 4 +++-<br>
> 5 files changed, 10 insertions(+), 24 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/<wbr>powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/<wbr>powerplay/hwmgr/smu7_hwmgr.c<br>
> index d4d1d2e..da25e7f 100644<br>
> --- a/drivers/gpu/drm/amd/<wbr>powerplay/hwmgr/smu7_hwmgr.c<br>
> +++ b/drivers/gpu/drm/amd/<wbr>powerplay/hwmgr/smu7_hwmgr.c<br>
> @@ -40,7 +40,6 @@<br>
><br>
> #include "hwmgr.h"<br>
> #include "smu7_hwmgr.h"<br>
> -#include "smu7_smumgr.h"<br>
> #include "smu_ucode_xfer_vi.h"<br>
> #include "smu7_powertune.h"<br>
> #include "smu7_dyn_defaults.h"<br>
> @@ -1353,12 +1352,7 @@ static int smu7_enable_dpm_tasks(struct pp_hwmgr *hwmgr)<br>
><br>
> static int smu7_avfs_control(struct pp_hwmgr *hwmgr, bool enable)<br>
> {<br>
> - struct smu7_smumgr *smu_data = (struct smu7_smumgr *)(hwmgr->smu_backend);<br>
> -<br>
> - if (smu_data == NULL)<br>
> - return -EINVAL;<br>
> -<br>
> - if (smu_data->avfs.avfs_btc_<wbr>status == AVFS_BTC_NOTSUPPORTED)<br>
> + if (!hwmgr->avfs_supported)<br>
> return 0;<br>
><br>
> if (enable) {<br>
> @@ -1382,13 +1376,9 @@ static int smu7_avfs_control(struct pp_hwmgr *hwmgr, bool enable)<br>
><br>
> static int smu7_update_avfs(struct pp_hwmgr *hwmgr)<br>
> {<br>
> - struct smu7_smumgr *smu_data = (struct smu7_smumgr *)(hwmgr->smu_backend);<br>
> struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);<br>
><br>
> - if (smu_data == NULL)<br>
> - return -EINVAL;<br>
> -<br>
> - if (smu_data->avfs.avfs_btc_<wbr>status == AVFS_BTC_NOTSUPPORTED)<br>
> + if (!hwmgr->avfs_supported)<br>
> return 0;<br>
><br>
> if (data->need_update_smu7_dpm_<wbr>table & DPMTABLE_OD_UPDATE_VDDC) {<br>
> diff --git a/drivers/gpu/drm/amd/<wbr>powerplay/inc/hwmgr.h b/drivers/gpu/drm/amd/<wbr>powerplay/inc/hwmgr.h<br>
> index b151ad85..312fbc3 100644<br>
> --- a/drivers/gpu/drm/amd/<wbr>powerplay/inc/hwmgr.h<br>
> +++ b/drivers/gpu/drm/amd/<wbr>powerplay/inc/hwmgr.h<br>
> @@ -748,7 +748,7 @@ struct pp_hwmgr {<br>
> struct pp_power_state *uvd_ps;<br>
> struct amd_pp_display_configuration display_config;<br>
> uint32_t feature_mask;<br>
> -<br>
> + bool avfs_supported;<br>
> /* UMD Pstate */<br>
> bool en_umd_pstate;<br>
> uint32_t power_profile_mode;<br>
> diff --git a/drivers/gpu/drm/amd/<wbr>powerplay/inc/smumgr.h b/drivers/gpu/drm/amd/<wbr>powerplay/inc/smumgr.h<br>
> index 9bba0a0..f0ef02a 100644<br>
> --- a/drivers/gpu/drm/amd/<wbr>powerplay/inc/smumgr.h<br>
> +++ b/drivers/gpu/drm/amd/<wbr>powerplay/inc/smumgr.h<br>
> @@ -28,23 +28,15 @@<br>
><br>
> enum AVFS_BTC_STATUS {<br>
> AVFS_BTC_BOOT = 0,<br>
> - AVFS_BTC_BOOT_STARTEDSMU,<br>
> AVFS_LOAD_VIRUS,<br>
> AVFS_BTC_VIRUS_LOADED,<br>
> AVFS_BTC_VIRUS_FAIL,<br>
> AVFS_BTC_COMPLETED_PREVIOUSLY,<br>
> AVFS_BTC_ENABLEAVFS,<br>
> - AVFS_BTC_STARTED,<br>
> AVFS_BTC_FAILED,<br>
> - AVFS_BTC_RESTOREVFT_FAILED,<br>
> - AVFS_BTC_SAVEVFT_FAILED,<br>
> AVFS_BTC_DPMTABLESETUP_FAILED,<br>
> - AVFS_BTC_COMPLETED_UNSAVED,<br>
> - AVFS_BTC_COMPLETED_SAVED,<br>
> - AVFS_BTC_COMPLETED_RESTORED,<br>
> AVFS_BTC_DISABLED,<br>
> - AVFS_BTC_NOTSUPPORTED,<br>
> - AVFS_BTC_SMUMSG_ERROR<br>
> + AVFS_BTC_NOTSUPPORTED<br>
> };<br>
<br>
This isn't used to interact with the hw anywhere is it? If so, this<br>
will break that. It should probably be split out as a separate patch<br>
since it's not really directly related to the rest of this patch.<br>
With those addresses this patch is:<br>
Reviewed-by: Alex Deucher <<a href="mailto:alexander.deucher@amd.com" target="_blank">alexander.deucher@amd.com</a>><br>
<br>
><br>
> enum SMU_TABLE {<br>
> diff --git a/drivers/gpu/drm/amd/<wbr>powerplay/smumgr/fiji_smumgr.c b/drivers/gpu/drm/amd/<wbr>powerplay/smumgr/fiji_smumgr.c<br>
> index 0b2b5d1..573c9be 100644<br>
> --- a/drivers/gpu/drm/amd/<wbr>powerplay/smumgr/fiji_smumgr.c<br>
> +++ b/drivers/gpu/drm/amd/<wbr>powerplay/smumgr/fiji_smumgr.c<br>
> @@ -360,8 +360,10 @@ static bool fiji_is_hw_avfs_present(struct pp_hwmgr *hwmgr)<br>
><br>
> if (!atomctrl_read_efuse(hwmgr-><wbr>device, AVFS_EN_LSB, AVFS_EN_MSB,<br>
> mask, &efuse)) {<br>
> - if (efuse)<br>
> + if (efuse) {<br>
> + hwmgr->avfs_supported = true;<br>
> return true;<br>
> + }<br>
> }<br>
> return false;<br>
> }<br>
> diff --git a/drivers/gpu/drm/amd/<wbr>powerplay/smumgr/polaris10_<wbr>smumgr.c b/drivers/gpu/drm/amd/<wbr>powerplay/smumgr/polaris10_<wbr>smumgr.c<br>
> index 632d1ca..1075ec1 100644<br>
> --- a/drivers/gpu/drm/amd/<wbr>powerplay/smumgr/polaris10_<wbr>smumgr.c<br>
> +++ b/drivers/gpu/drm/amd/<wbr>powerplay/smumgr/polaris10_<wbr>smumgr.c<br>
> @@ -357,8 +357,10 @@ static bool polaris10_is_hw_avfs_present(<wbr>struct pp_hwmgr *hwmgr)<br>
><br>
> efuse = cgs_read_ind_register(hwmgr-><wbr>device, CGS_IND_REG__SMC, ixSMU_EFUSE_0 + (49*4));<br>
> efuse &= 0x00000001;<br>
> - if (efuse)<br>
> + if (efuse) {<br>
> + hwmgr->avfs_supported = true;<br>
> return true;<br>
> + }<br>
><br>
> return false;<br>
> }<br>
> --<br>
> 1.9.1<br>
><br>
> ______________________________<wbr>_________________<br>
> amd-gfx mailing list<br>
> <a href="mailto:amd-gfx@lists.freedesktop.org" target="_blank">amd-gfx@lists.freedesktop.org</a><br>
> <a id="m_7239844958464048745LPlnk605140" href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" target="_blank">
https://lists.freedesktop.org/<wbr>mailman/listinfo/amd-gfx</a>
</div></div><div style="margin-bottom:20px;overflow:auto;width:100%;text-indent:0px" id="m_7239844958464048745LPBorder_GT_15205915258620.2686861345053829">
<table 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)" id="m_7239844958464048745LPContainer_15205915258590.9282736731640967" cellspacing="0">
<tbody>
<tr style="border-spacing:0px" valign="top">
<td colspan="2" style="vertical-align:top;padding:0px;display:table-cell" id="m_7239844958464048745TextCell_15205915258600.9720307957613028">
<div id="m_7239844958464048745LPRemovePreviewContainer_15205915258600.5747894184804376"></div>
<div style="color:rgb(0,120,215);font-weight:400;font-size:21px;font-family:"wf_segoe-ui_light","Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;line-height:21px" id="m_7239844958464048745LPTitle_15205915258600.6420531425137407">
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" style="text-decoration:none" id="m_7239844958464048745LPUrlAnchor_15205915258610.5529589204654419" target="_blank">amd-gfx Info Page - freedesktop.org</a></div>
<div style="margin:10px 0px 16px;color:rgb(102,102,102);font-weight:400;font-family:"wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;font-size:14px;line-height:14px" id="m_7239844958464048745LPMetadata_15205915258610.39476917506447184">
<a href="http://lists.freedesktop.org" target="_blank">lists.freedesktop.org</a></div>
<div style="display:block;color:rgb(102,102,102);font-weight:400;font-family:"wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;font-size:14px;line-height:20px;max-height:100px;overflow:hidden" id="m_7239844958464048745LPDescription_15205915258620.7443088027813343">
Subscribing to amd-gfx: Subscribe to amd-gfx by filling out the following form. Use of all <a href="http://freedesktop.org" target="_blank">freedesktop.org</a> lists is subject to our Code of ...</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
</div>
</span></font></div>
</div>
</div>
</div>
</blockquote></div><br></div></div></div></div>