<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">Reviewed-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 Kuehling, Felix <Felix.Kuehling@amd.com><br>
<b>Sent:</b> Thursday, November 15, 2018 4:56:51 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Kuehling, Felix; Joerg Roedel<br>
<b>Subject:</b> [PATCH] drm/amdgpu: Fix oops when pp_funcs->switch_power_profile is unset</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">On Vega20 and other pre-production GPUs, powerplay is not enabled yet.<br>
Check for NULL pointers before calling pp_funcs function pointers.<br>
<br>
Also affects Kaveri.<br>
<br>
CC: Joerg Roedel <jroedel@suse.de><br>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 7 +++++--<br>
 1 file changed, 5 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c<br>
index a9c7597..1c1fed6 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c<br>
@@ -503,8 +503,11 @@ void amdgpu_amdkfd_set_compute_idle(struct kgd_dev *kgd, bool idle)<br>
 {<br>
         struct amdgpu_device *adev = (struct amdgpu_device *)kgd;<br>
 <br>
-       amdgpu_dpm_switch_power_profile(adev,<br>
-                                       PP_SMC_POWER_PROFILE_COMPUTE, !idle);<br>
+       if (adev->powerplay.pp_funcs &&<br>
+           adev->powerplay.pp_funcs->switch_power_profile)<br>
+               amdgpu_dpm_switch_power_profile(adev,<br>
+                                               PP_SMC_POWER_PROFILE_COMPUTE,<br>
+                                               !idle);<br>
 }<br>
 <br>
 bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev, u32 vmid)<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>