@@ -2398,7 +2398,11 @@ static int smu_switch_power_profile(void *handle,
23982398 smu_power_profile_mode_get (smu , type );
23992399 else
24002400 smu_power_profile_mode_put (smu , type );
2401- ret = smu_bump_power_profile_mode (smu , NULL , 0 );
2401+ /* don't switch the active workload when paused */
2402+ if (smu -> pause_workload )
2403+ ret = 0 ;
2404+ else
2405+ ret = smu_bump_power_profile_mode (smu , NULL , 0 );
24022406 if (ret ) {
24032407 if (enable )
24042408 smu_power_profile_mode_put (smu , type );
@@ -2411,6 +2415,35 @@ static int smu_switch_power_profile(void *handle,
24112415 return 0 ;
24122416}
24132417
2418+ static int smu_pause_power_profile (void * handle ,
2419+ bool pause )
2420+ {
2421+ struct smu_context * smu = handle ;
2422+ struct smu_dpm_context * smu_dpm_ctx = & (smu -> smu_dpm );
2423+ u32 workload_mask = 1 << PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT ;
2424+ int ret ;
2425+
2426+ if (!smu -> pm_enabled || !smu -> adev -> pm .dpm_enabled )
2427+ return - EOPNOTSUPP ;
2428+
2429+ if (smu_dpm_ctx -> dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL &&
2430+ smu_dpm_ctx -> dpm_level != AMD_DPM_FORCED_LEVEL_PERF_DETERMINISM ) {
2431+ smu -> pause_workload = pause ;
2432+
2433+ /* force to bootup default profile */
2434+ if (smu -> pause_workload && smu -> ppt_funcs -> set_power_profile_mode )
2435+ ret = smu -> ppt_funcs -> set_power_profile_mode (smu ,
2436+ workload_mask ,
2437+ NULL ,
2438+ 0 );
2439+ else
2440+ ret = smu_bump_power_profile_mode (smu , NULL , 0 );
2441+ return ret ;
2442+ }
2443+
2444+ return 0 ;
2445+ }
2446+
24142447static enum amd_dpm_forced_level smu_get_performance_level (void * handle )
24152448{
24162449 struct smu_context * smu = handle ;
@@ -3733,6 +3766,7 @@ static const struct amd_pm_funcs swsmu_pm_funcs = {
37333766 .get_pp_table = smu_sys_get_pp_table ,
37343767 .set_pp_table = smu_sys_set_pp_table ,
37353768 .switch_power_profile = smu_switch_power_profile ,
3769+ .pause_power_profile = smu_pause_power_profile ,
37363770 /* export to amdgpu */
37373771 .dispatch_tasks = smu_handle_dpm_task ,
37383772 .load_firmware = smu_load_microcode ,
0 commit comments