Skip to contentSkip to conversation

drm/amd/pm: update deep sleep status on smu v14.0.2/3

PATCH In review Kenneth Feng 2 participants 2 messages Oct 17, 2024

Subsystems (3)
lore
Share & tools
lore

Kenneth Feng

author maintainer
#0 lore raw

PATCH v2 1/1 drm/amd/pm: update deep sleep status on smu v14.0.2/3

disable deep sleep during the compute workload for the potential performance loss on smu v14.0.2/3

V2: consider the case when the compute workload is set twice

---
 drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +9 -1
index da448523ec60..618a8e17c457 100644
@@ -1787,7 +1787,7 @@ static int smu_v14_0_2_set_power_profile_mode(struct smu_context *smu,
 	DpmActivityMonitorCoeffInt_t *activity_monitor =
 		&(activity_monitor_external.DpmActivityMonitorCoeffInt);
 	int workload_type, ret = 0;
-
+	uint32_t prev_profile_mode = smu->power_profile_mode;
 	smu->power_profile_mode = input[size];
 
 	if (smu->power_profile_mode >= PP_SMC_POWER_PROFILE_COUNT) {
@@ -1845,6 +1845,14 @@ static int smu_v14_0_2_set_power_profile_mode(struct smu_context *smu,
 		}
 	}
 
+	if (smu->power_profile_mode == PP_SMC_POWER_PROFILE_COMPUTE &&
+		prev_profile_mode != PP_SMC_POWER_PROFILE_COMPUTE)
+		smu_v14_0_deep_sleep_control(smu, false);
+
+	if (smu->power_profile_mode != PP_SMC_POWER_PROFILE_COMPUTE &&
+		prev_profile_mode == PP_SMC_POWER_PROFILE_COMPUTE)
+		smu_v14_0_deep_sleep_control(smu, true);
+
 	/* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */
 	workload_type = smu_cmn_to_asic_specific_index(smu,
 						       CMN2ASIC_MAPPING_WORKLOAD,
Signature · 1 line
2.34.1
#1 lore raw
Quoted 24 lines · Kenneth Feng

disable deep sleep during the compute workload for the potential performance loss on smu v14.0.2/3

V2: consider the case when the compute workload is set twice

---
 drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +1 -1
index da448523ec60..618a8e17c457 100644
@@ -1787,7 +1787,7 @@ static int smu_v14_0_2_set_power_profile_mode(struct smu_context *smu,
 	DpmActivityMonitorCoeffInt_t *activity_monitor =
 		&(activity_monitor_external.DpmActivityMonitorCoeffInt);
 	int workload_type, ret = 0;
-
+	uint32_t prev_profile_mode = smu->power_profile_mode;
 	smu->power_profile_mode = input[size];
 
 	if (smu->power_profile_mode >= PP_SMC_POWER_PROFILE_COUNT) {

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c static int smu_v14_0_2_set_power_profile_mode(struct smu_context *smu, · line 1849

Quoted 5 lines
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +2 -0
@@ -1845,6 +1845,14 @@ static int smu_v14_0_2_set_power_profile_mode(struct smu_context *smu,
 		}
 	}
 
+	if (smu->power_profile_mode == PP_SMC_POWER_PROFILE_COMPUTE &&
+		prev_profile_mode != PP_SMC_POWER_PROFILE_COMPUTE)

This check shouldn't be required. If the current profile is the same as the target profile, the code shouldn't reach here - that check should be at an earlier stage than this.

Thanks,
Lijo

Quoted 9 lines
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +6 -0
+		smu_v14_0_deep_sleep_control(smu, false);
+
+	if (smu->power_profile_mode != PP_SMC_POWER_PROFILE_COMPUTE &&
+		prev_profile_mode == PP_SMC_POWER_PROFILE_COMPUTE)
+		smu_v14_0_deep_sleep_control(smu, true);
+
 	/* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */
 	workload_type = smu_cmn_to_asic_specific_index(smu,
 						       CMN2ASIC_MAPPING_WORKLOAD,