aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/1807-drm-amdgpu-Check-if-SW-SMU-is-supported-before-acces.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/1807-drm-amdgpu-Check-if-SW-SMU-is-supported-before-acces.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/1807-drm-amdgpu-Check-if-SW-SMU-is-supported-before-acces.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/1807-drm-amdgpu-Check-if-SW-SMU-is-supported-before-acces.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/1807-drm-amdgpu-Check-if-SW-SMU-is-supported-before-acces.patch
new file mode 100644
index 00000000..3307143d
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/1807-drm-amdgpu-Check-if-SW-SMU-is-supported-before-acces.patch
@@ -0,0 +1,37 @@
+From ed3126d96625a7c9aa2e472907a508d57569cbb8 Mon Sep 17 00:00:00 2001
+From: Leo Li <sunpeng.li@amd.com>
+Date: Thu, 18 Apr 2019 11:53:58 -0400
+Subject: [PATCH 1807/2940] drm/amdgpu: Check if SW SMU is supported before
+ accessing funcs
+
+smu.ppt_funcs is only initialized for ASICs supporting SW SMU.
+
+On a Hawaii ASIC, attempting to access the udev attribute
+ATTRS{power_dpm_state} will cause a null pointer deref in
+amdgpu_get_dpm_state() because of this.
+
+Fix by checking if SW SMU is supported first.
+
+Signed-off-by: Leo Li <sunpeng.li@amd.com>
+Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
+Reviewed-by: Huang Rui <ray.huang@amd.com>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+index 4b7a076eea9c..95144e49c7f9 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+@@ -144,7 +144,7 @@ static ssize_t amdgpu_get_dpm_state(struct device *dev,
+ struct amdgpu_device *adev = ddev->dev_private;
+ enum amd_pm_state_type pm;
+
+- if (adev->smu.ppt_funcs->get_current_power_state)
++ if (is_support_sw_smu(adev) && adev->smu.ppt_funcs->get_current_power_state)
+ pm = amdgpu_smu_get_current_power_state(adev);
+ else if (adev->powerplay.pp_funcs->get_current_power_state)
+ pm = amdgpu_dpm_get_current_power_state(adev);
+--
+2.17.1
+