]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
drm/amdgpu: Fix NULL pointer when load kfd driver with PP block is disabled
authorShaoyun Liu <Shaoyun.Liu@amd.com>
Wed, 14 Mar 2018 18:44:58 +0000 (14:44 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 31 May 2018 19:08:54 +0000 (14:08 -0500)
When PP block is disabled, return a fix value(100M) for mclk and sclk on
bare-metal mode. This will cover the emulation mode as well.

Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c

index bd36ee9f7e6d7ed012dd63b6973fdbb112b70998..60fc4413449bdd012a3a2130d4d2da01db9d1742 100644 (file)
@@ -336,15 +336,12 @@ void get_local_mem_info(struct kgd_dev *kgd,
                        mem_info->local_mem_size_public,
                        mem_info->local_mem_size_private);
 
-       if (amdgpu_emu_mode == 1) {
-               mem_info->mem_clk_max = 100;
-               return;
-       }
-
        if (amdgpu_sriov_vf(adev))
                mem_info->mem_clk_max = adev->clock.default_mclk / 100;
-       else
+       else if (adev->powerplay.pp_funcs)
                mem_info->mem_clk_max = amdgpu_dpm_get_mclk(adev, false) / 100;
+       else
+               mem_info->mem_clk_max = 100;
 }
 
 uint64_t get_gpu_clock_counter(struct kgd_dev *kgd)
@@ -361,13 +358,12 @@ uint32_t get_max_engine_clock_in_mhz(struct kgd_dev *kgd)
        struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
 
        /* the sclk is in quantas of 10kHz */
-       if (amdgpu_emu_mode == 1)
-               return 100;
-
        if (amdgpu_sriov_vf(adev))
                return adev->clock.default_sclk / 100;
-
-       return amdgpu_dpm_get_sclk(adev, false) / 100;
+       else if (adev->powerplay.pp_funcs)
+               return amdgpu_dpm_get_sclk(adev, false) / 100;
+       else
+               return 100;
 }
 
 void get_cu_info(struct kgd_dev *kgd, struct kfd_cu_info *cu_info)