mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
drm/amd/pm: parse pp_handle under appropriate conditions
commit58d9b9a14bupstream. 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:eb4900aa4c("drm/amdgpu: Fix kernel NULL pointer dereference in dpm functions") Suggested-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Guchun Chen <guchun.chen@amd.com> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
348dcdf102
commit
17a6941567
@@ -1414,15 +1414,21 @@ int amdgpu_dpm_get_smu_prv_buf_details(struct amdgpu_device *adev,
|
|||||||
|
|
||||||
int amdgpu_dpm_is_overdrive_supported(struct amdgpu_device *adev)
|
int amdgpu_dpm_is_overdrive_supported(struct amdgpu_device *adev)
|
||||||
{
|
{
|
||||||
struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;
|
if (is_support_sw_smu(adev)) {
|
||||||
struct smu_context *smu = adev->powerplay.pp_handle;
|
struct smu_context *smu = adev->powerplay.pp_handle;
|
||||||
|
|
||||||
if ((is_support_sw_smu(adev) && smu->od_enabled) ||
|
return (smu->od_enabled || smu->is_apu);
|
||||||
(is_support_sw_smu(adev) && smu->is_apu) ||
|
} else {
|
||||||
(!is_support_sw_smu(adev) && hwmgr->od_enabled))
|
struct pp_hwmgr *hwmgr;
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
/* SI asic does not carry od_enabled */
|
||||||
|
if (adev->family == AMDGPU_FAMILY_SI)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
hwmgr = (struct pp_hwmgr *)adev->powerplay.pp_handle;
|
||||||
|
|
||||||
|
return hwmgr->od_enabled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int amdgpu_dpm_set_pp_table(struct amdgpu_device *adev,
|
int amdgpu_dpm_set_pp_table(struct amdgpu_device *adev,
|
||||||
|
|||||||
Reference in New Issue
Block a user