<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">
<p style="font-family:Arial;font-size:10pt;color:#317100;margin:15pt;" align="Left">
[AMD Public Use]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Acked-by: Alex Deucher <alexander.deucher@amd.com><br>
</div>
<div id="appendonsend"></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> Quan, Evan <Evan.Quan@amd.com><br>
<b>Sent:</b> Monday, June 8, 2020 6:46 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Deucher, Alexander <Alexander.Deucher@amd.com>; Quan, Evan <Evan.Quan@amd.com>; Cui, Flora <Flora.Cui@amd.com><br>
<b>Subject:</b> [PATCH] drm/amd/powerplay: move maximum sustainable clock retrieving to .hw_init</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Since DAL settings come between .hw_init and .late_init of SMU. And<br>
DAL needs to know the maximum sustainable clocks.<br>
<br>
Change-Id: I0702b7332a0d7c0b29dfdf4999c18efb588b8862<br>
Signed-off-by: Evan Quan <evan.quan@amd.com><br>
Reported-by: Flora Cui <flora.cui@amd.com><br>
---<br>
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 19 +++++++++++++------<br>
 1 file changed, 13 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
index 725ac90c0f36..6beae3b496be 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
@@ -819,12 +819,6 @@ static int smu_late_init(void *handle)<br>
                 return ret;<br>
         }<br>
 <br>
-       ret = smu_init_max_sustainable_clocks(smu);<br>
-       if (ret) {<br>
-               dev_err(adev->dev, "Failed to init max sustainable clocks!\n");<br>
-               return ret;<br>
-       }<br>
-<br>
         ret = smu_populate_umd_state_clk(smu);<br>
         if (ret) {<br>
                 dev_err(adev->dev, "Failed to populate UMD state clocks!\n");<br>
@@ -1364,6 +1358,19 @@ static int smu_hw_init(void *handle)<br>
                 return ret;<br>
         }<br>
 <br>
+       /*<br>
+        * Move maximum sustainable clock retrieving here considering<br>
+        * 1. It is not needed on resume(from S3).<br>
+        * 2. DAL settings come between .hw_init and .late_init of SMU.<br>
+        *    And DAL needs to know the maximum sustainable clocks. Thus<br>
+        *    it cannot be put in .late_init().<br>
+        */<br>
+       ret = smu_init_max_sustainable_clocks(smu);<br>
+       if (ret) {<br>
+               dev_err(adev->dev, "Failed to init max sustainable clocks!\n");<br>
+               return ret;<br>
+       }<br>
+<br>
         adev->pm.dpm_enabled = true;<br>
 <br>
         dev_info(adev->dev, "SMU is initialized successfully!\n");<br>
-- <br>
2.27.0<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>