@@ -2398,7 +2398,11 @@ static int smu_switch_power_profile(void *handle,
2398
2398
smu_power_profile_mode_get (smu , type );
2399
2399
else
2400
2400
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 );
2402
2406
if (ret ) {
2403
2407
if (enable )
2404
2408
smu_power_profile_mode_put (smu , type );
@@ -2411,6 +2415,35 @@ static int smu_switch_power_profile(void *handle,
2411
2415
return 0 ;
2412
2416
}
2413
2417
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
+
2414
2447
static enum amd_dpm_forced_level smu_get_performance_level (void * handle )
2415
2448
{
2416
2449
struct smu_context * smu = handle ;
@@ -3733,6 +3766,7 @@ static const struct amd_pm_funcs swsmu_pm_funcs = {
3733
3766
.get_pp_table = smu_sys_get_pp_table ,
3734
3767
.set_pp_table = smu_sys_set_pp_table ,
3735
3768
.switch_power_profile = smu_switch_power_profile ,
3769
+ .pause_power_profile = smu_pause_power_profile ,
3736
3770
/* export to amdgpu */
3737
3771
.dispatch_tasks = smu_handle_dpm_task ,
3738
3772
.load_firmware = smu_load_microcode ,
0 commit comments