[PATCH] drm/amdgpu: Fix oops when pp_funcs->switch_power_profile is unset

Deucher, Alexander Alexander.Deucher at amd.com
Thu Nov 15 21:59:53 UTC 2018

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> on behalf of Kuehling, Felix <Felix.Kuehling at amd.com>
Sent: Thursday, November 15, 2018 4:56:51 PM
To: amd-gfx at lists.freedesktop.org
Cc: Kuehling, Felix; Joerg Roedel
Subject: [PATCH] drm/amdgpu: Fix oops when pp_funcs->switch_power_profile is unset

On Vega20 and other pre-production GPUs, powerplay is not enabled yet.
Check for NULL pointers before calling pp_funcs function pointers.

Also affects Kaveri.

CC: Joerg Roedel <jroedel at suse.de>
Signed-off-by: Felix Kuehling <Felix.Kuehling at amd.com>
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
index a9c7597..1c1fed6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
@@ -503,8 +503,11 @@ void amdgpu_amdkfd_set_compute_idle(struct kgd_dev *kgd, bool idle)
         struct amdgpu_device *adev = (struct amdgpu_device *)kgd;

-       amdgpu_dpm_switch_power_profile(adev,
-                                       PP_SMC_POWER_PROFILE_COMPUTE, !idle);
+       if (adev->powerplay.pp_funcs &&
+           adev->powerplay.pp_funcs->switch_power_profile)
+               amdgpu_dpm_switch_power_profile(adev,
+                                               PP_SMC_POWER_PROFILE_COMPUTE,
+                                               !idle);

 bool amdgpu_amdkfd_is_kfd_vmid(struct amdgpu_device *adev, u32 vmid)

amd-gfx mailing list
amd-gfx at lists.freedesktop.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20181115/f63ff95d/attachment.html>

More information about the amd-gfx mailing list