The patch below does not apply to the 4.19-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <stable@xxxxxxxxxxxxxxx>. To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-4.19.y git checkout FETCH_HEAD git cherry-pick -x 58d9b9a14b47c2a3da6effcbb01607ad7edc0275 # <resolve conflicts, build, test, etc.> git commit -s git send-email --to '<stable@xxxxxxxxxxxxxxx>' --in-reply-to '2023051326-earthen-footer-09c4@gregkh' --subject-prefix 'PATCH 4.19.y' HEAD^.. Possible dependencies: 58d9b9a14b47 ("drm/amd/pm: parse pp_handle under appropriate conditions") ebfc253335af ("drm/amd/pm: do not expose the smu_context structure used internally in power") d698a2c4859d ("drm/amd/pm: move pp_force_state_enabled member to amdgpu_pm structure") 13f5dbd6e3d9 ("drm/amd/pm: do not expose power implementation details to display") 79c65f3fcbb1 ("drm/amd/pm: do not expose power implementation details to amdgpu_pm.c") bc143d8b8387 ("drm/amd/pm: do not expose implementation details to other blocks out of power") 4da8b63944a4 ("drm/amdgpu: Send Message to SMU on aldebaran passthrough for sbr handling") f296a0bcc961 ("drm/amd/pm: skip setting gfx cgpg in the s0ix suspend-resume") 7e31a8585b79 ("drm/amdgpu: move smu_debug_mask to a more proper place") 6ff7fddbd120 ("drm/amdgpu: add support for SMU debug option") 1f5fc7a50955 ("drm/amd/pm: Add debugfs info for STB") 79aae67ef8bb ("drm/amd/pm: Add STB accessors interface") fdcb279d5b79 ("drm/amdgpu: query umc error info from ecc_table v2") edd794208555 ("drm/amd/pm: add message smu to get ecc_table v2") 3ebd8bf02380 ("drm/amdgpu: support new mode-1 reset interface (v2)") 6c08e0ef87b8 ("drm/amd/pm: avoid duplicate powergate/ungate setting") 56c5977eae87 ("drm/amdkfd: replace/remove remaining kgd_dev references") c531a58bb61b ("drm/amdkfd: replace kgd_dev in static gfx v10_3 funcs") 4056b0337746 ("drm/amdkfd: replace kgd_dev in static gfx v10 funcs") 9a17c9b79b4d ("drm/amdkfd: replace kgd_dev in static gfx v9 funcs") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 58d9b9a14b47c2a3da6effcbb01607ad7edc0275 Mon Sep 17 00:00:00 2001 From: Guchun Chen <guchun.chen@xxxxxxx> Date: Fri, 5 May 2023 13:20:11 +0800 Subject: [PATCH] drm/amd/pm: parse pp_handle under appropriate conditions amdgpu_dpm_is_overdrive_supported is a common API across all asics, so we should cast pp_handle into correct structure under different power frameworks. v2: using return directly to simplify code v3: SI asic does not carry od_enabled member in pp_handle, and update Fixes tag Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2541 Fixes: eb4900aa4c49 ("drm/amdgpu: Fix kernel NULL pointer dereference in dpm functions") Suggested-by: Mario Limonciello <mario.limonciello@xxxxxxx> Signed-off-by: Guchun Chen <guchun.chen@xxxxxxx> Reviewed-by: Mario Limonciello <mario.limonciello@xxxxxxx> Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx> Cc: stable@xxxxxxxxxxxxxxx diff --git a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c index 300e156b924f..86246f69dbe1 100644 --- a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c +++ b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c @@ -1460,15 +1460,21 @@ int amdgpu_dpm_get_smu_prv_buf_details(struct amdgpu_device *adev, int amdgpu_dpm_is_overdrive_supported(struct amdgpu_device *adev) { - struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle; - struct smu_context *smu = adev->powerplay.pp_handle; + if (is_support_sw_smu(adev)) { + struct smu_context *smu = adev->powerplay.pp_handle; + + return (smu->od_enabled || smu->is_apu); + } else { + struct pp_hwmgr *hwmgr; - if ((is_support_sw_smu(adev) && smu->od_enabled) || - (is_support_sw_smu(adev) && smu->is_apu) || - (!is_support_sw_smu(adev) && hwmgr->od_enabled)) - return true; + /* SI asic does not carry od_enabled */ + if (adev->family == AMDGPU_FAMILY_SI) + return false; - return false; + hwmgr = (struct pp_hwmgr *)adev->powerplay.pp_handle; + + return hwmgr->od_enabled; + } } int amdgpu_dpm_set_pp_table(struct amdgpu_device *adev,