<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<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">Acked-by: Alex Deucher <alexander.deucher@amd.com><br>
</p>
</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 Huang, JinHuiEric <JinHuiEric.Huang@amd.com><br>
<b>Sent:</b> Friday, January 25, 2019 5:24:50 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Huang, JinHuiEric<br>
<b>Subject:</b> [PATCH] drm/amd/powerplay: add override pcie parameters for Vega20</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">It is to solve RDMA performance issue.<br>
<br>
Change-Id: I441d2943e504e2ef7d33de0e8773a0f9b8fdb2ca<br>
Signed-off-by: Eric Huang <JinhuiEric.Huang@amd.com><br>
---<br>
 drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 46 ++++++++++++++++++++++<br>
 1 file changed, 46 insertions(+)<br>
<br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c<br>
index 5085b36..7e59bc8 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c<br>
@@ -771,6 +771,47 @@ static int vega20_init_smc_table(struct pp_hwmgr *hwmgr)<br>
         return 0;<br>
 }<br>
 <br>
+static int vega20_override_pcie_parameters(struct pp_hwmgr *hwmgr)<br>
+{<br>
+       struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev);<br>
+       uint32_t pcie_speed = 0, pcie_width = 0, pcie_arg;<br>
+       int ret;<br>
+<br>
+       if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN4)<br>
+               pcie_speed = 16;<br>
+       else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3)<br>
+               pcie_speed = 8;<br>
+       else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN2)<br>
+               pcie_speed = 5;<br>
+       else if (adev->pm.pcie_gen_mask & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN1)<br>
+               pcie_speed = 2;<br>
+<br>
+       if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X32)<br>
+               pcie_width = 32;<br>
+       else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X16)<br>
+               pcie_width = 16;<br>
+       else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X12)<br>
+               pcie_width = 12;<br>
+       else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X8)<br>
+               pcie_width = 8;<br>
+       else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X4)<br>
+               pcie_width = 4;<br>
+       else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X2)<br>
+               pcie_width = 2;<br>
+       else if (adev->pm.pcie_mlw_mask & CAIL_PCIE_LINK_WIDTH_SUPPORT_X1)<br>
+               pcie_width = 1;<br>
+<br>
+       pcie_arg = pcie_width | (pcie_speed << 8);<br>
+<br>
+       ret = smum_send_msg_to_smc_with_parameter(hwmgr,<br>
+                       PPSMC_MSG_OverridePcieParameters, pcie_arg);<br>
+       PP_ASSERT_WITH_CODE(!ret,<br>
+               "[OverridePcieParameters] Attempt to override pcie params failed!",<br>
+               return ret);<br>
+<br>
+       return 0;<br>
+}<br>
+<br>
 static int vega20_set_allowed_featuresmask(struct pp_hwmgr *hwmgr)<br>
 {<br>
         struct vega20_hwmgr *data =<br>
@@ -1570,6 +1611,11 @@ static int vega20_enable_dpm_tasks(struct pp_hwmgr *hwmgr)<br>
                         "[EnableDPMTasks] Failed to initialize SMC table!",<br>
                         return result);<br>
 <br>
+       result = vega20_override_pcie_parameters(hwmgr);<br>
+       PP_ASSERT_WITH_CODE(!result,<br>
+                       "[EnableDPMTasks] Failed to override pcie parameters!",<br>
+                       return result);<br>
+<br>
         result = vega20_run_btc(hwmgr);<br>
         PP_ASSERT_WITH_CODE(!result,<br>
                         "[EnableDPMTasks] Failed to run btc!",<br>
-- <br>
2.7.4<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font></div>
</body>
</html>