FAILED: patch "[PATCH] drm/amd/pm: reapply umd profile state after recovery" failed to apply to 6.6-stable tree
Sasha Levin
maintainerThe patch below does not apply to the 6.6-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 <[email protected]>.
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-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x ad6eb088a508d927641c8a76d1ca7911dfb7c80b
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 6.6.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From ad6eb088a508d927641c8a76d1ca7911dfb7c80b Mon Sep 17 00:00:00 2001
From: Kevin Wang <[email protected]>
Date: Thu, 15 Oct 2026 15:38:26 +0800
Subject: [PATCH] drm/amd/pm: reapply umd profile state after recovery
Resume and full GPU reset retain the selected UMD profile level in driver state.
The GFX and PMFW state behind it is reinitialized.
Add a generic DPM reapply path after CG and PG restoration. It restores the UMD GFX state and asks the PM backend to replay the retained level.
v2:
- Reapply only GFX CG to preserve the profile-owned GFX PG reference.
- Fall back to AUTO when reapply fails without failing device recovery.
- Propagate PowerPlay DPM errors before accepting AUTO fallback.
- Limit workload-profile error reporting to the swSMU reapply path.
This covers:
- PCI runtime resume
- Full GPU reset recovery
- System resume, including S3 and s2idle
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 14 --- .../gpu/drm/amd/include/kgd_pp_interface.h | 2 + drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 85 ++++++++++++++++++ drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h | 1 + .../gpu/drm/amd/pm/powerplay/amd_powerplay.c | 33 +++++-- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 87 +++++++++++++++++-- 7 files changed, 201 insertions(+), 27 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 -0
@@ -2781,6 +2781,12 @@ static int amdgpu_device_ip_late_init(struct amdgpu_device *adev)amdgpu_device_set_cg_state (adev,AMD_CG_STATE_GATE );amdgpu_device_set_pg_state (adev,AMD_PG_STATE_GATE ); + r =amdgpu_dpm_reapply_umd_profile (adev); +if (r) { +dev_err (adev->dev,"Failed to restore UMD profile state: %d\n" , r); +return r; + } +amdgpu_device_fill_reset_magic (adev); r =amdgpu_device_enable_mgpu_fan_boost ();
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -14
@@ -2974,19 +2974,6 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)return 0 ; } -static void amdgpu_restore_umd_profile_pstate_after_runpm (struct amdgpu_device *adev) -{ -enum amd_dpm_forced_level level; -uint32_t profile_mode_mask =AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD | -AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK | -AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK | -AMD_DPM_FORCED_LEVEL_PROFILE_PEAK ; - - level =amdgpu_dpm_get_performance_level (adev); -if (level & profile_mode_mask) -amdgpu_asic_update_umd_stable_pstate (adev, true); -} -static int amdgpu_pmops_runtime_resume (struct device *dev) {struct pci_dev *pdev =to_pci_dev (dev);
@@ -3032,7 +3019,6 @@ static int amdgpu_pmops_runtime_resume(struct device *dev)if (adev->pm.rpm_mode ==AMDGPU_RUNPM_PX ) drm_dev->switch_power_state =DRM_SWITCH_POWER_ON ; -amdgpu_restore_umd_profile_pstate_after_runpm (adev); adev->in_runpm = false;return 0 ; }
drivers/gpu/drm/amd/include/kgd_pp_interface.h +2 -0
@@ -449,6 +449,8 @@ struct amd_pm_funcs {int (*print_clock_levels)(void *handle,enum pp_clock_type type,char *buf);int (*emit_clock_levels)(void *handle,enum pp_clock_type type,char *buf,int *offset);int (*force_performance_level)(void *handle,enum amd_dpm_forced_level level); +int (*reapply_performance_level)(void *handle, +enum amd_dpm_forced_level level);int (*get_sclk_od)(void *handle);int (*set_sclk_od)(void *handle,uint32_t value);int (*get_mclk_od)(void *handle);
drivers/gpu/drm/amd/pm/amdgpu_dpm.c +85 -0
91 lines not on this page · raw message
drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +1 -0
@@ -484,6 +484,7 @@ void amdgpu_dpm_set_power_state(struct amdgpu_device *adev,enum amd_dpm_forced_level amdgpu_dpm_get_performance_level (struct amdgpu_device *adev);int amdgpu_dpm_force_performance_level (struct amdgpu_device *adev,enum amd_dpm_forced_level level); +int amdgpu_dpm_reapply_umd_profile (struct amdgpu_device *adev);int amdgpu_dpm_get_pp_num_states (struct amdgpu_device *adev,struct pp_states_info *states); int amdgpu_dpm_dispatch_task(struct amdgpu_device *adev,
drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +28 -5
@@ -358,24 +358,46 @@ static void pp_dpm_en_umd_pstate(struct pp_hwmgr *hwmgr, } } -static int pp_dpm_force_performance_level (void *handle, -enum amd_dpm_forced_level level) +static int pp_dpm_apply_performance_level (struct pp_hwmgr *hwmgr, +enum amd_dpm_forced_level level, +bool reapply) { -struct pp_hwmgr *hwmgr = handle; +int ret;if (!hwmgr || !hwmgr->pm_en)return -EINVAL ; -if (level == hwmgr->dpm_level) +if (!reapply && level == hwmgr->dpm_level)return 0 ;pp_dpm_en_umd_pstate (hwmgr, &level); hwmgr->request_dpm_level = level; -hwmgr_handle_task (hwmgr,AMD_PP_TASK_READJUST_POWER_STATE ,NULL ); + ret =hwmgr_handle_task (hwmgr,AMD_PP_TASK_READJUST_POWER_STATE ,NULL ); +if (ret) +return ret; + + ret =phm_force_dpm_levels (hwmgr, level); +if (ret) +return ret; + + hwmgr->dpm_level = level;return 0 ; } +static int pp_dpm_force_performance_level (void *handle, +enum amd_dpm_forced_level level) +{ +return pp_dpm_apply_performance_level (handle, level, false); +} + +static int +pp_dpm_reapply_performance_level (void *handle, +enum amd_dpm_forced_level level) +{ +return pp_dpm_apply_performance_level (handle, level, true); +} +static enum amd_dpm_forced_level pp_dpm_get_performance_level (void *handle) {
@@ -1536,6 +1558,7 @@ static const struct amd_pm_funcs pp_dpm_funcs = { .load_firmware = pp_dpm_load_fw, .wait_for_fw_loading_complete = pp_dpm_fw_loading_complete, .force_performance_level = pp_dpm_force_performance_level, + .reapply_performance_level = pp_dpm_reapply_performance_level, .get_performance_level = pp_dpm_get_performance_level, .get_current_power_state = pp_dpm_get_current_power_state, .dispatch_tasks = pp_dpm_dispatch_tasks,
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +79 -8
139 lines not on this page · raw message
Signature · 1 line
2.53.0