<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 Shaoyun Liu <Shaoyun.Liu@amd.com><br>
<b>Sent:</b> Wednesday, May 30, 2018 6:05:21 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Liu, Shaoyun<br>
<b>Subject:</b> [PATCH] drm/amdgpu: Fix NULL pointer when load kfd driver with PP block is disabled</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">When PP block is disabled, return a fix value(100M) for mclk and sclk on<br>
bare-metal mode. This will cover the emulation mode as well.<br>
<br>
Change-Id: If34e3517b6cb6f31e898bbe7921485fbddb79fb9<br>
Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 18 +++++++-----------<br>
 1 file changed, 7 insertions(+), 11 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 887702c..8fd21cd 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c<br>
@@ -310,15 +310,12 @@ void get_local_mem_info(struct kgd_dev *kgd,<br>
                         mem_info->local_mem_size_public,<br>
                         mem_info->local_mem_size_private);<br>
 <br>
-       if (amdgpu_emu_mode == 1) {<br>
-               mem_info->mem_clk_max = 100;<br>
-               return;<br>
-       }<br>
-<br>
         if (amdgpu_sriov_vf(adev))<br>
                 mem_info->mem_clk_max = adev->clock.default_mclk / 100;<br>
-       else<br>
+       else if (adev->powerplay.pp_funcs)<br>
                 mem_info->mem_clk_max = amdgpu_dpm_get_mclk(adev, false) / 100;<br>
+       else<br>
+               mem_info->mem_clk_max = 100;<br>
 }<br>
 <br>
 uint64_t get_gpu_clock_counter(struct kgd_dev *kgd)<br>
@@ -335,13 +332,12 @@ uint32_t get_max_engine_clock_in_mhz(struct kgd_dev *kgd)<br>
         struct amdgpu_device *adev = (struct amdgpu_device *)kgd;<br>
 <br>
         /* the sclk is in quantas of 10kHz */<br>
-       if (amdgpu_emu_mode == 1)<br>
-               return 100;<br>
-<br>
         if (amdgpu_sriov_vf(adev))<br>
                 return adev->clock.default_sclk / 100;<br>
-<br>
-       return amdgpu_dpm_get_sclk(adev, false) / 100;<br>
+       else if (adev->powerplay.pp_funcs)<br>
+               return amdgpu_dpm_get_sclk(adev, false) / 100;<br>
+       else<br>
+               return 100;<br>
 }<br>
 <br>
 void get_cu_info(struct kgd_dev *kgd, struct kfd_cu_info *cu_info)<br>
-- <br>
1.9.1<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>