<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 style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Reviewed-by: Tianci Yin <tianci.yin@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> Hawking Zhang <Hawking.Zhang@amd.com><br>
<b>Sent:</b> Monday, June 24, 2019 19:58<br>
<b>To:</b> amd-gfx@lists.freedesktop.org; Deucher, Alexander; Yin, Tianci (Rico)<br>
<b>Cc:</b> Zhang, Hawking<br>
<b>Subject:</b> [PATCH] drm/amdgpu: fix modprobe failure for uvd_4/5/6</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">For uvd_4/5/6, amdgpu driver will only power on them when<br>
there are jobs assigned to decode/enc rings.uvd_4/5/6 dpm was broken<br>
since amdgpu_dpm_set_powergating_by_smu only covers gfx block.<br>
<br>
The change would add more IP block support in amdgpu_dpm_set_powergating_by_smu<br>
For GFX/UVD/VCN/VCE, if the new SMU driver is supported, invoke new<br>
power gate helper function smu_dpm_set_power_gate, otherwise, fallback to<br>
legacy powerplay helper function pp_set_powergating_by_smu. For other IP blocks<br>
always invoke legacy powerplay helper function.<br>
<br>
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c    | 11 ++++++++++-<br>
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c |  3 +++<br>
 2 files changed, 13 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c<br>
index f54a1ef..357e45f 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c<br>
@@ -948,12 +948,21 @@ int amdgpu_dpm_set_powergating_by_smu(struct amdgpu_device *adev, uint32_t block<br>
 <br>
         switch (block_type) {<br>
         case AMD_IP_BLOCK_TYPE_GFX:<br>
+       case AMD_IP_BLOCK_TYPE_UVD:<br>
+       case AMD_IP_BLOCK_TYPE_VCN:<br>
+       case AMD_IP_BLOCK_TYPE_VCE:<br>
                 if (swsmu)<br>
-                       ret = smu_gfx_off_control(&adev->smu, gate);<br>
+                       ret = smu_dpm_set_power_gate(&adev->smu, block_type, gate);<br>
                 else<br>
                         ret = ((adev)->powerplay.pp_funcs->set_powergating_by_smu(<br>
                                 (adev)->powerplay.pp_handle, block_type, gate));<br>
                 break;<br>
+       case AMD_IP_BLOCK_TYPE_GMC:<br>
+       case AMD_IP_BLOCK_TYPE_ACP:<br>
+       case AMD_IP_BLOCK_TYPE_SDMA:<br>
+               ret = ((adev)->powerplay.pp_funcs->set_powergating_by_smu(<br>
+                               (adev)->powerplay.pp_handle, block_type, gate));<br>
+               break;<br>
         default:<br>
                 break;<br>
         }<br>
diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
index edd1da6..f61ecbf 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
@@ -233,6 +233,9 @@ int smu_dpm_set_power_gate(struct smu_context *smu, uint32_t block_type,<br>
         case AMD_IP_BLOCK_TYPE_VCE:<br>
                 ret = smu_dpm_set_vce_enable(smu, gate);<br>
                 break;<br>
+       case AMD_IP_BLOCK_TYPE_GFX:<br>
+               ret = smu_gfx_off_control(smu, gate);<br>
+               break;<br>
         default:<br>
                 break;<br>
         }<br>
-- <br>
2.7.4<br>
<br>
</div>
</span></font></div>
</body>
</html>