Skip to contentSkip to conversation

drm/amd/pm: correct the way for retrieving enabled ppfeatures on Renoir

PATCH Superseded Evan Quan 2 participants 13 messages Jan 21, 2022 – Jan 25, 2022

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Evan Quan

author
#0 lore raw

PATCH 1/7 drm/amd/pm: correct the way for retrieving enabled ppfeatures on Renoir

As other dGPU asics, Renoir should use smu_cmn_get_enabled_mask() for that job.

Change-Id I9e845ba84dd45d0826506de44ef4760fa851a516
---
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +2 -1
index fcead7c6ca7e..c3c679bf9d9f 100644
@@ -710,7 +710,8 @@ size_t smu_cmn_get_pp_feature_mask(struct smu_context *smu,
 	size_t size = 0;
 	int ret = 0, i;
 
-	if (!smu->is_apu) {
+	if (!smu->is_apu ||
+	    (smu->adev->asic_type == CHIP_RENOIR)) {
 		ret = smu_cmn_get_enabled_mask(smu,
 						feature_mask,
 						2);
Signature · 1 line
2.29.0
author
#1 lore raw

PATCH 2/7 drm/amd/pm: unify the interface for retrieving enabled ppfeatures

Instead of having two which do the same thing.

Change-Id I6302c9b5abdb999c4b7c83a0d1852181208b1c1f
---
 .../amd/pm/swsmu/smu11/cyan_skillfish_ppt.c   |  2 +-
 .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  |  6 +-
 .../drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c  |  6 +-
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c        | 93 ++++++++-----------
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h        |  4 -
 5 files changed, 44 insertions(+), 67 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/cyan_skillfish_ppt.c +1 -1
index 2acd7470431e..cabea4eb1566 100644
@@ -373,7 +373,7 @@ static bool cyan_skillfish_is_dpm_running(struct smu_context *smu)
 	if (adev->in_suspend)
 		return false;
 
-	ret = smu_cmn_get_enabled_32_bits_mask(smu, feature_mask, 2);
+	ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);
 	if (ret)
 		return false;
 
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +3 -3
index 721027917f81..b4a3c9b8b54e 100644
@@ -507,7 +507,7 @@ static bool vangogh_is_dpm_running(struct smu_context *smu)
 	if (adev->in_suspend)
 		return false;
 
-	ret = smu_cmn_get_enabled_32_bits_mask(smu, feature_mask, 2);
+	ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);
 
 	if (ret)
 		return false;
@@ -1965,7 +1965,7 @@ static int vangogh_system_features_control(struct smu_context *smu, bool en)
 	if (!en)
 		return ret;
 
-	ret = smu_cmn_get_enabled_32_bits_mask(smu, feature_mask, 2);
+	ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);
 	if (ret)
 		return ret;
 
@@ -2182,7 +2182,7 @@ static const struct pptable_funcs vangogh_ppt_funcs = {
 	.dpm_set_jpeg_enable = vangogh_dpm_set_jpeg_enable,
 	.is_dpm_running = vangogh_is_dpm_running,
 	.read_sensor = vangogh_read_sensor,
-	.get_enabled_mask = smu_cmn_get_enabled_32_bits_mask,
+	.get_enabled_mask = smu_cmn_get_enabled_mask,
 	.get_pp_feature_mask = smu_cmn_get_pp_feature_mask,
 	.set_watermarks_table = vangogh_set_watermarks_table,
 	.set_driver_table_location = smu_v11_0_set_driver_table_location,
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +3 -3
index bd24a2632214..f425827e2361 100644
@@ -209,7 +209,7 @@ static int yellow_carp_system_features_control(struct smu_context *smu, bool en)
 	if (!en)
 		return ret;
 
-	ret = smu_cmn_get_enabled_32_bits_mask(smu, feature_mask, 2);
+	ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);
 	if (ret)
 		return ret;
 
@@ -258,7 +258,7 @@ static bool yellow_carp_is_dpm_running(struct smu_context *smu)
 	uint32_t feature_mask[2];
 	uint64_t feature_enabled;
 
-	ret = smu_cmn_get_enabled_32_bits_mask(smu, feature_mask, 2);
+	ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);
 
 	if (ret)
 		return false;
@@ -1174,7 +1174,7 @@ static const struct pptable_funcs yellow_carp_ppt_funcs = {
 	.is_dpm_running = yellow_carp_is_dpm_running,
 	.set_watermarks_table = yellow_carp_set_watermarks_table,
 	.get_gpu_metrics = yellow_carp_get_gpu_metrics,
-	.get_enabled_mask = smu_cmn_get_enabled_32_bits_mask,
+	.get_enabled_mask = smu_cmn_get_enabled_mask,
 	.get_pp_feature_mask = smu_cmn_get_pp_feature_mask,
 	.set_driver_table_location = smu_v13_0_set_driver_table_location,
 	.gfx_off_control = smu_v13_0_gfx_off_control,
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +37 -56

124 lines not on this page · raw message

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h +0 -4
index f0b4fb2a0960..4e34c18c6063 100644
@@ -61,10 +61,6 @@ int smu_cmn_get_enabled_mask(struct smu_context *smu,
 			     uint32_t *feature_mask,
 			     uint32_t num);
 
-int smu_cmn_get_enabled_32_bits_mask(struct smu_context *smu,
-					uint32_t *feature_mask,
-					uint32_t num);
-
 uint64_t smu_cmn_get_indep_throttler_status(
 					const unsigned long dep_status,
 					const uint8_t *throttler_map);
Signature · 1 line
2.29.0
author
#2 lore raw

PATCH 3/7 drm/amd/pm: drop the redundant 'supported' member of smu_feature structure

In reply to Evan Quan

As it has exactly the same value as the 'enabled' member and also do the same thing.

Change-Id I07c9a5ac5290cd0d88a40ce1768d393156419b5a
---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     |  1 -
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  1 -
 .../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c   |  8 ++++----
 .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c   | 10 +++++-----
 .../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c    | 19 ++++++++-----------
 .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  |  5 +----
 .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c    |  5 +----
 .../drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c  |  3 ---
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c        | 17 -----------------
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h        |  3 ---
 10 files changed, 19 insertions(+), 53 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -1
index 5ace30434e60..d3237b89f2c5 100644
@@ -949,7 +949,6 @@ static int smu_sw_init(void *handle)
 
 	smu->pool_size = adev->pm.smu_prv_buffer_size;
 	smu->smu_feature.feature_num = SMU_FEATURE_MAX;
-	bitmap_zero(smu->smu_feature.supported, SMU_FEATURE_MAX);
 	bitmap_zero(smu->smu_feature.enabled, SMU_FEATURE_MAX);
 	bitmap_zero(smu->smu_feature.allowed, SMU_FEATURE_MAX);
 
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -1
index 18f24db7d202..3c0360772822 100644
@@ -388,7 +388,6 @@ struct smu_power_context {
 struct smu_feature
 {
 	uint32_t feature_num;
-	DECLARE_BITMAP(supported, SMU_FEATURE_MAX);
 	DECLARE_BITMAP(allowed, SMU_FEATURE_MAX);
 	DECLARE_BITMAP(enabled, SMU_FEATURE_MAX);
 };
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +4 -4
index 84834c24a7e9..9fb290f9aaeb 100644
@@ -1625,8 +1625,8 @@ static int navi10_display_config_changed(struct smu_context *smu)
 	int ret = 0;
 
 	if ((smu->watermarks_bitmap & WATERMARKS_EXIST) &&
-	    smu_cmn_feature_is_supported(smu, SMU_FEATURE_DPM_DCEFCLK_BIT) &&
-	    smu_cmn_feature_is_supported(smu, SMU_FEATURE_DPM_SOCCLK_BIT)) {
+	    smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_DCEFCLK_BIT) &&
+	    smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_SOCCLK_BIT)) {
 		ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_NumOfDisplays,
 						  smu->display_config->num_display,
 						  NULL);
@@ -1864,13 +1864,13 @@ static int navi10_notify_smc_display_config(struct smu_context *smu)
 	min_clocks.dcef_clock_in_sr = smu->display_config->min_dcef_deep_sleep_set_clk;
 	min_clocks.memory_clock = smu->display_config->min_mem_set_clock;
 
-	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_DPM_DCEFCLK_BIT)) {
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_DCEFCLK_BIT)) {
 		clock_req.clock_type = amd_pp_dcef_clock;
 		clock_req.clock_freq_in_khz = min_clocks.dcef_clock * 10;
 
 		ret = smu_v11_0_display_clock_voltage_request(smu, &clock_req);
 		if (!ret) {
-			if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_DS_DCEFCLK_BIT)) {
+			if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DS_DCEFCLK_BIT)) {
 				ret = smu_cmn_send_smc_msg_with_param(smu,
 								  SMU_MSG_SetMinDeepSleepDcefclk,
 								  min_clocks.dcef_clock_in_sr/100,
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +5 -5
index 651fe748e423..d568d6137a00 100644
@@ -1281,8 +1281,8 @@ static int sienna_cichlid_display_config_changed(struct smu_context *smu)
 	int ret = 0;
 
 	if ((smu->watermarks_bitmap & WATERMARKS_EXIST) &&
-	    smu_cmn_feature_is_supported(smu, SMU_FEATURE_DPM_DCEFCLK_BIT) &&
-	    smu_cmn_feature_is_supported(smu, SMU_FEATURE_DPM_SOCCLK_BIT)) {
+	    smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_DCEFCLK_BIT) &&
+	    smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_SOCCLK_BIT)) {
 #if 0
 		ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_NumOfDisplays,
 						  smu->display_config->num_display,
@@ -1521,13 +1521,13 @@ static int sienna_cichlid_notify_smc_display_config(struct smu_context *smu)
 	min_clocks.dcef_clock_in_sr = smu->display_config->min_dcef_deep_sleep_set_clk;
 	min_clocks.memory_clock = smu->display_config->min_mem_set_clock;
 
-	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_DPM_DCEFCLK_BIT)) {
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_DCEFCLK_BIT)) {
 		clock_req.clock_type = amd_pp_dcef_clock;
 		clock_req.clock_freq_in_khz = min_clocks.dcef_clock * 10;
 
 		ret = smu_v11_0_display_clock_voltage_request(smu, &clock_req);
 		if (!ret) {
-			if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_DS_DCEFCLK_BIT)) {
+			if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DS_DCEFCLK_BIT)) {
 				ret = smu_cmn_send_smc_msg_with_param(smu,
 								  SMU_MSG_SetMinDeepSleepDcefclk,
 								  min_clocks.dcef_clock_in_sr/100,
@@ -3752,7 +3752,7 @@ static int sienna_cichlid_gpo_control(struct smu_context *smu,
 	int ret = 0;
 
 
-	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_DPM_GFX_GPO_BIT)) {
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_GFX_GPO_BIT)) {
 		ret = smu_cmn_get_smc_version(smu, NULL, &smu_version);
 		if (ret)
 			return ret;
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +8 -11
index b58a4c2823c2..b69c2ecc8e25 100644
@@ -808,7 +808,6 @@ int smu_v11_0_system_features_control(struct smu_context *smu,
 		return ret;
 
 	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
 	if (en) {
 		ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);
@@ -817,8 +816,6 @@ int smu_v11_0_system_features_control(struct smu_context *smu,
 
 		bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
 			    feature->feature_num);
-		bitmap_copy(feature->supported, (unsigned long *)&feature_mask,
-			    feature->feature_num);
 	}
 
 	return ret;
@@ -1186,7 +1183,7 @@ smu_v11_0_auto_fan_control(struct smu_context *smu, bool auto_fan_control)
 {
 	int ret = 0;
 
-	if (!smu_cmn_feature_is_supported(smu, SMU_FEATURE_FAN_CONTROL_BIT))
+	if (!smu_cmn_feature_is_enabled(smu, SMU_FEATURE_FAN_CONTROL_BIT))
 		return 0;
 
 	ret = smu_cmn_feature_set_enabled(smu, SMU_FEATURE_FAN_CONTROL_BIT, auto_fan_control);
@@ -1607,7 +1604,7 @@ bool smu_v11_0_baco_is_support(struct smu_context *smu)
 		return false;
 
 	/* Arcturus does not support this bit mask */
-	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_BACO_BIT) &&
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT) &&
 	   !smu_cmn_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT))
 		return false;
 
@@ -2150,7 +2147,7 @@ int smu_v11_0_gfx_ulv_control(struct smu_context *smu,
 {
 	int ret = 0;
 
-	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_GFX_ULV_BIT))
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_GFX_ULV_BIT))
 		ret = smu_cmn_feature_set_enabled(smu, SMU_FEATURE_GFX_ULV_BIT, enablement);
 
 	return ret;
@@ -2162,7 +2159,7 @@ int smu_v11_0_deep_sleep_control(struct smu_context *smu,
 	struct amdgpu_device *adev = smu->adev;
 	int ret = 0;
 
-	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_DS_GFXCLK_BIT)) {
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DS_GFXCLK_BIT)) {
 		ret = smu_cmn_feature_set_enabled(smu, SMU_FEATURE_DS_GFXCLK_BIT, enablement);
 		if (ret) {
 			dev_err(adev->dev, "Failed to %s GFXCLK DS!\n", enablement ? "enable" : "disable");
@@ -2170,7 +2167,7 @@ int smu_v11_0_deep_sleep_control(struct smu_context *smu,
 		}
 	}
 
-	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_DS_UCLK_BIT)) {
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DS_UCLK_BIT)) {
 		ret = smu_cmn_feature_set_enabled(smu, SMU_FEATURE_DS_UCLK_BIT, enablement);
 		if (ret) {
 			dev_err(adev->dev, "Failed to %s UCLK DS!\n", enablement ? "enable" : "disable");
@@ -2178,7 +2175,7 @@ int smu_v11_0_deep_sleep_control(struct smu_context *smu,
 		}
 	}
 
-	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_DS_FCLK_BIT)) {
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DS_FCLK_BIT)) {
 		ret = smu_cmn_feature_set_enabled(smu, SMU_FEATURE_DS_FCLK_BIT, enablement);
 		if (ret) {
 			dev_err(adev->dev, "Failed to %s FCLK DS!\n", enablement ? "enable" : "disable");
@@ -2186,7 +2183,7 @@ int smu_v11_0_deep_sleep_control(struct smu_context *smu,
 		}
 	}
 
-	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_DS_SOCCLK_BIT)) {
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DS_SOCCLK_BIT)) {
 		ret = smu_cmn_feature_set_enabled(smu, SMU_FEATURE_DS_SOCCLK_BIT, enablement);
 		if (ret) {
 			dev_err(adev->dev, "Failed to %s SOCCLK DS!\n", enablement ? "enable" : "disable");
@@ -2194,7 +2191,7 @@ int smu_v11_0_deep_sleep_control(struct smu_context *smu,
 		}
 	}
 
-	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_DS_LCLK_BIT)) {
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DS_LCLK_BIT)) {
 		ret = smu_cmn_feature_set_enabled(smu, SMU_FEATURE_DS_LCLK_BIT, enablement);
 		if (ret) {
 			dev_err(adev->dev, "Failed to %s LCLK DS!\n", enablement ? "enable" : "disable");
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +1 -4
index b4a3c9b8b54e..e72831aa4859 100644
@@ -1960,7 +1960,6 @@ static int vangogh_system_features_control(struct smu_context *smu, bool en)
 						      RLC_STATUS_OFF, NULL);
 
 	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
 	if (!en)
 		return ret;
@@ -1971,8 +1970,6 @@ static int vangogh_system_features_control(struct smu_context *smu, bool en)
 
 	bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
 		    feature->feature_num);
-	bitmap_copy(feature->supported, (unsigned long *)&feature_mask,
-		    feature->feature_num);
 
 	return 0;
 }
@@ -1989,7 +1986,7 @@ static int vangogh_post_smu_init(struct smu_context *smu)
 		adev->gfx.config.max_sh_per_se * adev->gfx.config.max_shader_engines;
 
 	/* allow message will be sent after enable message on Vangogh*/
-	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_DPM_GFXCLK_BIT) &&
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_GFXCLK_BIT) &&
 			(adev->pg_flags & AMD_PG_SUPPORT_GFX_PG)) {
 		ret = smu_cmn_send_smc_msg(smu, SMU_MSG_EnableGfxOff, NULL);
 		if (ret) {
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +1 -4
index 1754a3720179..c5d354175675 100644
@@ -774,7 +774,6 @@ int smu_v13_0_system_features_control(struct smu_context *smu,
 		return ret;
 
 	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
 	if (en) {
 		ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);
@@ -783,8 +782,6 @@ int smu_v13_0_system_features_control(struct smu_context *smu,
 
 		bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
 			    feature->feature_num);
-		bitmap_copy(feature->supported, (unsigned long *)&feature_mask,
-			    feature->feature_num);
 	}
 
 	return ret;
@@ -1071,7 +1068,7 @@ smu_v13_0_auto_fan_control(struct smu_context *smu, bool auto_fan_control)
 {
 	int ret = 0;
 
-	if (!smu_cmn_feature_is_supported(smu, SMU_FEATURE_FAN_CONTROL_BIT))
+	if (!smu_cmn_feature_is_enabled(smu, SMU_FEATURE_FAN_CONTROL_BIT))
 		return 0;
 
 	ret = smu_cmn_feature_set_enabled(smu, SMU_FEATURE_FAN_CONTROL_BIT, auto_fan_control);
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -3
index f425827e2361..e9172622c0c4 100644
@@ -204,7 +204,6 @@ static int yellow_carp_system_features_control(struct smu_context *smu, bool en)
 		ret = smu_cmn_send_smc_msg(smu, SMU_MSG_PrepareMp1ForUnload, NULL);
 
 	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
 	if (!en)
 		return ret;
@@ -215,8 +214,6 @@ static int yellow_carp_system_features_control(struct smu_context *smu, bool en)
 
 	bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
 		    feature->feature_num);
-	bitmap_copy(feature->supported, (unsigned long *)&feature_mask,
-		    feature->feature_num);
 
 	return 0;
 }
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0 -17
index 50164ebed1cd..49bcabe9d708 100644
@@ -476,23 +476,6 @@ int smu_cmn_to_asic_specific_index(struct smu_context *smu,
 	}
 }
 
-int smu_cmn_feature_is_supported(struct smu_context *smu,
-				 enum smu_feature_mask mask)
-{
-	struct smu_feature *feature = &smu->smu_feature;
-	int feature_id;
-
-	feature_id = smu_cmn_to_asic_specific_index(smu,
-						    CMN2ASIC_MAPPING_FEATURE,
-						    mask);
-	if (feature_id < 0)
-		return 0;
-
-	WARN_ON(feature_id > feature->feature_num);
-
-	return test_bit(feature_id, feature->supported);
-}
-
 int smu_cmn_feature_is_enabled(struct smu_context *smu,
 			       enum smu_feature_mask mask)
 {
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h +0 -3
index 4e34c18c6063..19919182260a 100644
@@ -48,9 +48,6 @@ int smu_cmn_to_asic_specific_index(struct smu_context *smu,
 				   enum smu_cmn2asic_mapping_type type,
 				   uint32_t index);
 
-int smu_cmn_feature_is_supported(struct smu_context *smu,
-				 enum smu_feature_mask mask);
-
 int smu_cmn_feature_is_enabled(struct smu_context *smu,
 			       enum smu_feature_mask mask);
 
Signature · 1 line
2.29.0
#3 lore raw

Re: [PATCH 3/7] drm/amd/pm: drop the redundant 'supported' member of smu_feature structure

Quoted 3 lines · Evan Quan

As it has exactly the same value as the 'enabled' member and also do the same thing.

I believe the original intention is different. We need to cache the features which are really supported by PMFW on that device on init. When a request comes through sysfs node for enable/disable of a feature, we should check against this and disallow those which are not supported.

Thanks,
Lijo

Quoted 327 lines
Change-Id I07c9a5ac5290cd0d88a40ce1768d393156419b5a
---
  drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     |  1 -
  drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  1 -
  .../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c   |  8 ++++----
  .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c   | 10 +++++-----
  .../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c    | 19 ++++++++-----------
  .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  |  5 +----
  .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c    |  5 +----
  .../drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c  |  3 ---
  drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c        | 17 -----------------
  drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h        |  3 ---
  10 files changed, 19 insertions(+), 53 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -1
index 5ace30434e60..d3237b89f2c5 100644
@@ -949,7 +949,6 @@ static int smu_sw_init(void *handle)
 
  	smu->pool_size = adev->pm.smu_prv_buffer_size;
  	smu->smu_feature.feature_num = SMU_FEATURE_MAX;
-	bitmap_zero(smu->smu_feature.supported, SMU_FEATURE_MAX);
  	bitmap_zero(smu->smu_feature.enabled, SMU_FEATURE_MAX);
  	bitmap_zero(smu->smu_feature.allowed, SMU_FEATURE_MAX);
 
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -1
index 18f24db7d202..3c0360772822 100644
@@ -388,7 +388,6 @@ struct smu_power_context {
  struct smu_feature
  {
  	uint32_t feature_num;
-	DECLARE_BITMAP(supported, SMU_FEATURE_MAX);
  	DECLARE_BITMAP(allowed, SMU_FEATURE_MAX);
  	DECLARE_BITMAP(enabled, SMU_FEATURE_MAX);
  };
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +4 -4
index 84834c24a7e9..9fb290f9aaeb 100644
@@ -1625,8 +1625,8 @@ static int navi10_display_config_changed(struct smu_context *smu)
  	int ret = 0;
 
  	if ((smu->watermarks_bitmap & WATERMARKS_EXIST) &&
-	    smu_cmn_feature_is_supported(smu, SMU_FEATURE_DPM_DCEFCLK_BIT) &&
-	    smu_cmn_feature_is_supported(smu, SMU_FEATURE_DPM_SOCCLK_BIT)) {
+	    smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_DCEFCLK_BIT) &&
+	    smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_SOCCLK_BIT)) {
  		ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_NumOfDisplays,
  						  smu->display_config->num_display,
  						  NULL);
@@ -1864,13 +1864,13 @@ static int navi10_notify_smc_display_config(struct smu_context *smu)
  	min_clocks.dcef_clock_in_sr = smu->display_config->min_dcef_deep_sleep_set_clk;
  	min_clocks.memory_clock = smu->display_config->min_mem_set_clock;
 
-	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_DPM_DCEFCLK_BIT)) {
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_DCEFCLK_BIT)) {
  		clock_req.clock_type = amd_pp_dcef_clock;
  		clock_req.clock_freq_in_khz = min_clocks.dcef_clock * 10;
 
  		ret = smu_v11_0_display_clock_voltage_request(smu, &clock_req);
  		if (!ret) {
-			if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_DS_DCEFCLK_BIT)) {
+			if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DS_DCEFCLK_BIT)) {
  				ret = smu_cmn_send_smc_msg_with_param(smu,
  								  SMU_MSG_SetMinDeepSleepDcefclk,
  								  min_clocks.dcef_clock_in_sr/100,
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +5 -5
index 651fe748e423..d568d6137a00 100644
@@ -1281,8 +1281,8 @@ static int sienna_cichlid_display_config_changed(struct smu_context *smu)
  	int ret = 0;
 
  	if ((smu->watermarks_bitmap & WATERMARKS_EXIST) &&
-	    smu_cmn_feature_is_supported(smu, SMU_FEATURE_DPM_DCEFCLK_BIT) &&
-	    smu_cmn_feature_is_supported(smu, SMU_FEATURE_DPM_SOCCLK_BIT)) {
+	    smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_DCEFCLK_BIT) &&
+	    smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_SOCCLK_BIT)) {
  #if 0
  		ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_NumOfDisplays,
  						  smu->display_config->num_display,
@@ -1521,13 +1521,13 @@ static int sienna_cichlid_notify_smc_display_config(struct smu_context *smu)
  	min_clocks.dcef_clock_in_sr = smu->display_config->min_dcef_deep_sleep_set_clk;
  	min_clocks.memory_clock = smu->display_config->min_mem_set_clock;
 
-	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_DPM_DCEFCLK_BIT)) {
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_DCEFCLK_BIT)) {
  		clock_req.clock_type = amd_pp_dcef_clock;
  		clock_req.clock_freq_in_khz = min_clocks.dcef_clock * 10;
 
  		ret = smu_v11_0_display_clock_voltage_request(smu, &clock_req);
  		if (!ret) {
-			if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_DS_DCEFCLK_BIT)) {
+			if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DS_DCEFCLK_BIT)) {
  				ret = smu_cmn_send_smc_msg_with_param(smu,
  								  SMU_MSG_SetMinDeepSleepDcefclk,
  								  min_clocks.dcef_clock_in_sr/100,
@@ -3752,7 +3752,7 @@ static int sienna_cichlid_gpo_control(struct smu_context *smu,
  	int ret = 0;
 
 
-	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_DPM_GFX_GPO_BIT)) {
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_GFX_GPO_BIT)) {
  		ret = smu_cmn_get_smc_version(smu, NULL, &smu_version);
  		if (ret)
  			return ret;
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +8 -11
index b58a4c2823c2..b69c2ecc8e25 100644
@@ -808,7 +808,6 @@ int smu_v11_0_system_features_control(struct smu_context *smu,
  		return ret;
 
  	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
  	if (en) {
  		ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);
@@ -817,8 +816,6 @@ int smu_v11_0_system_features_control(struct smu_context *smu,
 
  		bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
  			    feature->feature_num);
-		bitmap_copy(feature->supported, (unsigned long *)&feature_mask,
-			    feature->feature_num);
  	}
 
  	return ret;
@@ -1186,7 +1183,7 @@ smu_v11_0_auto_fan_control(struct smu_context *smu, bool auto_fan_control)
  {
  	int ret = 0;
 
-	if (!smu_cmn_feature_is_supported(smu, SMU_FEATURE_FAN_CONTROL_BIT))
+	if (!smu_cmn_feature_is_enabled(smu, SMU_FEATURE_FAN_CONTROL_BIT))
  		return 0;
 
  	ret = smu_cmn_feature_set_enabled(smu, SMU_FEATURE_FAN_CONTROL_BIT, auto_fan_control);
@@ -1607,7 +1604,7 @@ bool smu_v11_0_baco_is_support(struct smu_context *smu)
  		return false;
 
  	/* Arcturus does not support this bit mask */
-	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_BACO_BIT) &&
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT) &&
  	   !smu_cmn_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT))
  		return false;
 
@@ -2150,7 +2147,7 @@ int smu_v11_0_gfx_ulv_control(struct smu_context *smu,
  {
  	int ret = 0;
 
-	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_GFX_ULV_BIT))
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_GFX_ULV_BIT))
  		ret = smu_cmn_feature_set_enabled(smu, SMU_FEATURE_GFX_ULV_BIT, enablement);
 
  	return ret;
@@ -2162,7 +2159,7 @@ int smu_v11_0_deep_sleep_control(struct smu_context *smu,
  	struct amdgpu_device *adev = smu->adev;
  	int ret = 0;
 
-	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_DS_GFXCLK_BIT)) {
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DS_GFXCLK_BIT)) {
  		ret = smu_cmn_feature_set_enabled(smu, SMU_FEATURE_DS_GFXCLK_BIT, enablement);
  		if (ret) {
  			dev_err(adev->dev, "Failed to %s GFXCLK DS!\n", enablement ? "enable" : "disable");
@@ -2170,7 +2167,7 @@ int smu_v11_0_deep_sleep_control(struct smu_context *smu,
  		}
  	}
 
-	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_DS_UCLK_BIT)) {
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DS_UCLK_BIT)) {
  		ret = smu_cmn_feature_set_enabled(smu, SMU_FEATURE_DS_UCLK_BIT, enablement);
  		if (ret) {
  			dev_err(adev->dev, "Failed to %s UCLK DS!\n", enablement ? "enable" : "disable");
@@ -2178,7 +2175,7 @@ int smu_v11_0_deep_sleep_control(struct smu_context *smu,
  		}
  	}
 
-	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_DS_FCLK_BIT)) {
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DS_FCLK_BIT)) {
  		ret = smu_cmn_feature_set_enabled(smu, SMU_FEATURE_DS_FCLK_BIT, enablement);
  		if (ret) {
  			dev_err(adev->dev, "Failed to %s FCLK DS!\n", enablement ? "enable" : "disable");
@@ -2186,7 +2183,7 @@ int smu_v11_0_deep_sleep_control(struct smu_context *smu,
  		}
  	}
 
-	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_DS_SOCCLK_BIT)) {
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DS_SOCCLK_BIT)) {
  		ret = smu_cmn_feature_set_enabled(smu, SMU_FEATURE_DS_SOCCLK_BIT, enablement);
  		if (ret) {
  			dev_err(adev->dev, "Failed to %s SOCCLK DS!\n", enablement ? "enable" : "disable");
@@ -2194,7 +2191,7 @@ int smu_v11_0_deep_sleep_control(struct smu_context *smu,
  		}
  	}
 
-	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_DS_LCLK_BIT)) {
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DS_LCLK_BIT)) {
  		ret = smu_cmn_feature_set_enabled(smu, SMU_FEATURE_DS_LCLK_BIT, enablement);
  		if (ret) {
  			dev_err(adev->dev, "Failed to %s LCLK DS!\n", enablement ? "enable" : "disable");
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +1 -4
index b4a3c9b8b54e..e72831aa4859 100644
@@ -1960,7 +1960,6 @@ static int vangogh_system_features_control(struct smu_context *smu, bool en)
  						      RLC_STATUS_OFF, NULL);
 
  	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
  	if (!en)
  		return ret;
@@ -1971,8 +1970,6 @@ static int vangogh_system_features_control(struct smu_context *smu, bool en)
 
  	bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
  		    feature->feature_num);
-	bitmap_copy(feature->supported, (unsigned long *)&feature_mask,
-		    feature->feature_num);
 
  	return 0;
  }
@@ -1989,7 +1986,7 @@ static int vangogh_post_smu_init(struct smu_context *smu)
  		adev->gfx.config.max_sh_per_se * adev->gfx.config.max_shader_engines;
 
  	/* allow message will be sent after enable message on Vangogh*/
-	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_DPM_GFXCLK_BIT) &&
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_GFXCLK_BIT) &&
  			(adev->pg_flags & AMD_PG_SUPPORT_GFX_PG)) {
  		ret = smu_cmn_send_smc_msg(smu, SMU_MSG_EnableGfxOff, NULL);
  		if (ret) {
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +1 -4
index 1754a3720179..c5d354175675 100644
@@ -774,7 +774,6 @@ int smu_v13_0_system_features_control(struct smu_context *smu,
  		return ret;
 
  	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
  	if (en) {
  		ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);
@@ -783,8 +782,6 @@ int smu_v13_0_system_features_control(struct smu_context *smu,
 
  		bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
  			    feature->feature_num);
-		bitmap_copy(feature->supported, (unsigned long *)&feature_mask,
-			    feature->feature_num);
  	}
 
  	return ret;
@@ -1071,7 +1068,7 @@ smu_v13_0_auto_fan_control(struct smu_context *smu, bool auto_fan_control)
  {
  	int ret = 0;
 
-	if (!smu_cmn_feature_is_supported(smu, SMU_FEATURE_FAN_CONTROL_BIT))
+	if (!smu_cmn_feature_is_enabled(smu, SMU_FEATURE_FAN_CONTROL_BIT))
  		return 0;
 
  	ret = smu_cmn_feature_set_enabled(smu, SMU_FEATURE_FAN_CONTROL_BIT, auto_fan_control);
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -3
index f425827e2361..e9172622c0c4 100644
@@ -204,7 +204,6 @@ static int yellow_carp_system_features_control(struct smu_context *smu, bool en)
  		ret = smu_cmn_send_smc_msg(smu, SMU_MSG_PrepareMp1ForUnload, NULL);
 
  	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
  	if (!en)
  		return ret;
@@ -215,8 +214,6 @@ static int yellow_carp_system_features_control(struct smu_context *smu, bool en)
 
  	bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
  		    feature->feature_num);
-	bitmap_copy(feature->supported, (unsigned long *)&feature_mask,
-		    feature->feature_num);
 
  	return 0;
  }
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0 -17
index 50164ebed1cd..49bcabe9d708 100644
@@ -476,23 +476,6 @@ int smu_cmn_to_asic_specific_index(struct smu_context *smu,
  	}
  }
 
-int smu_cmn_feature_is_supported(struct smu_context *smu,
-				 enum smu_feature_mask mask)
-{
-	struct smu_feature *feature = &smu->smu_feature;
-	int feature_id;
-
-	feature_id = smu_cmn_to_asic_specific_index(smu,
-						    CMN2ASIC_MAPPING_FEATURE,
-						    mask);
-	if (feature_id < 0)
-		return 0;
-
-	WARN_ON(feature_id > feature->feature_num);
-
-	return test_bit(feature_id, feature->supported);
-}
-
  int smu_cmn_feature_is_enabled(struct smu_context *smu,
  			       enum smu_feature_mask mask)
  {
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h +0 -3
index 4e34c18c6063..19919182260a 100644
@@ -48,9 +48,6 @@ int smu_cmn_to_asic_specific_index(struct smu_context *smu,
  				   enum smu_cmn2asic_mapping_type type,
  				   uint32_t index);
 
-int smu_cmn_feature_is_supported(struct smu_context *smu,
-				 enum smu_feature_mask mask);
-
  int smu_cmn_feature_is_enabled(struct smu_context *smu,
  			       enum smu_feature_mask mask);
 
author
#4 lore raw

RE: [PATCH 3/7] drm/amd/pm: drop the redundant 'supported' member of smu_feature structure

[AMD Official Use Only]

Quoted 12 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, January 21, 2022 4:52 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH 3/7] drm/amd/pm: drop the redundant 'supported' member of smu_feature structure

On 1/21/2022 1:14 PM, Evan Quan wrote:

Quoted 8 lines
Quoted 3 lines

As it has exactly the same value as the 'enabled' member and also do the same thing.

I believe the original intention is different. We need to cache the features which are really supported by PMFW on that device on init. When a request comes through sysfs node for enable/disable of a feature, we should check against this and disallow those which are not supported.

[Quan, Evan] Uh, I doubt it was designed with such intention. As if it was, there should be checks in ->get_allowed_feature_mask(e.g. navi10_get_allowed_feature_mask) whether driver tries to enable/disable different features from PMFW.
" When a request comes through sysfs node for enable/disable of a feature" If the sysfs node mentioned is "pp_features", I might be able to provide some insights why there is no such checks added when I made them. Considering there may be some dependency between those dpm features(e.g. gfx ulv depends on gfx dpm), we actually cannot guard user whether their settings will succeed. E.g. If PMFW supports both GFX ULV and DPM but user wants ULV only, the checks against pmfw supported features seem fine. But actually that cannot work due to the dependency between them. So, instead of applying some checks which actually cannot guard anything, we just let user take the risks.

BR
Evan

Quoted 448 lines

Thanks,
Lijo

Quoted 8 lines
Change-Id I07c9a5ac5290cd0d88a40ce1768d393156419b5a
---
  drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     |  1 -
  drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  1 -
  .../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c   |  8 ++++----
  .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c   | 10 +++++-----
  .../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c    | 19 ++++++++-------

----

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int navi10_display_config_changed(struct

Quoted 39 lines
  .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  |  5 +----
  .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c    |  5 +----
  .../drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c  |  3 ---
  drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c        | 17 -----------------
  drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h        |  3 ---
  10 files changed, 19 insertions(+), 53 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -1
index 5ace30434e60..d3237b89f2c5 100644
@@ -949,7 +949,6 @@ static int smu_sw_init(void *handle)
 
  	smu->pool_size = adev->pm.smu_prv_buffer_size;
  	smu->smu_feature.feature_num = SMU_FEATURE_MAX;
-	bitmap_zero(smu->smu_feature.supported, SMU_FEATURE_MAX);
  	bitmap_zero(smu->smu_feature.enabled, SMU_FEATURE_MAX);
  	bitmap_zero(smu->smu_feature.allowed, SMU_FEATURE_MAX);
 
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -1
index 18f24db7d202..3c0360772822 100644
@@ -388,7 +388,6 @@ struct smu_power_context {
  struct smu_feature
  {
  	uint32_t feature_num;
-	DECLARE_BITMAP(supported, SMU_FEATURE_MAX);
  	DECLARE_BITMAP(allowed, SMU_FEATURE_MAX);
  	DECLARE_BITMAP(enabled, SMU_FEATURE_MAX);
  };
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -0
index 84834c24a7e9..9fb290f9aaeb 100644
@@ -1625,8 +1625,8 @@ static int navi10_display_config_changed(struct

smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int navi10_display_config_changed(struct smu_context *smu)

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -1
  	int ret = 0;
 
  	if ((smu->watermarks_bitmap & WATERMARKS_EXIST) &&
-	    smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int navi10_display_config_changed(struct · line 1629

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -1
-	    smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_SOCCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int navi10_display_config_changed(struct · line 1628

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -0
+	    smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int navi10_display_config_changed(struct · line 1629

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -0
+	    smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_SOCCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int navi10_display_config_changed(struct · line 1630

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -0
  		ret = smu_cmn_send_smc_msg_with_param(smu,

SMU_MSG_NumOfDisplays,

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -0
  						  smu->display_config-
 num_display,

NULL);

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -0
@@ -1864,13 +1864,13 @@ static int

navi10_notify_smc_display_config(struct smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int · line 1869

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -1
  	min_clocks.dcef_clock_in_sr = smu->display_config-
 min_dcef_deep_sleep_set_clk;
  	min_clocks.memory_clock = smu->display_config-
 min_mem_set_clock;
 
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int · line 1869

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int navi10_notify_smc_display_config(struct smu_context *smu)

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -0
  		clock_req.clock_type = amd_pp_dcef_clock;
  		clock_req.clock_freq_in_khz = min_clocks.dcef_clock * 10;
 
  		ret = smu_v11_0_display_clock_voltage_request(smu,

&clock_req);

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int · line 1875

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -1
  		if (!ret) {
-			if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int · line 1875

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -0
+			if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int · line 1876

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -0
  				ret =

smu_cmn_send_smc_msg_with_param(smu,

Quoted 1 line

SMU_MSG_SetMinDeepSleepDcefclk,

Quoted 1 line

min_clocks.dcef_clock_in_sr/100, diff --git

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int

Quoted 6 lines

a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c index 651fe748e423..d568d6137a00 100644

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -0
@@ -1281,8 +1281,8 @@ static int

sienna_cichlid_display_config_changed(struct smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int · line 1284

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -1
  	int ret = 0;
 
  	if ((smu->watermarks_bitmap & WATERMARKS_EXIST) &&
-	    smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int · line 1285

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -1
-	    smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_SOCCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int · line 1284

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
+	    smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int · line 1285

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
+	    smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_SOCCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int · line 1287

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -0
  #if 0
  		ret = smu_cmn_send_smc_msg_with_param(smu,

SMU_MSG_NumOfDisplays,

Quoted 3 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -0
  						  smu->display_config-

num_display, @@ -1521,13 +1521,13 @@
static int sienna_cichlid_notify_smc_display_config(struct smu_context

*smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 6 lines

min_clocks.dcef_clock_in_sr = smu->display_config-
min_dcef_deep_sleep_set_clk;
min_clocks.memory_clock = smu->display_config-
min_mem_set_clock;

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT)) {

Quoted 4 lines
  		clock_req.clock_type = amd_pp_dcef_clock;
  		clock_req.clock_freq_in_khz = min_clocks.dcef_clock * 10;

ret = smu_v11_0_display_clock_voltage_request(smu,

&clock_req);

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 2 lines
  		if (!ret) {
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -1
-			if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
+			if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_DCEFCLK_BIT)) {

Quoted 1 line

ret =

smu_cmn_send_smc_msg_with_param(smu,

Quoted 1 line

SMU_MSG_SetMinDeepSleepDcefclk,

Quoted 1 line

min_clocks.dcef_clock_in_sr/100, @@ -3752,7 +3752,7 @@

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 5 lines

static int sienna_cichlid_gpo_control(struct smu_context *smu,
int ret = 0;

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_GFX_GPO_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_GFX_GPO_BIT)) {

Quoted 1 line

ret = smu_cmn_get_smc_version(smu, NULL,

&smu_version);

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_system_features_control(struct

Quoted 8 lines

if (ret)
return ret;

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
index b58a4c2823c2..b69c2ecc8e25 100644
@@ -808,7 +808,6 @@ int smu_v11_0_system_features_control(struct

smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_system_features_control(struct smu_context *smu, · line 813

Quoted 7 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
  		return ret;
 
  	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
  	if (en) {
  		ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);

@@ -817,8

Quoted 4 lines

+816,6 @@ int smu_v11_0_system_features_control(struct smu_context *smu,

bitmap_copy(feature->enabled, (unsigned long

*)&feature_mask,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 2 lines

feature->feature_num);

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-		bitmap_copy(feature->supported, (unsigned long

*)&feature_mask,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c smu_v11_0_auto_fan_control(struct

Quoted 5 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-			    feature->feature_num);
  	}
 
  	return ret;
@@ -1186,7 +1183,7 @@ smu_v11_0_auto_fan_control(struct

smu_context *smu, bool auto_fan_control)

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c smu_v11_0_auto_fan_control(struct smu_context *smu, bool auto_fan_control)

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
  {
  	int ret = 0;
 
-	if (!smu_cmn_feature_is_supported(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c smu_v11_0_auto_fan_control(struct · line 1186

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (!smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c smu_v11_0_auto_fan_control(struct smu_context *smu, bool auto_fan_control)

Quoted 3 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
  		return 0;
 
  	ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_FAN_CONTROL_BIT,

Quoted 1 line

auto_fan_control); @@ -1607,7 +1604,7 @@ bool

smu_v11_0_baco_is_support(struct smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 4 lines

return false;

/* Arcturus does not support this bit mask */

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_BACO_BIT)

&&

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT)

&&

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_gfx_ulv_control(struct

Quoted 4 lines

!smu_cmn_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT))
return false;

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
@@ -2150,7 +2147,7 @@ int smu_v11_0_gfx_ulv_control(struct

smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c smu_v11_0_auto_fan_control(struct smu_context *smu, bool auto_fan_control)

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
  {
  	int ret = 0;
 
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_GFX_ULV_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_gfx_ulv_control(struct · line 2150

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_GFX_ULV_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_gfx_ulv_control(struct · line 2151

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
  		ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_GFX_ULV_BIT,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_deep_sleep_control(struct

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
 enablement);
 

return ret;

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
@@ -2162,7 +2159,7 @@ int smu_v11_0_deep_sleep_control(struct

smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_deep_sleep_control(struct smu_context *smu,

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
  	struct amdgpu_device *adev = smu->adev;
  	int ret = 0;
 
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_GFXCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_deep_sleep_control(struct · line 2162

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_GFXCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_deep_sleep_control(struct · line 2163

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
  		ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_DS_GFXCLK_BIT, enablement);

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_deep_sleep_control(struct · line 2165

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
  		if (ret) {
  			dev_err(adev->dev, "Failed to %s GFXCLK DS!\n",

enablement ?

Quoted 1 line

"enable" : "disable"); @@ -2170,7 +2167,7 @@ int

smu_v11_0_deep_sleep_control(struct smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 4 lines
  		}
  	}
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_UCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_UCLK_BIT)) {

Quoted 1 line

ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_DS_UCLK_BIT, enablement);

Quoted 2 lines

if (ret) {
dev_err(adev->dev, "Failed to %s UCLK DS!\n",

enablement ?

Quoted 1 line

"enable" : "disable"); @@ -2178,7 +2175,7 @@ int

smu_v11_0_deep_sleep_control(struct smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 4 lines
  		}
  	}
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_FCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_FCLK_BIT)) {

Quoted 1 line

ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_DS_FCLK_BIT, enablement);

Quoted 2 lines

if (ret) {
dev_err(adev->dev, "Failed to %s FCLK DS!\n",

enablement ?

Quoted 1 line

"enable" : "disable"); @@ -2186,7 +2183,7 @@ int

smu_v11_0_deep_sleep_control(struct smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 4 lines
  		}
  	}
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_SOCCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_SOCCLK_BIT)) {

Quoted 1 line

ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_DS_SOCCLK_BIT, enablement);

Quoted 2 lines

if (ret) {
dev_err(adev->dev, "Failed to %s SOCCLK DS!\n",

enablement ?

Quoted 1 line

"enable" : "disable"); @@ -2194,7 +2191,7 @@ int

smu_v11_0_deep_sleep_control(struct smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 4 lines
  		}
  	}
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_LCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_LCLK_BIT)) {

Quoted 1 line

ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_DS_LCLK_BIT, enablement);

Quoted 2 lines

if (ret) {
dev_err(adev->dev, "Failed to %s LCLK DS!\n",

enablement ?

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static int

Quoted 7 lines

"enable" : "disable"); diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c index b4a3c9b8b54e..e72831aa4859 100644

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
@@ -1960,7 +1960,6 @@ static int

vangogh_system_features_control(struct smu_context *smu, bool en)

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static int vangogh_post_smu_init(struct

Quoted 18 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -3
  						      RLC_STATUS_OFF, NULL);
 
  	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
  	if (!en)
  		return ret;
@@ -1971,8 +1970,6 @@ static int
 vangogh_system_features_control(struct smu_context *smu, bool en)
 
  	bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
  		    feature->feature_num);
-	bitmap_copy(feature->supported, (unsigned long *)&feature_mask,
-		    feature->feature_num);
 
  	return 0;
  }
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
@@ -1989,7 +1986,7 @@ static int vangogh_post_smu_init(struct

smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static int vangogh_post_smu_init(struct · line 1993

Quoted 5 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -1
  		adev->gfx.config.max_sh_per_se *
 adev->gfx.config.max_shader_engines;
 
  	/* allow message will be sent after enable message on Vangogh*/
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_GFXCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static int vangogh_post_smu_init(struct · line 1990

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_GFXCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static int vangogh_post_smu_init(struct · line 1992

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
  			(adev->pg_flags & AMD_PG_SUPPORT_GFX_PG)) {
  		ret = smu_cmn_send_smc_msg(smu,

SMU_MSG_EnableGfxOff, NULL);

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c int smu_v13_0_system_features_control(struct

Quoted 7 lines
  		if (ret) {
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -0
index 1754a3720179..c5d354175675 100644
@@ -774,7 +774,6 @@ int smu_v13_0_system_features_control(struct

smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c int smu_v13_0_system_features_control(struct · line 779

Quoted 7 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -1
  		return ret;
 
  	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
  	if (en) {
  		ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);

@@ -783,8

Quoted 4 lines

+782,6 @@ int smu_v13_0_system_features_control(struct smu_context *smu,

bitmap_copy(feature->enabled, (unsigned long

*)&feature_mask,

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

Quoted 2 lines

feature->feature_num);

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -1
-		bitmap_copy(feature->supported, (unsigned long

*)&feature_mask,

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c smu_v13_0_auto_fan_control(struct

Quoted 5 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -1
-			    feature->feature_num);
  	}
 
  	return ret;
@@ -1071,7 +1068,7 @@ smu_v13_0_auto_fan_control(struct

smu_context *smu, bool auto_fan_control)

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c smu_v13_0_auto_fan_control(struct · line 1074

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -1
  {
  	int ret = 0;
 
-	if (!smu_cmn_feature_is_supported(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c smu_v13_0_auto_fan_control(struct · line 1071

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +1 -0
+	if (!smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c smu_v13_0_auto_fan_control(struct · line 1074

Quoted 3 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -0
  		return 0;
 
  	ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_FAN_CONTROL_BIT,

drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c static int

Quoted 7 lines

auto_fan_control); diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c index f425827e2361..e9172622c0c4 100644

drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -0
@@ -204,7 +204,6 @@ static int

yellow_carp_system_features_control(struct smu_context *smu, bool en)

drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c static int · line 204

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -0
  		ret = smu_cmn_send_smc_msg(smu,

SMU_MSG_PrepareMp1ForUnload,

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c int smu_cmn_to_asic_specific_index(struct

Quoted 23 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -1
 NULL);
 
  	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
  	if (!en)

return ret;

drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -2
@@ -215,8 +214,6 @@ static int
 yellow_carp_system_features_control(struct smu_context *smu, bool en)
 
  	bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
  		    feature->feature_num);
-	bitmap_copy(feature->supported, (unsigned long *)&feature_mask,
-		    feature->feature_num);
 
  	return 0;
  }
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0 -0
index 50164ebed1cd..49bcabe9d708 100644
@@ -476,23 +476,6 @@ int smu_cmn_to_asic_specific_index(struct

smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c int smu_cmn_to_asic_specific_index(struct smu_context *smu, · line 490

Quoted 11 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0 -8
  	}
  }
 
-int smu_cmn_feature_is_supported(struct smu_context *smu,
-				 enum smu_feature_mask mask)
-{
-	struct smu_feature *feature = &smu->smu_feature;
-	int feature_id;
-
-	feature_id = smu_cmn_to_asic_specific_index(smu,
-

CMN2ASIC_MAPPING_FEATURE,

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h int smu_cmn_to_asic_specific_index(struct

Quoted 18 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0 -9
-						    mask);
-	if (feature_id < 0)
-		return 0;
-
-	WARN_ON(feature_id > feature->feature_num);
-
-	return test_bit(feature_id, feature->supported);
-}
-
  int smu_cmn_feature_is_enabled(struct smu_context *smu,
  			       enum smu_feature_mask mask)
  {
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h +0 -0
index 4e34c18c6063..19919182260a 100644
@@ -48,9 +48,6 @@ int smu_cmn_to_asic_specific_index(struct

smu_context *smu,

Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h +0 -3
  				   enum smu_cmn2asic_mapping_type type,
  				   uint32_t index);
 
-int smu_cmn_feature_is_supported(struct smu_context *smu,
-				 enum smu_feature_mask mask);
-
  int smu_cmn_feature_is_enabled(struct smu_context *smu,
  			       enum smu_feature_mask mask);
 
#5 lore raw

Re: [PATCH 3/7] drm/amd/pm: drop the redundant 'supported' member of smu_feature structure

Quoted 20 lines · Evan

[AMD Official Use Only]

Quoted 16 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, January 21, 2022 4:52 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH 3/7] drm/amd/pm: drop the redundant 'supported' member of smu_feature structure

Quoted 3 lines · Evan Quan

As it has exactly the same value as the 'enabled' member and also do the same thing.

Quoted 7 lines
Quoted 4 lines

I believe the original intention is different. We need to cache the features which are really supported by PMFW on that device on init. When a request comes through sysfs node for enable/disable of a feature, we should check against this and disallow those which are not supported.

[Quan, Evan] Uh, I doubt it was designed with such intention. As if it was, there should be checks in ->get_allowed_feature_mask(e.g. navi10_get_allowed_feature_mask) whether driver tries to enable/disable different features from PMFW.
" When a request comes through sysfs node for enable/disable of a feature" If the sysfs node mentioned is "pp_features", I might be able to provide some insights why there is no such checks added when I made them. Considering there may be some dependency between those dpm features(e.g. gfx ulv depends on gfx dpm), we actually cannot guard user whether their settings will succeed. E.g. If PMFW supports both GFX ULV and DPM but user wants ULV only, the checks against pmfw supported features seem fine. But actually that cannot work due to the dependency between them. So, instead of applying some checks which actually cannot guard anything, we just let user take the risks.

Below is one example

Review

Quoted 1 line
(quoted diff) +0 -1
-	if (!smu_cmn_feature_is_supported(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

Review

Quoted 1 line
(quoted diff) +1 -0
+	if (!smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

Let's say user switched to manual mode, that time we disable fan control and move to manual mode. Next time when user requests auto mode, we check if fan control is originally supported on that platform and switch to auto.

Either way, we should cache the features which are originally supported on the platform (through a combination of PPTable features and allowed feature masks on ASICs which are applicable) and disallow anything outside of that.

Thanks,
Lijo

Quoted 450 lines

BR
Evan

Quoted 448 lines

Thanks,
Lijo

Quoted 8 lines
Change-Id I07c9a5ac5290cd0d88a40ce1768d393156419b5a
---
   drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     |  1 -
   drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  1 -
   .../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c   |  8 ++++----
   .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c   | 10 +++++-----
   .../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c    | 19 ++++++++-------

----

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int navi10_display_config_changed(struct

Quoted 39 lines
   .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  |  5 +----
   .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c    |  5 +----
   .../drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c  |  3 ---
   drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c        | 17 -----------------
   drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h        |  3 ---
   10 files changed, 19 insertions(+), 53 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -1
index 5ace30434e60..d3237b89f2c5 100644
@@ -949,7 +949,6 @@ static int smu_sw_init(void *handle)
 
   	smu->pool_size = adev->pm.smu_prv_buffer_size;
   	smu->smu_feature.feature_num = SMU_FEATURE_MAX;
-	bitmap_zero(smu->smu_feature.supported, SMU_FEATURE_MAX);
   	bitmap_zero(smu->smu_feature.enabled, SMU_FEATURE_MAX);
   	bitmap_zero(smu->smu_feature.allowed, SMU_FEATURE_MAX);
 
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -1
index 18f24db7d202..3c0360772822 100644
@@ -388,7 +388,6 @@ struct smu_power_context {
   struct smu_feature
   {
   	uint32_t feature_num;
-	DECLARE_BITMAP(supported, SMU_FEATURE_MAX);
   	DECLARE_BITMAP(allowed, SMU_FEATURE_MAX);
   	DECLARE_BITMAP(enabled, SMU_FEATURE_MAX);
   };
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -0
index 84834c24a7e9..9fb290f9aaeb 100644
@@ -1625,8 +1625,8 @@ static int navi10_display_config_changed(struct

smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int navi10_display_config_changed(struct smu_context *smu)

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -1
   	int ret = 0;
 
   	if ((smu->watermarks_bitmap & WATERMARKS_EXIST) &&
-	    smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int navi10_display_config_changed(struct · line 1629

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -1
-	    smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_SOCCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int navi10_display_config_changed(struct · line 1628

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -0
+	    smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int navi10_display_config_changed(struct · line 1629

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -0
+	    smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_SOCCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int navi10_display_config_changed(struct · line 1630

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -0
   		ret = smu_cmn_send_smc_msg_with_param(smu,

SMU_MSG_NumOfDisplays,

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -0
   						  smu->display_config-
 num_display,
   						  NULL);
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -0
@@ -1864,13 +1864,13 @@ static int

navi10_notify_smc_display_config(struct smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int · line 1869

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -1
   	min_clocks.dcef_clock_in_sr = smu->display_config-
 min_dcef_deep_sleep_set_clk;
   	min_clocks.memory_clock = smu->display_config-
 min_mem_set_clock;
 
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int · line 1869

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int navi10_notify_smc_display_config(struct smu_context *smu)

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -0
   		clock_req.clock_type = amd_pp_dcef_clock;
   		clock_req.clock_freq_in_khz = min_clocks.dcef_clock * 10;
 
   		ret = smu_v11_0_display_clock_voltage_request(smu,

&clock_req);

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int · line 1875

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -1
   		if (!ret) {
-			if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int · line 1875

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -0
+			if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int · line 1876

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -0
   				ret =

smu_cmn_send_smc_msg_with_param(smu,

Quoted 1 line

SMU_MSG_SetMinDeepSleepDcefclk,

Quoted 1 line

min_clocks.dcef_clock_in_sr/100, diff --git

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int

Quoted 6 lines

a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c index 651fe748e423..d568d6137a00 100644

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -0
@@ -1281,8 +1281,8 @@ static int

sienna_cichlid_display_config_changed(struct smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int · line 1284

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -1
   	int ret = 0;
 
   	if ((smu->watermarks_bitmap & WATERMARKS_EXIST) &&
-	    smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int · line 1285

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -1
-	    smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_SOCCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int · line 1284

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
+	    smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int · line 1285

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
+	    smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_SOCCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int · line 1287

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -0
   #if 0
   		ret = smu_cmn_send_smc_msg_with_param(smu,

SMU_MSG_NumOfDisplays,

Quoted 3 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -0
   						  smu->display_config-

num_display, @@ -1521,13 +1521,13 @@
static int sienna_cichlid_notify_smc_display_config(struct smu_context

*smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 6 lines
   	min_clocks.dcef_clock_in_sr = smu->display_config-
min_dcef_deep_sleep_set_clk;
   	min_clocks.memory_clock = smu->display_config-

min_mem_set_clock;

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT)) {

Quoted 4 lines
   		clock_req.clock_type = amd_pp_dcef_clock;
   		clock_req.clock_freq_in_khz = min_clocks.dcef_clock * 10;

ret = smu_v11_0_display_clock_voltage_request(smu,

&clock_req);

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 2 lines
   		if (!ret) {
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -1
-			if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
+			if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_DCEFCLK_BIT)) {

Quoted 1 line

ret =

smu_cmn_send_smc_msg_with_param(smu,

Quoted 1 line

SMU_MSG_SetMinDeepSleepDcefclk,

Quoted 1 line

min_clocks.dcef_clock_in_sr/100, @@ -3752,7 +3752,7 @@

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 5 lines

static int sienna_cichlid_gpo_control(struct smu_context *smu,
int ret = 0;

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_GFX_GPO_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_GFX_GPO_BIT)) {

Quoted 1 line

ret = smu_cmn_get_smc_version(smu, NULL,

&smu_version);

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_system_features_control(struct

Quoted 8 lines
   		if (ret)
   			return ret;
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
index b58a4c2823c2..b69c2ecc8e25 100644
@@ -808,7 +808,6 @@ int smu_v11_0_system_features_control(struct

smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_system_features_control(struct smu_context *smu, · line 813

Quoted 7 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
   		return ret;
 
   	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
   	if (en) {
   		ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);

@@ -817,8

Quoted 4 lines

+816,6 @@ int smu_v11_0_system_features_control(struct smu_context *smu,

   		bitmap_copy(feature->enabled, (unsigned long

*)&feature_mask,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 2 lines
   			    feature->feature_num);
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-		bitmap_copy(feature->supported, (unsigned long

*)&feature_mask,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c smu_v11_0_auto_fan_control(struct

Quoted 5 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-			    feature->feature_num);
   	}
 
   	return ret;
@@ -1186,7 +1183,7 @@ smu_v11_0_auto_fan_control(struct

smu_context *smu, bool auto_fan_control)

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c smu_v11_0_auto_fan_control(struct smu_context *smu, bool auto_fan_control)

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
   {
   	int ret = 0;
 
-	if (!smu_cmn_feature_is_supported(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c smu_v11_0_auto_fan_control(struct · line 1186

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (!smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c smu_v11_0_auto_fan_control(struct smu_context *smu, bool auto_fan_control)

Quoted 3 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
   		return 0;
 
   	ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_FAN_CONTROL_BIT,

Quoted 1 line

auto_fan_control); @@ -1607,7 +1604,7 @@ bool

smu_v11_0_baco_is_support(struct smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 4 lines
   		return false;

   	/* Arcturus does not support this bit mask */
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_BACO_BIT)

&&

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT)

&&

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_gfx_ulv_control(struct

Quoted 4 lines
   	   !smu_cmn_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT))
   		return false;
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
@@ -2150,7 +2147,7 @@ int smu_v11_0_gfx_ulv_control(struct

smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c smu_v11_0_auto_fan_control(struct smu_context *smu, bool auto_fan_control)

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
   {
   	int ret = 0;
 
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_GFX_ULV_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_gfx_ulv_control(struct · line 2150

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_GFX_ULV_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_gfx_ulv_control(struct · line 2151

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
   		ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_GFX_ULV_BIT,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_deep_sleep_control(struct

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
 enablement);
 
   	return ret;
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
@@ -2162,7 +2159,7 @@ int smu_v11_0_deep_sleep_control(struct

smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_deep_sleep_control(struct smu_context *smu,

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
   	struct amdgpu_device *adev = smu->adev;
   	int ret = 0;
 
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_GFXCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_deep_sleep_control(struct · line 2162

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_GFXCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_deep_sleep_control(struct · line 2163

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
   		ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_DS_GFXCLK_BIT, enablement);

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_deep_sleep_control(struct · line 2165

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
   		if (ret) {
   			dev_err(adev->dev, "Failed to %s GFXCLK DS!\n",

enablement ?

Quoted 1 line

"enable" : "disable"); @@ -2170,7 +2167,7 @@ int

smu_v11_0_deep_sleep_control(struct smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 4 lines
   		}
   	}
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_UCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_UCLK_BIT)) {

Quoted 1 line

ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_DS_UCLK_BIT, enablement);

Quoted 2 lines
   		if (ret) {
   			dev_err(adev->dev, "Failed to %s UCLK DS!\n",

enablement ?

Quoted 1 line

"enable" : "disable"); @@ -2178,7 +2175,7 @@ int

smu_v11_0_deep_sleep_control(struct smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 4 lines
   		}
   	}
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_FCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_FCLK_BIT)) {

Quoted 1 line

ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_DS_FCLK_BIT, enablement);

Quoted 2 lines
   		if (ret) {
   			dev_err(adev->dev, "Failed to %s FCLK DS!\n",

enablement ?

Quoted 1 line

"enable" : "disable"); @@ -2186,7 +2183,7 @@ int

smu_v11_0_deep_sleep_control(struct smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 4 lines
   		}
   	}
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_SOCCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_SOCCLK_BIT)) {

Quoted 1 line

ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_DS_SOCCLK_BIT, enablement);

Quoted 2 lines
   		if (ret) {
   			dev_err(adev->dev, "Failed to %s SOCCLK DS!\n",

enablement ?

Quoted 1 line

"enable" : "disable"); @@ -2194,7 +2191,7 @@ int

smu_v11_0_deep_sleep_control(struct smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 4 lines
   		}
   	}
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_LCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_LCLK_BIT)) {

Quoted 1 line

ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_DS_LCLK_BIT, enablement);

Quoted 2 lines
   		if (ret) {
   			dev_err(adev->dev, "Failed to %s LCLK DS!\n",

enablement ?

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static int

Quoted 7 lines

"enable" : "disable"); diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c index b4a3c9b8b54e..e72831aa4859 100644

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
@@ -1960,7 +1960,6 @@ static int

vangogh_system_features_control(struct smu_context *smu, bool en)

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static int vangogh_post_smu_init(struct

Quoted 18 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -3
   						      RLC_STATUS_OFF, NULL);
 
   	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
   	if (!en)
   		return ret;
@@ -1971,8 +1970,6 @@ static int
 vangogh_system_features_control(struct smu_context *smu, bool en)
 
   	bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
   		    feature->feature_num);
-	bitmap_copy(feature->supported, (unsigned long *)&feature_mask,
-		    feature->feature_num);
 
   	return 0;
   }
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
@@ -1989,7 +1986,7 @@ static int vangogh_post_smu_init(struct

smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static int vangogh_post_smu_init(struct · line 1993

Quoted 5 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -1
   		adev->gfx.config.max_sh_per_se *
 adev->gfx.config.max_shader_engines;
 
   	/* allow message will be sent after enable message on Vangogh*/
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_GFXCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static int vangogh_post_smu_init(struct · line 1990

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_GFXCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static int vangogh_post_smu_init(struct · line 1992

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
   			(adev->pg_flags & AMD_PG_SUPPORT_GFX_PG)) {
   		ret = smu_cmn_send_smc_msg(smu,

SMU_MSG_EnableGfxOff, NULL);

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c int smu_v13_0_system_features_control(struct

Quoted 7 lines
   		if (ret) {
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -0
index 1754a3720179..c5d354175675 100644
@@ -774,7 +774,6 @@ int smu_v13_0_system_features_control(struct

smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c int smu_v13_0_system_features_control(struct · line 779

Quoted 7 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -1
   		return ret;
 
   	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
   	if (en) {
   		ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);

@@ -783,8

Quoted 4 lines

+782,6 @@ int smu_v13_0_system_features_control(struct smu_context *smu,

   		bitmap_copy(feature->enabled, (unsigned long

*)&feature_mask,

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

Quoted 2 lines
   			    feature->feature_num);
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -1
-		bitmap_copy(feature->supported, (unsigned long

*)&feature_mask,

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c smu_v13_0_auto_fan_control(struct

Quoted 5 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -1
-			    feature->feature_num);
   	}
 
   	return ret;
@@ -1071,7 +1068,7 @@ smu_v13_0_auto_fan_control(struct

smu_context *smu, bool auto_fan_control)

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c smu_v13_0_auto_fan_control(struct · line 1074

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -1
   {
   	int ret = 0;
 
-	if (!smu_cmn_feature_is_supported(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c smu_v13_0_auto_fan_control(struct · line 1071

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +1 -0
+	if (!smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c smu_v13_0_auto_fan_control(struct · line 1074

Quoted 3 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -0
   		return 0;
 
   	ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_FAN_CONTROL_BIT,

drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c static int

Quoted 7 lines

auto_fan_control); diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c index f425827e2361..e9172622c0c4 100644

drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -0
@@ -204,7 +204,6 @@ static int

yellow_carp_system_features_control(struct smu_context *smu, bool en)

drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c static int · line 204

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -0
   		ret = smu_cmn_send_smc_msg(smu,

SMU_MSG_PrepareMp1ForUnload,

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c int smu_cmn_to_asic_specific_index(struct

Quoted 23 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -1
 NULL);
 
   	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
   	if (!en)
   		return ret;
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -2
@@ -215,8 +214,6 @@ static int
 yellow_carp_system_features_control(struct smu_context *smu, bool en)
 
   	bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
   		    feature->feature_num);
-	bitmap_copy(feature->supported, (unsigned long *)&feature_mask,
-		    feature->feature_num);
 
   	return 0;
   }
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0 -0
index 50164ebed1cd..49bcabe9d708 100644
@@ -476,23 +476,6 @@ int smu_cmn_to_asic_specific_index(struct

smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c int smu_cmn_to_asic_specific_index(struct smu_context *smu, · line 490

Quoted 11 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0 -8
   	}
   }
 
-int smu_cmn_feature_is_supported(struct smu_context *smu,
-				 enum smu_feature_mask mask)
-{
-	struct smu_feature *feature = &smu->smu_feature;
-	int feature_id;
-
-	feature_id = smu_cmn_to_asic_specific_index(smu,
-

CMN2ASIC_MAPPING_FEATURE,

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h int smu_cmn_to_asic_specific_index(struct

Quoted 18 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0 -9
-						    mask);
-	if (feature_id < 0)
-		return 0;
-
-	WARN_ON(feature_id > feature->feature_num);
-
-	return test_bit(feature_id, feature->supported);
-}
-
   int smu_cmn_feature_is_enabled(struct smu_context *smu,
   			       enum smu_feature_mask mask)
   {
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h +0 -0
index 4e34c18c6063..19919182260a 100644
@@ -48,9 +48,6 @@ int smu_cmn_to_asic_specific_index(struct

smu_context *smu,

Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h +0 -3
   				   enum smu_cmn2asic_mapping_type type,
   				   uint32_t index);
 
-int smu_cmn_feature_is_supported(struct smu_context *smu,
-				 enum smu_feature_mask mask);
-
   int smu_cmn_feature_is_enabled(struct smu_context *smu,
   			       enum smu_feature_mask mask);
 
author
#6 lore raw

RE: [PATCH 3/7] drm/amd/pm: drop the redundant 'supported' member of smu_feature structure

[AMD Official Use Only]

Quoted 55 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, January 21, 2022 5:37 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH 3/7] drm/amd/pm: drop the redundant 'supported' member of smu_feature structure

Quoted 24 lines · Evan

[AMD Official Use Only]

Quoted 20 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, January 21, 2022 4:52 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH 3/7] drm/amd/pm: drop the redundant 'supported' member of smu_feature structure

Quoted 3 lines · Evan Quan

As it has exactly the same value as the 'enabled' member and also do the same thing.

I believe the original intention is different. We need to cache the features which are really supported by PMFW on that device on init. When a request comes through sysfs node for enable/disable of a feature, we should check against this and disallow those which are not

supported.

Quoted 1 line

[Quan, Evan] Uh, I doubt it was designed with such intention. As if it was,

there should be checks in ->get_allowed_feature_mask(e.g. navi10_get_allowed_feature_mask) whether driver tries to enable/disable different features from PMFW.

Quoted 1 line

" When a request comes through sysfs node for enable/disable of a

feature" If the sysfs node mentioned is "pp_features", I might be able to provide some insights why there is no such checks added when I made them. Considering there may be some dependency between those dpm features(e.g. gfx ulv depends on gfx dpm), we actually cannot guard user whether their settings will succeed. E.g. If PMFW supports both GFX ULV and DPM but user wants ULV only, the checks against pmfw supported features seem fine. But actually that cannot work due to the dependency between them. So, instead of applying some checks which actually cannot guard anything, we just let user take the risks.

Quoted 1 line

Below is one example

Quoted 9 lines

Review

Quoted 1 line
(quoted diff) +0 -1
-	if (!smu_cmn_feature_is_supported(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

Review

Quoted 1 line
(quoted diff) +1 -0
+	if (!smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

Let's say user switched to manual mode, that time we disable fan control and move to manual mode. Next time when user requests auto mode, we check if fan control is originally supported on that platform and switch to auto.

[Quan, Evan] Logically yes. But in reality I assume this should not happen. As during our post-silicon bringup, we enable those features(and corresponding sysfs interfaces)support only after verified. It means if the feature(auto fan control) is not supported, the sysfs interface should be not visible to user.

Quoted 4 lines

Either way, we should cache the features which are originally supported on the platform (through a combination of PPTable features and allowed feature masks on ASICs which are applicable) and disallow anything outside of that.

[Quan, Evan] Although I doubt the necessity of such cache. But I do keep a structure member "feature->allowed" which does the similar job. It may be more reasonable to expand its scope to handle the job described here.

BR
Evan

Quoted 459 lines

Thanks,
Lijo

Quoted 14 lines

BR
Evan

Quoted 12 lines

Thanks,
Lijo

Quoted 8 lines
Change-Id I07c9a5ac5290cd0d88a40ce1768d393156419b5a
---
   drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     |  1 -
   drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  1 -
   .../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c   |  8 ++++----
   .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c   | 10 +++++-----
   .../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c    | 19 ++++++++---

----

Quoted 156 lines
Quoted 156 lines

----

Quoted 39 lines
   .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  |  5 +----
   .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c    |  5 +----
   .../drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c  |  3 ---
   drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c        | 17 -----------------
   drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h        |  3 ---
   10 files changed, 19 insertions(+), 53 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -1
index 5ace30434e60..d3237b89f2c5 100644
@@ -949,7 +949,6 @@ static int smu_sw_init(void *handle)
 
   	smu->pool_size = adev->pm.smu_prv_buffer_size;
   	smu->smu_feature.feature_num = SMU_FEATURE_MAX;
-	bitmap_zero(smu->smu_feature.supported, SMU_FEATURE_MAX);
   	bitmap_zero(smu->smu_feature.enabled, SMU_FEATURE_MAX);
   	bitmap_zero(smu->smu_feature.allowed, SMU_FEATURE_MAX);
 
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -1
index 18f24db7d202..3c0360772822 100644
@@ -388,7 +388,6 @@ struct smu_power_context {
   struct smu_feature
   {
   	uint32_t feature_num;
-	DECLARE_BITMAP(supported, SMU_FEATURE_MAX);
   	DECLARE_BITMAP(allowed, SMU_FEATURE_MAX);
   	DECLARE_BITMAP(enabled, SMU_FEATURE_MAX);
   };
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -0
index 84834c24a7e9..9fb290f9aaeb 100644
@@ -1625,8 +1625,8 @@ static int
Quoted 1 line

navi10_display_config_changed(struct

smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c

Quoted 4 lines
   	int ret = 0;
   	if ((smu->watermarks_bitmap & WATERMARKS_EXIST) &&
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -1
-	    smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -1
-	    smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_SOCCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -0
+	    smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -0
+	    smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_SOCCLK_BIT)) {

Quoted 1 line

ret = smu_cmn_send_smc_msg_with_param(smu,

SMU_MSG_NumOfDisplays,

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int

Quoted 4 lines
   						  smu->display_config-

num_display,
NULL);

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -0
@@ -1864,13 +1864,13 @@ static int

navi10_notify_smc_display_config(struct smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int · line 1869

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -1
   	min_clocks.dcef_clock_in_sr = smu->display_config-
 min_dcef_deep_sleep_set_clk;
   	min_clocks.memory_clock = smu->display_config-
 min_mem_set_clock;
 
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int · line 1869

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int navi10_notify_smc_display_config(struct smu_context *smu)

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -0
   		clock_req.clock_type = amd_pp_dcef_clock;
   		clock_req.clock_freq_in_khz = min_clocks.dcef_clock * 10;
 
   		ret = smu_v11_0_display_clock_voltage_request(smu,

&clock_req);

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int · line 1875

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -1
   		if (!ret) {
-			if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int · line 1875

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -0
+			if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int · line 1876

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -0
   				ret =

smu_cmn_send_smc_msg_with_param(smu,

Quoted 1 line

SMU_MSG_SetMinDeepSleepDcefclk,

Quoted 1 line

min_clocks.dcef_clock_in_sr/100, diff --git

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int

Quoted 6 lines

a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c index 651fe748e423..d568d6137a00 100644

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -0
@@ -1281,8 +1281,8 @@ static int

sienna_cichlid_display_config_changed(struct smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int · line 1284

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -1
   	int ret = 0;
 
   	if ((smu->watermarks_bitmap & WATERMARKS_EXIST) &&
-	    smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int · line 1285

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -1
-	    smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_SOCCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int · line 1284

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
+	    smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int · line 1285

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
+	    smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_SOCCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int · line 1287

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -0
   #if 0
   		ret = smu_cmn_send_smc_msg_with_param(smu,

SMU_MSG_NumOfDisplays,

Quoted 3 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -0
   						  smu->display_config-

num_display, @@ -1521,13 +1521,13 @@ static int sienna_cichlid_notify_smc_display_config(struct smu_context

*smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 6 lines
   	min_clocks.dcef_clock_in_sr = smu->display_config-
min_dcef_deep_sleep_set_clk;
   	min_clocks.memory_clock = smu->display_config-

min_mem_set_clock;

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT)) {

Quoted 4 lines
   		clock_req.clock_type = amd_pp_dcef_clock;
   		clock_req.clock_freq_in_khz = min_clocks.dcef_clock * 10;

ret = smu_v11_0_display_clock_voltage_request(smu,

&clock_req);

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 2 lines
   		if (!ret) {
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -1
-			if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
+			if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_DCEFCLK_BIT)) {

Quoted 1 line

ret =

smu_cmn_send_smc_msg_with_param(smu,

Quoted 1 line

SMU_MSG_SetMinDeepSleepDcefclk,

Quoted 1 line

min_clocks.dcef_clock_in_sr/100, @@ -3752,7 +3752,7 @@

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 5 lines

static int sienna_cichlid_gpo_control(struct smu_context *smu,
int ret = 0;

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_GFX_GPO_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_GFX_GPO_BIT)) {

Quoted 1 line

ret = smu_cmn_get_smc_version(smu, NULL,

&smu_version);

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_system_features_control(struct

Quoted 8 lines
   		if (ret)
   			return ret;
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
index b58a4c2823c2..b69c2ecc8e25 100644
@@ -808,7 +808,6 @@ int smu_v11_0_system_features_control(struct

smu_context *smu,

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
   		return ret;
 
Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_system_features_control(struct smu_context *smu, · line 813

Quoted 5 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
   	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
   	if (en) {
   		ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);

@@ -817,8

Quoted 1 line

+816,6 @@ int smu_v11_0_system_features_control(struct

smu_context

Quoted 168 lines
Quoted 168 lines
Quoted 3 lines

*smu,

   		bitmap_copy(feature->enabled, (unsigned long

*)&feature_mask,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 2 lines
   			    feature->feature_num);
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-		bitmap_copy(feature->supported, (unsigned long

*)&feature_mask,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c smu_v11_0_auto_fan_control(struct

Quoted 5 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-			    feature->feature_num);
   	}
 
   	return ret;
@@ -1186,7 +1183,7 @@ smu_v11_0_auto_fan_control(struct

smu_context *smu, bool auto_fan_control)

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c smu_v11_0_auto_fan_control(struct smu_context *smu, bool auto_fan_control)

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
   {
   	int ret = 0;
 
-	if (!smu_cmn_feature_is_supported(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c smu_v11_0_auto_fan_control(struct · line 1186

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (!smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c smu_v11_0_auto_fan_control(struct smu_context *smu, bool auto_fan_control)

Quoted 3 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
   		return 0;
 
   	ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_FAN_CONTROL_BIT,

Quoted 1 line

auto_fan_control); @@ -1607,7 +1604,7 @@ bool

smu_v11_0_baco_is_support(struct smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 4 lines
   		return false;

   	/* Arcturus does not support this bit mask */
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_BACO_BIT)

&&

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT)

&&

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_gfx_ulv_control(struct

Quoted 4 lines
   	   !smu_cmn_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT))
   		return false;
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
@@ -2150,7 +2147,7 @@ int smu_v11_0_gfx_ulv_control(struct

smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c smu_v11_0_auto_fan_control(struct smu_context *smu, bool auto_fan_control)

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
   {
   	int ret = 0;
 
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_GFX_ULV_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_gfx_ulv_control(struct · line 2150

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_GFX_ULV_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_gfx_ulv_control(struct · line 2151

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
   		ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_GFX_ULV_BIT,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_deep_sleep_control(struct

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
 enablement);
 
   	return ret;
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
@@ -2162,7 +2159,7 @@ int smu_v11_0_deep_sleep_control(struct

smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_deep_sleep_control(struct smu_context *smu,

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
   	struct amdgpu_device *adev = smu->adev;
   	int ret = 0;
 
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_GFXCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_deep_sleep_control(struct · line 2162

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_GFXCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_deep_sleep_control(struct · line 2163

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
   		ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_DS_GFXCLK_BIT, enablement);

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_deep_sleep_control(struct · line 2165

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
   		if (ret) {
   			dev_err(adev->dev, "Failed to %s GFXCLK DS!\n",

enablement ?

Quoted 1 line

"enable" : "disable"); @@ -2170,7 +2167,7 @@ int

smu_v11_0_deep_sleep_control(struct smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 4 lines
   		}
   	}
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_UCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_UCLK_BIT)) {

Quoted 1 line

ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_DS_UCLK_BIT, enablement);

Quoted 2 lines
   		if (ret) {
   			dev_err(adev->dev, "Failed to %s UCLK DS!\n",

enablement ?

Quoted 1 line

"enable" : "disable"); @@ -2178,7 +2175,7 @@ int

smu_v11_0_deep_sleep_control(struct smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 4 lines
   		}
   	}
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_FCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_FCLK_BIT)) {

Quoted 1 line

ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_DS_FCLK_BIT, enablement);

Quoted 2 lines
   		if (ret) {
   			dev_err(adev->dev, "Failed to %s FCLK DS!\n",

enablement ?

Quoted 1 line

"enable" : "disable"); @@ -2186,7 +2183,7 @@ int

smu_v11_0_deep_sleep_control(struct smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 4 lines
   		}
   	}
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_SOCCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_SOCCLK_BIT)) {

Quoted 1 line

ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_DS_SOCCLK_BIT, enablement);

Quoted 2 lines
   		if (ret) {
   			dev_err(adev->dev, "Failed to %s SOCCLK DS!\n",

enablement ?

Quoted 1 line

"enable" : "disable"); @@ -2194,7 +2191,7 @@ int

smu_v11_0_deep_sleep_control(struct smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 4 lines
   		}
   	}
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_LCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_LCLK_BIT)) {

Quoted 1 line

ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_DS_LCLK_BIT, enablement);

Quoted 2 lines
   		if (ret) {
   			dev_err(adev->dev, "Failed to %s LCLK DS!\n",

enablement ?

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static int

Quoted 7 lines

"enable" : "disable"); diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c index b4a3c9b8b54e..e72831aa4859 100644

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
@@ -1960,7 +1960,6 @@ static int

vangogh_system_features_control(struct smu_context *smu, bool en)

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static int vangogh_post_smu_init(struct

Quoted 18 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -3
   						      RLC_STATUS_OFF, NULL);
 
   	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
   	if (!en)
   		return ret;
@@ -1971,8 +1970,6 @@ static int
 vangogh_system_features_control(struct smu_context *smu, bool en)
 
   	bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
   		    feature->feature_num);
-	bitmap_copy(feature->supported, (unsigned long *)&feature_mask,
-		    feature->feature_num);
 
   	return 0;
   }
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
@@ -1989,7 +1986,7 @@ static int vangogh_post_smu_init(struct

smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static int vangogh_post_smu_init(struct · line 1993

Quoted 5 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -1
   		adev->gfx.config.max_sh_per_se *
 adev->gfx.config.max_shader_engines;
 
   	/* allow message will be sent after enable message on Vangogh*/
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_GFXCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static int vangogh_post_smu_init(struct · line 1990

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_GFXCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static int vangogh_post_smu_init(struct · line 1992

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
   			(adev->pg_flags & AMD_PG_SUPPORT_GFX_PG)) {
   		ret = smu_cmn_send_smc_msg(smu,

SMU_MSG_EnableGfxOff, NULL);

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c int smu_v13_0_system_features_control(struct

Quoted 7 lines
   		if (ret) {
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -0
index 1754a3720179..c5d354175675 100644
@@ -774,7 +774,6 @@ int smu_v13_0_system_features_control(struct

smu_context *smu,

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -0
   		return ret;
 
Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c int smu_v13_0_system_features_control(struct · line 779

Quoted 5 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -1
   	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
   	if (en) {
   		ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);

@@ -783,8

Quoted 1 line

+782,6 @@ int smu_v13_0_system_features_control(struct

smu_context

Quoted 100 lines
Quoted 100 lines
Quoted 3 lines

*smu,

   		bitmap_copy(feature->enabled, (unsigned long

*)&feature_mask,

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

Quoted 2 lines
   			    feature->feature_num);
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -1
-		bitmap_copy(feature->supported, (unsigned long

*)&feature_mask,

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c smu_v13_0_auto_fan_control(struct

Quoted 5 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -1
-			    feature->feature_num);
   	}
 
   	return ret;
@@ -1071,7 +1068,7 @@ smu_v13_0_auto_fan_control(struct

smu_context *smu, bool auto_fan_control)

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c smu_v13_0_auto_fan_control(struct · line 1074

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -1
   {
   	int ret = 0;
 
-	if (!smu_cmn_feature_is_supported(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c smu_v13_0_auto_fan_control(struct · line 1071

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +1 -0
+	if (!smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c smu_v13_0_auto_fan_control(struct · line 1074

Quoted 3 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -0
   		return 0;
 
   	ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_FAN_CONTROL_BIT,

drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c static int

Quoted 7 lines

auto_fan_control); diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c index f425827e2361..e9172622c0c4 100644

drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -0
@@ -204,7 +204,6 @@ static int

yellow_carp_system_features_control(struct smu_context *smu, bool en)

drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c static int · line 204

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -0
   		ret = smu_cmn_send_smc_msg(smu,

SMU_MSG_PrepareMp1ForUnload,

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c int smu_cmn_to_asic_specific_index(struct

Quoted 24 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -1
 NULL);
 
   	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
   	if (!en)
   		return ret;
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -0
@@ -215,8 +214,6 @@ static int

yellow_carp_system_features_control(struct smu_context *smu, bool en)

   	bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
   		    feature->feature_num);
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -2
-	bitmap_copy(feature->supported, (unsigned long *)&feature_mask,
-		    feature->feature_num);
 
   	return 0;
   }
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0 -0
index 50164ebed1cd..49bcabe9d708 100644
@@ -476,23 +476,6 @@ int smu_cmn_to_asic_specific_index(struct

smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c int smu_cmn_to_asic_specific_index(struct smu_context *smu, · line 490

Quoted 11 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0 -8
   	}
   }
 
-int smu_cmn_feature_is_supported(struct smu_context *smu,
-				 enum smu_feature_mask mask)
-{
-	struct smu_feature *feature = &smu->smu_feature;
-	int feature_id;
-
-	feature_id = smu_cmn_to_asic_specific_index(smu,
-

CMN2ASIC_MAPPING_FEATURE,

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h int smu_cmn_to_asic_specific_index(struct

Quoted 18 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0 -9
-						    mask);
-	if (feature_id < 0)
-		return 0;
-
-	WARN_ON(feature_id > feature->feature_num);
-
-	return test_bit(feature_id, feature->supported);
-}
-
   int smu_cmn_feature_is_enabled(struct smu_context *smu,
   			       enum smu_feature_mask mask)
   {
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h +0 -0
index 4e34c18c6063..19919182260a 100644
@@ -48,9 +48,6 @@ int smu_cmn_to_asic_specific_index(struct

smu_context *smu,

Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h +0 -3
   				   enum smu_cmn2asic_mapping_type type,
   				   uint32_t index);
 
-int smu_cmn_feature_is_supported(struct smu_context *smu,
-				 enum smu_feature_mask mask);
-
   int smu_cmn_feature_is_enabled(struct smu_context *smu,
   			       enum smu_feature_mask mask);
 
#7 lore raw

Re: [PATCH 3/7] drm/amd/pm: drop the redundant 'supported' member of smu_feature structure

Quoted 64 lines · Evan

[AMD Official Use Only]

Quoted 60 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, January 21, 2022 5:37 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH 3/7] drm/amd/pm: drop the redundant 'supported' member of smu_feature structure

Quoted 24 lines · Evan

[AMD Official Use Only]

Quoted 20 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, January 21, 2022 4:52 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH 3/7] drm/amd/pm: drop the redundant 'supported' member of smu_feature structure

Quoted 3 lines · Evan Quan

As it has exactly the same value as the 'enabled' member and also do the same thing.

I believe the original intention is different. We need to cache the features which are really supported by PMFW on that device on init. When a request comes through sysfs node for enable/disable of a feature, we should check against this and disallow those which are not

supported.

Quoted 1 line

[Quan, Evan] Uh, I doubt it was designed with such intention. As if it was,

there should be checks in ->get_allowed_feature_mask(e.g. navi10_get_allowed_feature_mask) whether driver tries to enable/disable different features from PMFW.

Quoted 1 line

" When a request comes through sysfs node for enable/disable of a

feature" If the sysfs node mentioned is "pp_features", I might be able to provide some insights why there is no such checks added when I made them. Considering there may be some dependency between those dpm features(e.g. gfx ulv depends on gfx dpm), we actually cannot guard user whether their settings will succeed. E.g. If PMFW supports both GFX ULV and DPM but user wants ULV only, the checks against pmfw supported features seem fine. But actually that cannot work due to the dependency between them. So, instead of applying some checks which actually cannot guard anything, we just let user take the risks.

Quoted 1 line

Below is one example

Review

Quoted 1 line
(quoted diff) +0 -1
-	if (!smu_cmn_feature_is_supported(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

Review

Quoted 1 line
(quoted diff) +1 -0
+	if (!smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

Quoted 7 lines
Quoted 4 lines

Let's say user switched to manual mode, that time we disable fan control and move to manual mode. Next time when user requests auto mode, we check if fan control is originally supported on that platform and switch to auto.

[Quan, Evan] Logically yes. But in reality I assume this should not happen. As during our post-silicon bringup, we enable those features(and corresponding sysfs interfaces)support only after verified. It means if the feature(auto fan control) is not supported, the sysfs interface should be not visible to user.

Well, there are multiple examples -

                        amdgpu_asic_update_umd_stable_pstate(smu->adev, 
false);
                        smu_deep_sleep_control(smu, true);
                        smu_gfx_ulv_control(smu, true);
                        smu_gpo_control(smu, true);

This is yet another one. Some aspects are disabled while umd profiling and then they are enabled back when it's back to FW control. This is internal logic and it could be disastrous if we try to enable a feature without checking if it's really supported on production SKUs.

Quoted 7 lines
Quoted 4 lines

Either way, we should cache the features which are originally supported on the platform (through a combination of PPTable features and allowed feature masks on ASICs which are applicable) and disallow anything outside of that.

[Quan, Evan] Although I doubt the necessity of such cache. But I do keep a structure member "feature->allowed" which does the similar job. It may be more reasonable to expand its scope to handle the job described here.

It would be needed for both internal and external interfaces, I strongly suggest to keep it. The name 'supported' is more intuitive and 'allowed feature' concept from PMFW is not there for all ASICs, though I don't mind the name anyway.

Thanks,
Lijo

Quoted 461 lines

BR
Evan

Quoted 459 lines

Thanks,
Lijo

Quoted 14 lines

BR
Evan

Quoted 12 lines

Thanks,
Lijo

Quoted 8 lines
Change-Id I07c9a5ac5290cd0d88a40ce1768d393156419b5a
---
    drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     |  1 -
    drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  1 -
    .../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c   |  8 ++++----
    .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c   | 10 +++++-----
    .../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c    | 19 ++++++++---

----

Quoted 156 lines
Quoted 156 lines

----

Quoted 39 lines
    .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  |  5 +----
    .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c    |  5 +----
    .../drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c  |  3 ---
    drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c        | 17 -----------------
    drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h        |  3 ---
    10 files changed, 19 insertions(+), 53 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -1
index 5ace30434e60..d3237b89f2c5 100644
@@ -949,7 +949,6 @@ static int smu_sw_init(void *handle)
 
    	smu->pool_size = adev->pm.smu_prv_buffer_size;
    	smu->smu_feature.feature_num = SMU_FEATURE_MAX;
-	bitmap_zero(smu->smu_feature.supported, SMU_FEATURE_MAX);
    	bitmap_zero(smu->smu_feature.enabled, SMU_FEATURE_MAX);
    	bitmap_zero(smu->smu_feature.allowed, SMU_FEATURE_MAX);
 
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -1
index 18f24db7d202..3c0360772822 100644
@@ -388,7 +388,6 @@ struct smu_power_context {
    struct smu_feature
    {
    	uint32_t feature_num;
-	DECLARE_BITMAP(supported, SMU_FEATURE_MAX);
    	DECLARE_BITMAP(allowed, SMU_FEATURE_MAX);
    	DECLARE_BITMAP(enabled, SMU_FEATURE_MAX);
    };
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -0
index 84834c24a7e9..9fb290f9aaeb 100644
@@ -1625,8 +1625,8 @@ static int
Quoted 1 line

navi10_display_config_changed(struct

smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c

Quoted 4 lines
    	int ret = 0;

    	if ((smu->watermarks_bitmap & WATERMARKS_EXIST) &&
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -1
-	    smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -1
-	    smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_SOCCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -0
+	    smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -0
+	    smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_SOCCLK_BIT)) {

Quoted 1 line

ret = smu_cmn_send_smc_msg_with_param(smu,

SMU_MSG_NumOfDisplays,

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int

Quoted 4 lines
    						  smu->display_config-
num_display,
    						  NULL);
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -0
@@ -1864,13 +1864,13 @@ static int

navi10_notify_smc_display_config(struct smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int · line 1869

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -1
    	min_clocks.dcef_clock_in_sr = smu->display_config-
 min_dcef_deep_sleep_set_clk;
    	min_clocks.memory_clock = smu->display_config-
 min_mem_set_clock;
 
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int · line 1869

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int navi10_notify_smc_display_config(struct smu_context *smu)

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -0
    		clock_req.clock_type = amd_pp_dcef_clock;
    		clock_req.clock_freq_in_khz = min_clocks.dcef_clock * 10;
 
    		ret = smu_v11_0_display_clock_voltage_request(smu,

&clock_req);

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int · line 1875

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -1
    		if (!ret) {
-			if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int · line 1875

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -0
+			if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int · line 1876

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -0
    				ret =

smu_cmn_send_smc_msg_with_param(smu,

Quoted 1 line

SMU_MSG_SetMinDeepSleepDcefclk,

Quoted 1 line

min_clocks.dcef_clock_in_sr/100, diff --git

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int

Quoted 6 lines

a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c index 651fe748e423..d568d6137a00 100644

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -0
@@ -1281,8 +1281,8 @@ static int

sienna_cichlid_display_config_changed(struct smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int · line 1284

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -1
    	int ret = 0;
 
    	if ((smu->watermarks_bitmap & WATERMARKS_EXIST) &&
-	    smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int · line 1285

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -1
-	    smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_SOCCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int · line 1284

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
+	    smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int · line 1285

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
+	    smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_SOCCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int · line 1287

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -0
    #if 0
    		ret = smu_cmn_send_smc_msg_with_param(smu,

SMU_MSG_NumOfDisplays,

Quoted 3 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -0
    						  smu->display_config-

num_display, @@ -1521,13 +1521,13 @@ static int sienna_cichlid_notify_smc_display_config(struct smu_context

*smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 6 lines
    	min_clocks.dcef_clock_in_sr = smu->display_config-
min_dcef_deep_sleep_set_clk;
    	min_clocks.memory_clock = smu->display_config-

min_mem_set_clock;

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT)) {

Quoted 4 lines
    		clock_req.clock_type = amd_pp_dcef_clock;
    		clock_req.clock_freq_in_khz = min_clocks.dcef_clock * 10;

    		ret = smu_v11_0_display_clock_voltage_request(smu,

&clock_req);

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 2 lines
    		if (!ret) {
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -1
-			if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
+			if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_DCEFCLK_BIT)) {

Quoted 1 line

ret =

smu_cmn_send_smc_msg_with_param(smu,

Quoted 1 line

SMU_MSG_SetMinDeepSleepDcefclk,

Quoted 1 line

min_clocks.dcef_clock_in_sr/100, @@ -3752,7 +3752,7 @@

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 5 lines

static int sienna_cichlid_gpo_control(struct smu_context *smu,

    	int ret = 0;
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_GFX_GPO_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_GFX_GPO_BIT)) {

Quoted 1 line

ret = smu_cmn_get_smc_version(smu, NULL,

&smu_version);

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_system_features_control(struct

Quoted 8 lines
    		if (ret)
    			return ret;
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
index b58a4c2823c2..b69c2ecc8e25 100644
@@ -808,7 +808,6 @@ int smu_v11_0_system_features_control(struct

smu_context *smu,

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
    		return ret;
 
Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_system_features_control(struct smu_context *smu, · line 813

Quoted 5 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
    	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
    	if (en) {
    		ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);

@@ -817,8

Quoted 1 line

+816,6 @@ int smu_v11_0_system_features_control(struct

smu_context

Quoted 168 lines
Quoted 168 lines
Quoted 3 lines

*smu,

    		bitmap_copy(feature->enabled, (unsigned long

*)&feature_mask,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 2 lines
    			    feature->feature_num);
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-		bitmap_copy(feature->supported, (unsigned long

*)&feature_mask,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c smu_v11_0_auto_fan_control(struct

Quoted 5 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-			    feature->feature_num);
    	}
 
    	return ret;
@@ -1186,7 +1183,7 @@ smu_v11_0_auto_fan_control(struct

smu_context *smu, bool auto_fan_control)

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c smu_v11_0_auto_fan_control(struct smu_context *smu, bool auto_fan_control)

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
    {
    	int ret = 0;
 
-	if (!smu_cmn_feature_is_supported(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c smu_v11_0_auto_fan_control(struct · line 1186

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (!smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c smu_v11_0_auto_fan_control(struct smu_context *smu, bool auto_fan_control)

Quoted 3 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
    		return 0;
 
    	ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_FAN_CONTROL_BIT,

Quoted 1 line

auto_fan_control); @@ -1607,7 +1604,7 @@ bool

smu_v11_0_baco_is_support(struct smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 4 lines
    		return false;

    	/* Arcturus does not support this bit mask */
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-	if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_BACO_BIT)

&&

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT)

&&

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_gfx_ulv_control(struct

Quoted 4 lines
    	   !smu_cmn_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT))
    		return false;
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
@@ -2150,7 +2147,7 @@ int smu_v11_0_gfx_ulv_control(struct

smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c smu_v11_0_auto_fan_control(struct smu_context *smu, bool auto_fan_control)

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
    {
    	int ret = 0;
 
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_GFX_ULV_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_gfx_ulv_control(struct · line 2150

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_GFX_ULV_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_gfx_ulv_control(struct · line 2151

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
    		ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_GFX_ULV_BIT,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_deep_sleep_control(struct

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
 enablement);
 
    	return ret;
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
@@ -2162,7 +2159,7 @@ int smu_v11_0_deep_sleep_control(struct

smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_deep_sleep_control(struct smu_context *smu,

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
    	struct amdgpu_device *adev = smu->adev;
    	int ret = 0;
 
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_GFXCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_deep_sleep_control(struct · line 2162

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_GFXCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_deep_sleep_control(struct · line 2163

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
    		ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_DS_GFXCLK_BIT, enablement);

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_deep_sleep_control(struct · line 2165

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
    		if (ret) {
    			dev_err(adev->dev, "Failed to %s GFXCLK DS!\n",

enablement ?

Quoted 1 line

"enable" : "disable"); @@ -2170,7 +2167,7 @@ int

smu_v11_0_deep_sleep_control(struct smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 4 lines
    		}
    	}
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_UCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_UCLK_BIT)) {

Quoted 1 line

ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_DS_UCLK_BIT, enablement);

Quoted 2 lines
    		if (ret) {
    			dev_err(adev->dev, "Failed to %s UCLK DS!\n",

enablement ?

Quoted 1 line

"enable" : "disable"); @@ -2178,7 +2175,7 @@ int

smu_v11_0_deep_sleep_control(struct smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 4 lines
    		}
    	}
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_FCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_FCLK_BIT)) {

Quoted 1 line

ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_DS_FCLK_BIT, enablement);

Quoted 2 lines
    		if (ret) {
    			dev_err(adev->dev, "Failed to %s FCLK DS!\n",

enablement ?

Quoted 1 line

"enable" : "disable"); @@ -2186,7 +2183,7 @@ int

smu_v11_0_deep_sleep_control(struct smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 4 lines
    		}
    	}
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_SOCCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_SOCCLK_BIT)) {

Quoted 1 line

ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_DS_SOCCLK_BIT, enablement);

Quoted 2 lines
    		if (ret) {
    			dev_err(adev->dev, "Failed to %s SOCCLK DS!\n",

enablement ?

Quoted 1 line

"enable" : "disable"); @@ -2194,7 +2191,7 @@ int

smu_v11_0_deep_sleep_control(struct smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 4 lines
    		}
    	}
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_LCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_LCLK_BIT)) {

Quoted 1 line

ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_DS_LCLK_BIT, enablement);

Quoted 2 lines
    		if (ret) {
    			dev_err(adev->dev, "Failed to %s LCLK DS!\n",

enablement ?

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static int

Quoted 7 lines

"enable" : "disable"); diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c index b4a3c9b8b54e..e72831aa4859 100644

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
@@ -1960,7 +1960,6 @@ static int

vangogh_system_features_control(struct smu_context *smu, bool en)

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static int vangogh_post_smu_init(struct

Quoted 18 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -3
    						      RLC_STATUS_OFF, NULL);
 
    	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
    	if (!en)
    		return ret;
@@ -1971,8 +1970,6 @@ static int
 vangogh_system_features_control(struct smu_context *smu, bool en)
 
    	bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
    		    feature->feature_num);
-	bitmap_copy(feature->supported, (unsigned long *)&feature_mask,
-		    feature->feature_num);
 
    	return 0;
    }
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
@@ -1989,7 +1986,7 @@ static int vangogh_post_smu_init(struct

smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static int vangogh_post_smu_init(struct · line 1993

Quoted 5 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -1
    		adev->gfx.config.max_sh_per_se *
 adev->gfx.config.max_shader_engines;
 
    	/* allow message will be sent after enable message on Vangogh*/
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_GFXCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static int vangogh_post_smu_init(struct · line 1990

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_GFXCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static int vangogh_post_smu_init(struct · line 1992

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
    			(adev->pg_flags & AMD_PG_SUPPORT_GFX_PG)) {
    		ret = smu_cmn_send_smc_msg(smu,

SMU_MSG_EnableGfxOff, NULL);

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c int smu_v13_0_system_features_control(struct

Quoted 7 lines
    		if (ret) {
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -0
index 1754a3720179..c5d354175675 100644
@@ -774,7 +774,6 @@ int smu_v13_0_system_features_control(struct

smu_context *smu,

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -0
    		return ret;
 
Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c int smu_v13_0_system_features_control(struct · line 779

Quoted 5 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -1
    	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
    	if (en) {
    		ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);

@@ -783,8

Quoted 1 line

+782,6 @@ int smu_v13_0_system_features_control(struct

smu_context

Quoted 100 lines
Quoted 100 lines
Quoted 3 lines

*smu,

    		bitmap_copy(feature->enabled, (unsigned long

*)&feature_mask,

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

Quoted 2 lines
    			    feature->feature_num);
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -1
-		bitmap_copy(feature->supported, (unsigned long

*)&feature_mask,

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c smu_v13_0_auto_fan_control(struct

Quoted 5 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -1
-			    feature->feature_num);
    	}
 
    	return ret;
@@ -1071,7 +1068,7 @@ smu_v13_0_auto_fan_control(struct

smu_context *smu, bool auto_fan_control)

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c smu_v13_0_auto_fan_control(struct · line 1074

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -1
    {
    	int ret = 0;
 
-	if (!smu_cmn_feature_is_supported(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c smu_v13_0_auto_fan_control(struct · line 1071

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +1 -0
+	if (!smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c smu_v13_0_auto_fan_control(struct · line 1074

Quoted 3 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -0
    		return 0;
 
    	ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_FAN_CONTROL_BIT,

drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c static int

Quoted 7 lines

auto_fan_control); diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c index f425827e2361..e9172622c0c4 100644

drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -0
@@ -204,7 +204,6 @@ static int

yellow_carp_system_features_control(struct smu_context *smu, bool en)

drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c static int · line 204

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -0
    		ret = smu_cmn_send_smc_msg(smu,

SMU_MSG_PrepareMp1ForUnload,

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c int smu_cmn_to_asic_specific_index(struct

Quoted 24 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -1
 NULL);
 
    	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
    	if (!en)
    		return ret;
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -0
@@ -215,8 +214,6 @@ static int

yellow_carp_system_features_control(struct smu_context *smu, bool en)

    	bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
    		    feature->feature_num);
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -2
-	bitmap_copy(feature->supported, (unsigned long *)&feature_mask,
-		    feature->feature_num);
 
    	return 0;
    }
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0 -0
index 50164ebed1cd..49bcabe9d708 100644
@@ -476,23 +476,6 @@ int smu_cmn_to_asic_specific_index(struct

smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c int smu_cmn_to_asic_specific_index(struct smu_context *smu, · line 490

Quoted 11 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0 -8
    	}
    }
 
-int smu_cmn_feature_is_supported(struct smu_context *smu,
-				 enum smu_feature_mask mask)
-{
-	struct smu_feature *feature = &smu->smu_feature;
-	int feature_id;
-
-	feature_id = smu_cmn_to_asic_specific_index(smu,
-

CMN2ASIC_MAPPING_FEATURE,

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h int smu_cmn_to_asic_specific_index(struct

Quoted 18 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0 -9
-						    mask);
-	if (feature_id < 0)
-		return 0;
-
-	WARN_ON(feature_id > feature->feature_num);
-
-	return test_bit(feature_id, feature->supported);
-}
-
    int smu_cmn_feature_is_enabled(struct smu_context *smu,
    			       enum smu_feature_mask mask)
    {
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h +0 -0
index 4e34c18c6063..19919182260a 100644
@@ -48,9 +48,6 @@ int smu_cmn_to_asic_specific_index(struct

smu_context *smu,

Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h +0 -3
    				   enum smu_cmn2asic_mapping_type type,
    				   uint32_t index);
 
-int smu_cmn_feature_is_supported(struct smu_context *smu,
-				 enum smu_feature_mask mask);
-
    int smu_cmn_feature_is_enabled(struct smu_context *smu,
    			       enum smu_feature_mask mask);
 
author
#8 lore raw

RE: [PATCH 3/7] drm/amd/pm: drop the redundant 'supported' member of smu_feature structure

[AMD Official Use Only]

Quoted 112 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Monday, January 24, 2022 1:03 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH 3/7] drm/amd/pm: drop the redundant 'supported' member of smu_feature structure

Quoted 24 lines · Evan

[AMD Official Use Only]

Quoted 20 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, January 21, 2022 5:37 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH 3/7] drm/amd/pm: drop the redundant 'supported' member of smu_feature structure

Quoted 8 lines · Evan

[AMD Official Use Only]

Quoted 4 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, January 21, 2022 4:52 PM
To: Quan, Evan <[email protected]>; amd-

[email protected]

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Cc Deucher, Alexander <[email protected]>; Chen,

Guchun

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

<[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH 3/7] drm/amd/pm: drop the redundant

'supported'

Quoted 15 lines
Quoted 15 lines
Quoted 9 lines
Quoted 9 lines

member of smu_feature structure

Quoted 3 lines · Evan Quan

As it has exactly the same value as the 'enabled' member and also do the same thing.

Quoted 5 lines
Quoted 5 lines

I believe the original intention is different. We need to cache the features which are really supported by PMFW on that device on init. When a request comes through sysfs node for enable/disable of a feature, we should check against this and disallow those which are not

supported.

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

[Quan, Evan] Uh, I doubt it was designed with such intention. As if it was,

there should be checks in ->get_allowed_feature_mask(e.g. navi10_get_allowed_feature_mask) whether driver tries to enable/disable different features from PMFW.

Quoted 1 line

" When a request comes through sysfs node for enable/disable of a

feature" If the sysfs node mentioned is "pp_features", I might be able to provide some insights why there is no such checks added when I

made them.

Quoted 11 lines
Quoted 11 lines

Considering there may be some dependency between those dpm features(e.g. gfx ulv depends on gfx dpm), we actually cannot guard user whether their settings will succeed. E.g. If PMFW supports both GFX ULV and DPM but user wants ULV only, the checks against pmfw supported features seem fine. But actually that cannot work due to the dependency between them. So, instead of applying some checks which actually cannot guard anything, we just let user take the risks.

Quoted 1 line

Below is one example

Quoted 8 lines
Quoted 8 lines

Review

Quoted 1 line
(quoted diff) +0 -1
-	if (!smu_cmn_feature_is_supported(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

Review

Quoted 1 line
(quoted diff) +1 -0
+	if (!smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

Let's say user switched to manual mode, that time we disable fan control and move to manual mode. Next time when user requests auto mode, we check if fan control is originally supported on that platform and

switch to auto.

Quoted 4 lines
Quoted 1 line

[Quan, Evan] Logically yes. But in reality I assume this should not happen. As during our post-silicon bringup, we enable those features(and corresponding sysfs interfaces)support only after verified. It

means if the feature(auto fan control) is not supported, the sysfs interface should be not visible to user.

Well, there are multiple examples -

                         amdgpu_asic_update_umd_stable_pstate(smu->adev,
false);
                         smu_deep_sleep_control(smu, true);
                         smu_gfx_ulv_control(smu, true);
                         smu_gpo_control(smu, true);

This is yet another one. Some aspects are disabled while umd profiling and then they are enabled back when it's back to FW control. This is internal logic and it could be disastrous if we try to enable a feature without checking if it's really supported on production SKUs.

Quoted 5 lines
Quoted 4 lines

Either way, we should cache the features which are originally supported on the platform (through a combination of PPTable features and allowed feature masks on ASICs which are applicable) and disallow anything outside of that.

[Quan, Evan] Although I doubt the necessity of such cache. But I do keep a

structure member "feature->allowed" which does the similar job.

Quoted 8 lines
Quoted 1 line

It may be more reasonable to expand its scope to handle the job described

here.

Quoted 1 line

It would be needed for both internal and external interfaces, I strongly suggest to keep it. The name 'supported' is more intuitive and 'allowed feature' concept from PMFW is not there for all ASICs, though I don't mind the name anyway.

[Quan, Evan] I'm fine to keep it. Please check the new patch series then.

BR
Evan

Quoted 499 lines

Thanks,
Lijo

Quoted 20 lines

BR
Evan

Quoted 18 lines

Thanks,
Lijo

Quoted 14 lines

BR
Evan

Quoted 12 lines

Thanks,
Lijo

Quoted 8 lines
Change-Id I07c9a5ac5290cd0d88a40ce1768d393156419b5a
---
    drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     |  1 -
    drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  1 -
    .../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c   |  8 ++++----
    .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c   | 10 +++++-----
    .../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c    | 19

++++++++---

Quoted 6 lines
Quoted 6 lines

----

Quoted 5 lines
Quoted 5 lines

----

Quoted 4 lines
    .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  |  5 +----
    .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c    |  5 +----
    .../drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c  |  3 ---
    drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c        | 17 ---------------

--

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
    drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h        |  3 ---
    10 files changed, 19 insertions(+), 53 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -0
index 5ace30434e60..d3237b89f2c5 100644
@@ -949,7 +949,6 @@ static int smu_sw_init(void *handle)
 
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_sw_init(void *handle)

Quoted 3 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -1
    	smu->pool_size = adev->pm.smu_prv_buffer_size;
    	smu->smu_feature.feature_num = SMU_FEATURE_MAX;
-	bitmap_zero(smu->smu_feature.supported,

SMU_FEATURE_MAX);

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_sw_init(void *handle) · line 952

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -0
    	bitmap_zero(smu->smu_feature.enabled,

SMU_FEATURE_MAX);

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c static int smu_sw_init(void *handle) · line 953

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -0
    	bitmap_zero(smu->smu_feature.allowed,

SMU_FEATURE_MAX);

Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 20 lines
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -1
index 18f24db7d202..3c0360772822 100644
@@ -388,7 +388,6 @@ struct smu_power_context {
    struct smu_feature
    {
    	uint32_t feature_num;
-	DECLARE_BITMAP(supported, SMU_FEATURE_MAX);
    	DECLARE_BITMAP(allowed, SMU_FEATURE_MAX);
    	DECLARE_BITMAP(enabled, SMU_FEATURE_MAX);
    };
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -0
index 84834c24a7e9..9fb290f9aaeb 100644
@@ -1625,8 +1625,8 @@ static int
Quoted 1 line

navi10_display_config_changed(struct

smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c

Quoted 4 lines
    	int ret = 0;

    	if ((smu->watermarks_bitmap & WATERMARKS_EXIST) &&
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -1
-	    smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -1
-	    smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_SOCCLK_BIT)) {

Quoted 23 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -0
+	    smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -0
+	    smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_SOCCLK_BIT)) {

Quoted 1 line

ret = smu_cmn_send_smc_msg_with_param(smu,

SMU_MSG_NumOfDisplays,

Quoted 1 line

smu-

display_config-

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int

Quoted 3 lines

num_display,

    						  NULL);
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -0
@@ -1864,13 +1864,13 @@ static int

navi10_notify_smc_display_config(struct smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int · line 1869

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -1
    	min_clocks.dcef_clock_in_sr = smu->display_config-
 min_dcef_deep_sleep_set_clk;
    	min_clocks.memory_clock = smu->display_config-
 min_mem_set_clock;
 
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int · line 1869

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT)) {

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -0
    		clock_req.clock_type = amd_pp_dcef_clock;
    		clock_req.clock_freq_in_khz = min_clocks.dcef_clock

* 10;

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int · line 1872

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -0
    		ret =

smu_v11_0_display_clock_voltage_request(smu,

Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines

&clock_req);

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int · line 1874

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -1
    		if (!ret) {
-			if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int · line 1874

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -0
+			if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c static int · line 1875

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0 -0
    				ret =

smu_cmn_send_smc_msg_with_param(smu,

Quoted 1 line

SMU_MSG_SetMinDeepSleepDcefclk,

Quoted 1 line

min_clocks.dcef_clock_in_sr/100, diff --git

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int

Quoted 6 lines

a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c index 651fe748e423..d568d6137a00 100644

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -0
@@ -1281,8 +1281,8 @@ static int

sienna_cichlid_display_config_changed(struct smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int · line 1284

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -1
    	int ret = 0;
 
    	if ((smu->watermarks_bitmap & WATERMARKS_EXIST) &&
-	    smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int · line 1285

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -1
-	    smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_SOCCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int · line 1284

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
+	    smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT) &&

Quoted 21 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int · line 1285

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
+	    smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_SOCCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c static int · line 1287

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -0
    #if 0
    		ret = smu_cmn_send_smc_msg_with_param(smu,

SMU_MSG_NumOfDisplays,

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -0
    						  smu-

display_config-

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 2 lines

num_display, @@ -1521,13 +1521,13 @@ static int sienna_cichlid_notify_smc_display_config(struct smu_context

*smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 6 lines
    	min_clocks.dcef_clock_in_sr = smu->display_config-
min_dcef_deep_sleep_set_clk;
    	min_clocks.memory_clock = smu->display_config-

min_mem_set_clock;

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_DCEFCLK_BIT)) {

Quoted 2 lines

clock_req.clock_type = amd_pp_dcef_clock; clock_req.clock_freq_in_khz = min_clocks.dcef_clock

* 10;

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

ret =

smu_v11_0_display_clock_voltage_request(smu,

Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines

&clock_req);

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 2 lines
    		if (!ret) {
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -1
-			if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_DCEFCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
+			if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_DCEFCLK_BIT)) {

Quoted 1 line

ret =

smu_cmn_send_smc_msg_with_param(smu,

Quoted 1 line

SMU_MSG_SetMinDeepSleepDcefclk,

Quoted 1 line

min_clocks.dcef_clock_in_sr/100, @@ -3752,7 +3752,7 @@

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 5 lines

static int sienna_cichlid_gpo_control(struct smu_context *smu,

    	int ret = 0;
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_GFX_GPO_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_GFX_GPO_BIT)) {

Quoted 1 line

ret = smu_cmn_get_smc_version(smu, NULL,

&smu_version);

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int

Quoted 8 lines
    		if (ret)
    			return ret;
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
index b58a4c2823c2..b69c2ecc8e25 100644
@@ -808,7 +808,6 @@ int

smu_v11_0_system_features_control(struct

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_system_features_control(struct smu_context *smu,

Quoted 7 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
    		return ret;
 
    	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
    	if (en) {
    		ret = smu_cmn_get_enabled_mask(smu,

feature_mask, 2);

Quoted 25 lines
Quoted 25 lines
Quoted 2 lines
Quoted 2 lines

@@ -817,8

Quoted 1 line

+816,6 @@ int smu_v11_0_system_features_control(struct

smu_context

Quoted 22 lines
Quoted 22 lines
Quoted 3 lines

*smu,

    		bitmap_copy(feature->enabled, (unsigned long

*)&feature_mask,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 2 lines
    			    feature->feature_num);
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-		bitmap_copy(feature->supported, (unsigned long

*)&feature_mask,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c smu_v11_0_auto_fan_control(struct

Quoted 5 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-			    feature->feature_num);
    	}
 
    	return ret;
@@ -1186,7 +1183,7 @@ smu_v11_0_auto_fan_control(struct

smu_context *smu, bool auto_fan_control)

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c smu_v11_0_auto_fan_control(struct smu_context *smu, bool auto_fan_control)

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
    {
    	int ret = 0;
 
-	if (!smu_cmn_feature_is_supported(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c smu_v11_0_auto_fan_control(struct · line 1186

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (!smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
    		return 0;
 
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c smu_v11_0_auto_fan_control(struct · line 1189

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
    	ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_FAN_CONTROL_BIT,

Quoted 1 line

auto_fan_control); @@ -1607,7 +1604,7 @@ bool

smu_v11_0_baco_is_support(struct smu_context *smu)

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 4 lines
    		return false;

    	/* Arcturus does not support this bit mask */
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_BACO_BIT)

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

&&

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_BACO_BIT)

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

&&

Quoted 1 line

!smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_BACO_BIT))

Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_gfx_ulv_control(struct

Quoted 3 lines
    		return false;
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
@@ -2150,7 +2147,7 @@ int smu_v11_0_gfx_ulv_control(struct

smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c smu_v11_0_auto_fan_control(struct smu_context *smu, bool auto_fan_control)

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
    {
    	int ret = 0;
 
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_GFX_ULV_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_gfx_ulv_control(struct · line 2150

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_GFX_ULV_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_gfx_ulv_control(struct · line 2151

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
    		ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_GFX_ULV_BIT,

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_deep_sleep_control(struct

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
 enablement);
 
    	return ret;
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
@@ -2162,7 +2159,7 @@ int smu_v11_0_deep_sleep_control(struct

smu_context *smu,

Quoted 3 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
    	struct amdgpu_device *adev = smu->adev;
    	int ret = 0;
 
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_deep_sleep_control(struct · line 2165

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_GFXCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_deep_sleep_control(struct · line 2162

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_GFXCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c int smu_v11_0_deep_sleep_control(struct · line 2163

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
    		ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_DS_GFXCLK_BIT, enablement);

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -0
    		if (ret) {
    			dev_err(adev->dev, "Failed to %s GFXCLK

DS!\n",

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

enablement ?

Quoted 1 line

"enable" : "disable"); @@ -2170,7 +2167,7 @@ int

smu_v11_0_deep_sleep_control(struct smu_context *smu,

Quoted 3 lines
    		}
    	}
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_UCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_UCLK_BIT)) {

Quoted 1 line

ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_DS_UCLK_BIT, enablement);

Quoted 2 lines
    		if (ret) {
    			dev_err(adev->dev, "Failed to %s UCLK

DS!\n",

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

enablement ?

Quoted 1 line

"enable" : "disable"); @@ -2178,7 +2175,7 @@ int

smu_v11_0_deep_sleep_control(struct smu_context *smu,

Quoted 3 lines
    		}
    	}
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_FCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_FCLK_BIT)) {

Quoted 1 line

ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_DS_FCLK_BIT, enablement);

Quoted 2 lines
    		if (ret) {
    			dev_err(adev->dev, "Failed to %s FCLK

DS!\n",

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

enablement ?

Quoted 1 line

"enable" : "disable"); @@ -2186,7 +2183,7 @@ int

smu_v11_0_deep_sleep_control(struct smu_context *smu,

Quoted 3 lines
    		}
    	}
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_SOCCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_SOCCLK_BIT)) {

Quoted 1 line

ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_DS_SOCCLK_BIT, enablement);

Quoted 2 lines
    		if (ret) {
    			dev_err(adev->dev, "Failed to %s SOCCLK

DS!\n",

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

enablement ?

Quoted 1 line

"enable" : "disable"); @@ -2194,7 +2191,7 @@ int

smu_v11_0_deep_sleep_control(struct smu_context *smu,

Quoted 3 lines
    		}
    	}
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DS_LCLK_BIT)) {

drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DS_LCLK_BIT)) {

Quoted 1 line

ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_DS_LCLK_BIT, enablement);

Quoted 2 lines
    		if (ret) {
    			dev_err(adev->dev, "Failed to %s LCLK

DS!\n",

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

enablement ?

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static int

Quoted 7 lines

"enable" : "disable"); diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c index b4a3c9b8b54e..e72831aa4859 100644

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
@@ -1960,7 +1960,6 @@ static int

vangogh_system_features_control(struct smu_context *smu, bool en)

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
    						      RLC_STATUS_OFF,

NULL);

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -1
    	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
    	if (!en)
    		return ret;
@@ -1971,8 +1970,6 @@ static int

vangogh_system_features_control(struct smu_context *smu, bool

en)

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
    	bitmap_copy(feature->enabled, (unsigned long

*)&feature_mask,

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c

Quoted 2 lines
    		    feature->feature_num);
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -1
-	bitmap_copy(feature->supported, (unsigned long

*)&feature_mask,

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static int vangogh_post_smu_init(struct

Quoted 5 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -1
-		    feature->feature_num);
 
    	return 0;
    }
@@ -1989,7 +1986,7 @@ static int vangogh_post_smu_init(struct

smu_context *smu)

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
    		adev->gfx.config.max_sh_per_se *
 adev->gfx.config.max_shader_engines;
 
    	/* allow message will be sent after enable message on

Vangogh*/

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static int vangogh_post_smu_init(struct · line 1993

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -1
-	if (smu_cmn_feature_is_supported(smu,

SMU_FEATURE_DPM_GFXCLK_BIT) &&

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static int vangogh_post_smu_init(struct · line 1990

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +1 -0
+	if (smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_DPM_GFXCLK_BIT) &&

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
    			(adev->pg_flags &

AMD_PG_SUPPORT_GFX_PG)) {

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c static int vangogh_post_smu_init(struct · line 1992

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +0 -0
    		ret = smu_cmn_send_smc_msg(smu,

SMU_MSG_EnableGfxOff, NULL);

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c int

Quoted 7 lines
    		if (ret) {
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -0
index 1754a3720179..c5d354175675 100644
@@ -774,7 +774,6 @@ int

smu_v13_0_system_features_control(struct

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c int · line 779

Quoted 7 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -1
    		return ret;
 
    	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
    	if (en) {
    		ret = smu_cmn_get_enabled_mask(smu,

feature_mask, 2);

Quoted 40 lines
Quoted 40 lines
Quoted 2 lines
Quoted 2 lines

@@ -783,8

Quoted 1 line

+782,6 @@ int smu_v13_0_system_features_control(struct

smu_context

Quoted 37 lines
Quoted 37 lines
Quoted 3 lines

*smu,

    		bitmap_copy(feature->enabled, (unsigned long

*)&feature_mask,

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

Quoted 2 lines
    			    feature->feature_num);
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -1
-		bitmap_copy(feature->supported, (unsigned long

*)&feature_mask,

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c smu_v13_0_auto_fan_control(struct

Quoted 5 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -1
-			    feature->feature_num);
    	}
 
    	return ret;
@@ -1071,7 +1068,7 @@ smu_v13_0_auto_fan_control(struct

smu_context *smu, bool auto_fan_control)

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c smu_v13_0_auto_fan_control(struct · line 1074

Quoted 4 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -1
    {
    	int ret = 0;
 
-	if (!smu_cmn_feature_is_supported(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c smu_v13_0_auto_fan_control(struct · line 1071

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +1 -0
+	if (!smu_cmn_feature_is_enabled(smu,

SMU_FEATURE_FAN_CONTROL_BIT))

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c smu_v13_0_auto_fan_control(struct · line 1074

Quoted 3 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +0 -0
    		return 0;
 
    	ret = smu_cmn_feature_set_enabled(smu,

SMU_FEATURE_FAN_CONTROL_BIT,

drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c static int

Quoted 7 lines

auto_fan_control); diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c index f425827e2361..e9172622c0c4 100644

drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -0
@@ -204,7 +204,6 @@ static int

yellow_carp_system_features_control(struct smu_context *smu, bool en)

drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c static int · line 204

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -0
    		ret = smu_cmn_send_smc_msg(smu,

SMU_MSG_PrepareMp1ForUnload,

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -0
 NULL);
 
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c static int · line 214

Quoted 7 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -1
    	bitmap_zero(feature->enabled, feature->feature_num);
-	bitmap_zero(feature->supported, feature->feature_num);
 
    	if (!en)
    		return ret;
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -0
@@ -215,8 +214,6 @@ static int
 yellow_carp_system_features_control(struct smu_context *smu,

bool

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c static int · line 217

Quoted 3 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -0
 en)
 
    	bitmap_copy(feature->enabled, (unsigned long

*)&feature_mask,

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c static int · line 220

Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -1
    		    feature->feature_num);
-	bitmap_copy(feature->supported, (unsigned long

*)&feature_mask,

Quoted 42 lines
Quoted 42 lines
Quoted 42 lines
Quoted 42 lines

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c int smu_cmn_to_asic_specific_index(struct

Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +0 -1
-		    feature->feature_num);
 
    	return 0;
    }
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0 -0
index 50164ebed1cd..49bcabe9d708 100644
@@ -476,23 +476,6 @@ int smu_cmn_to_asic_specific_index(struct

smu_context *smu,

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c int smu_cmn_to_asic_specific_index(struct smu_context *smu, · line 490

Quoted 11 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0 -8
    	}
    }
 
-int smu_cmn_feature_is_supported(struct smu_context *smu,
-				 enum smu_feature_mask mask)
-{
-	struct smu_feature *feature = &smu->smu_feature;
-	int feature_id;
-
-	feature_id = smu_cmn_to_asic_specific_index(smu,
-

CMN2ASIC_MAPPING_FEATURE,

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h int smu_cmn_to_asic_specific_index(struct

Quoted 18 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0 -9
-						    mask);
-	if (feature_id < 0)
-		return 0;
-
-	WARN_ON(feature_id > feature->feature_num);
-
-	return test_bit(feature_id, feature->supported);
-}
-
    int smu_cmn_feature_is_enabled(struct smu_context *smu,
    			       enum smu_feature_mask mask)
    {
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h +0 -0
index 4e34c18c6063..19919182260a 100644
@@ -48,9 +48,6 @@ int smu_cmn_to_asic_specific_index(struct

smu_context *smu,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h int smu_cmn_to_asic_specific_index(struct · line 48

Quoted 1 line
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h +0 -0
    				   enum

smu_cmn2asic_mapping_type type,

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h +0 -3
    				   uint32_t index);
 
-int smu_cmn_feature_is_supported(struct smu_context *smu,
-				 enum smu_feature_mask mask);
-
    int smu_cmn_feature_is_enabled(struct smu_context *smu,
    			       enum smu_feature_mask mask);
 
author
#9 lore raw

PATCH 4/7 drm/amd/pm: update the data type for retrieving enabled ppfeatures

In reply to Evan Quan

Use uint64_t instead of an array of uint32_t. This can avoid some non-necessary intermediate uint32_t -> uint64_t conversions.

Change-Id I4e217357203a23440f058d7e25f55eaebd15c5ef
---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     |  2 +-
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  5 ++--
 .../gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c |  5 +---
 .../amd/pm/swsmu/smu11/cyan_skillfish_ppt.c   |  6 +---
 .../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c   |  5 +---
 .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c   |  5 +---
 .../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c    |  4 +--
 .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  | 10 ++-----
 .../drm/amd/pm/swsmu/smu13/aldebaran_ppt.c    |  7 ++---
 .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c    |  4 +--
 .../drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c  |  9 ++----
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c        | 29 +++++++------------
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h        |  3 +-
 drivers/gpu/drm/amd/pm/swsmu/smu_internal.h   |  2 +-
 14 files changed, 32 insertions(+), 64 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +1 -1
index d3237b89f2c5..5aff66103da2 100644
@@ -2309,7 +2309,7 @@ static int smu_read_sensor(void *handle,
 		*size = 4;
 		break;
 	case AMDGPU_PP_SENSOR_ENABLED_SMC_FEATURES_MASK:
-		ret = smu_feature_get_enabled_mask(smu, (uint32_t *)data, 2);
+		ret = smu_feature_get_enabled_mask(smu, (uint64_t *)data);
 		*size = 8;
 		break;
 	case AMDGPU_PP_SENSOR_UVD_POWER:
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +2 -3
index 3c0360772822..46496bed5f61 100644
@@ -974,10 +974,9 @@ struct pptable_funcs {
 	/**
 	 * @get_enabled_mask: Get a mask of features that are currently enabled
 	 *                    on the SMU.
-	 * &feature_mask: Array representing enabled feature mask.
-	 * &num: Elements in &feature_mask.
+	 * &feature_mask: Enabled feature mask.
 	 */
-	int (*get_enabled_mask)(struct smu_context *smu, uint32_t *feature_mask, uint32_t num);
+	int (*get_enabled_mask)(struct smu_context *smu, uint64_t *feature_mask);
 
 	/**
 	 * @feature_is_enabled: Test if a feature is enabled.
drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +1 -4
index 2c78d04d5611..dda36942cfb6 100644
@@ -2022,15 +2022,12 @@ static void arcturus_dump_pptable(struct smu_context *smu)
 static bool arcturus_is_dpm_running(struct smu_context *smu)
 {
 	int ret = 0;
-	uint32_t feature_mask[2];
 	uint64_t feature_enabled;
 
-	ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);
+	ret = smu_cmn_get_enabled_mask(smu, &feature_enabled);
 	if (ret)
 		return false;
 
-	feature_enabled = (uint64_t)feature_mask[1] << 32 | feature_mask[0];
-
 	return !!(feature_enabled & SMC_DPM_FEATURE);
 }
 
drivers/gpu/drm/amd/pm/swsmu/smu11/cyan_skillfish_ppt.c +1 -5
index cabea4eb1566..844d931da6f6 100644
@@ -366,20 +366,16 @@ static bool cyan_skillfish_is_dpm_running(struct smu_context *smu)
 {
 	struct amdgpu_device *adev = smu->adev;
 	int ret = 0;
-	uint32_t feature_mask[2];
 	uint64_t feature_enabled;
 
 	/* we need to re-init after suspend so return false */
 	if (adev->in_suspend)
 		return false;
 
-	ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);
+	ret = smu_cmn_get_enabled_mask(smu, &feature_enabled);
 	if (ret)
 		return false;
 
-	feature_enabled = (uint64_t)feature_mask[0] |
-				((uint64_t)feature_mask[1] << 32);
-
 	/*
 	 * cyan_skillfish specific, query default sclk inseted of hard code.
 	 */
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +1 -4
index 9fb290f9aaeb..4a41cd6c5ea4 100644
@@ -1640,15 +1640,12 @@ static int navi10_display_config_changed(struct smu_context *smu)
 static bool navi10_is_dpm_running(struct smu_context *smu)
 {
 	int ret = 0;
-	uint32_t feature_mask[2];
 	uint64_t feature_enabled;
 
-	ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);
+	ret = smu_cmn_get_enabled_mask(smu, &feature_enabled);
 	if (ret)
 		return false;
 
-	feature_enabled = (uint64_t)feature_mask[1] << 32 | feature_mask[0];
-
 	return !!(feature_enabled & SMC_DPM_FEATURE);
 }
 
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +1 -4
index d568d6137a00..bea22eeb6073 100644
@@ -1298,15 +1298,12 @@ static int sienna_cichlid_display_config_changed(struct smu_context *smu)
 static bool sienna_cichlid_is_dpm_running(struct smu_context *smu)
 {
 	int ret = 0;
-	uint32_t feature_mask[2];
 	uint64_t feature_enabled;
 
-	ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);
+	ret = smu_cmn_get_enabled_mask(smu, &feature_enabled);
 	if (ret)
 		return false;
 
-	feature_enabled = (uint64_t)feature_mask[1] << 32 | feature_mask[0];
-
 	return !!(feature_enabled & SMC_DPM_FEATURE);
 }
 
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +2 -2
index b69c2ecc8e25..b30885f4ca8e 100644
@@ -799,7 +799,7 @@ int smu_v11_0_system_features_control(struct smu_context *smu,
 					     bool en)
 {
 	struct smu_feature *feature = &smu->smu_feature;
-	uint32_t feature_mask[2];
+	uint64_t feature_mask;
 	int ret = 0;
 
 	ret = smu_cmn_send_smc_msg(smu, (en ? SMU_MSG_EnableAllSmuFeatures :
@@ -810,7 +810,7 @@ int smu_v11_0_system_features_control(struct smu_context *smu,
 	bitmap_zero(feature->enabled, feature->feature_num);
 
 	if (en) {
-		ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);
+		ret = smu_cmn_get_enabled_mask(smu, &feature_mask);
 		if (ret)
 			return ret;
 
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +3 -7
index e72831aa4859..478151e72889 100644
@@ -500,21 +500,17 @@ static bool vangogh_is_dpm_running(struct smu_context *smu)
 {
 	struct amdgpu_device *adev = smu->adev;
 	int ret = 0;
-	uint32_t feature_mask[2];
 	uint64_t feature_enabled;
 
 	/* we need to re-init after suspend so return false */
 	if (adev->in_suspend)
 		return false;
 
-	ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);
+	ret = smu_cmn_get_enabled_mask(smu, &feature_enabled);
 
 	if (ret)
 		return false;
 
-	feature_enabled = (unsigned long)((uint64_t)feature_mask[0] |
-				((uint64_t)feature_mask[1] << 32));
-
 	return !!(feature_enabled & SMC_DPM_FEATURE);
 }
 
@@ -1952,7 +1948,7 @@ static int vangogh_system_features_control(struct smu_context *smu, bool en)
 {
 	struct amdgpu_device *adev = smu->adev;
 	struct smu_feature *feature = &smu->smu_feature;
-	uint32_t feature_mask[2];
+	uint64_t feature_mask;
 	int ret = 0;
 
 	if (adev->pm.fw_version >= 0x43f1700 && !en)
@@ -1964,7 +1960,7 @@ static int vangogh_system_features_control(struct smu_context *smu, bool en)
 	if (!en)
 		return ret;
 
-	ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);
+	ret = smu_cmn_get_enabled_mask(smu, &feature_mask);
 	if (ret)
 		return ret;
 
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +2 -5
index 8c02adbf446a..97762e997644 100644
@@ -1451,14 +1451,11 @@ static int aldebaran_usr_edit_dpm_table(struct smu_context *smu, enum PP_OD_DPM_
 static bool aldebaran_is_dpm_running(struct smu_context *smu)
 {
 	int ret;
-	uint32_t feature_mask[2];
-	unsigned long feature_enabled;
+	uint64_t feature_enabled;
 
-	ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);
+	ret = smu_cmn_get_enabled_mask(smu, &feature_enabled);
 	if (ret)
 		return false;
-	feature_enabled = (unsigned long)((uint64_t)feature_mask[0] |
-					  ((uint64_t)feature_mask[1] << 32));
 	return !!(feature_enabled & SMC_DPM_FEATURE);
 }
 
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +2 -2
index c5d354175675..c1caf61c2bbc 100644
@@ -765,7 +765,7 @@ int smu_v13_0_system_features_control(struct smu_context *smu,
 				      bool en)
 {
 	struct smu_feature *feature = &smu->smu_feature;
-	uint32_t feature_mask[2];
+	uint64_t feature_mask;
 	int ret = 0;
 
 	ret = smu_cmn_send_smc_msg(smu, (en ? SMU_MSG_EnableAllSmuFeatures :
@@ -776,7 +776,7 @@ int smu_v13_0_system_features_control(struct smu_context *smu,
 	bitmap_zero(feature->enabled, feature->feature_num);
 
 	if (en) {
-		ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);
+		ret = smu_cmn_get_enabled_mask(smu, &feature_mask);
 		if (ret)
 			return ret;
 
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +3 -6
index e9172622c0c4..d89e8a03651b 100644
@@ -197,7 +197,7 @@ static int yellow_carp_system_features_control(struct smu_context *smu, bool en)
 {
 	struct smu_feature *feature = &smu->smu_feature;
 	struct amdgpu_device *adev = smu->adev;
-	uint32_t feature_mask[2];
+	uint64_t feature_mask;
 	int ret = 0;
 
 	if (!en && !adev->in_s0ix)
@@ -208,7 +208,7 @@ static int yellow_carp_system_features_control(struct smu_context *smu, bool en)
 	if (!en)
 		return ret;
 
-	ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);
+	ret = smu_cmn_get_enabled_mask(smu, &feature_mask);
 	if (ret)
 		return ret;
 
@@ -252,16 +252,13 @@ static int yellow_carp_dpm_set_jpeg_enable(struct smu_context *smu, bool enable)
 static bool yellow_carp_is_dpm_running(struct smu_context *smu)
 {
 	int ret = 0;
-	uint32_t feature_mask[2];
 	uint64_t feature_enabled;
 
-	ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);
+	ret = smu_cmn_get_enabled_mask(smu, &feature_enabled);
 
 	if (ret)
 		return false;
 
-	feature_enabled = (uint64_t)feature_mask[1] << 32 | feature_mask[0];
-
 	return !!(feature_enabled & SMC_DPM_FEATURE);
 }
 
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +11 -18
index 49bcabe9d708..ece6ec230a89 100644
@@ -525,8 +525,7 @@ bool smu_cmn_clk_dpm_is_enabled(struct smu_context *smu,
 }
 
 int smu_cmn_get_enabled_mask(struct smu_context *smu,
-			     uint32_t *feature_mask,
-			     uint32_t num)
+			     uint64_t *feature_mask)
 {
 	struct smu_feature *feature = &smu->smu_feature;
 	struct amdgpu_device *adev = smu->adev;
@@ -534,7 +533,7 @@ int smu_cmn_get_enabled_mask(struct smu_context *smu,
 	uint32_t *feature_mask_low;
 	int ret = 0;
 
-	if (!feature_mask || num < 2)
+	if (!feature_mask)
 		return -EINVAL;
 
 	if (!bitmap_empty(feature->enabled, feature->feature_num)) {
@@ -544,8 +543,8 @@ int smu_cmn_get_enabled_mask(struct smu_context *smu,
 		return 0;
 	}
 
-	feature_mask_low = &feature_mask[0];
-	feature_mask_high = &feature_mask[1];
+	feature_mask_low = &((uint32_t *)feature_mask)[0];
+	feature_mask_high = &((uint32_t *)feature_mask)[1];
 
 	switch (adev->asic_type) {
 	case CHIP_CYAN_SKILLFISH:
@@ -676,7 +675,7 @@ static const char *smu_get_feature_name(struct smu_context *smu,
 size_t smu_cmn_get_pp_feature_mask(struct smu_context *smu,
 				   char *buf)
 {
-	uint32_t feature_mask[2] = { 0 };
+	uint64_t feature_mask;
 	int feature_index = 0;
 	uint32_t count = 0;
 	int8_t sort_feature[SMU_FEATURE_COUNT];
@@ -684,13 +683,12 @@ size_t smu_cmn_get_pp_feature_mask(struct smu_context *smu,
 	int ret = 0, i;
 
 	ret = smu_cmn_get_enabled_mask(smu,
-				       feature_mask,
-				       2);
+				       &feature_mask);
 	if (ret)
 		return 0;
 
 	size =  sysfs_emit_at(buf, size, "features high: 0x%08x low: 0x%08x\n",
-			feature_mask[1], feature_mask[0]);
+			upper_32_bits(feature_mask), lower_32_bits(feature_mask));
 
 	memset(sort_feature, -1, sizeof(sort_feature));
 
@@ -726,22 +724,17 @@ int smu_cmn_set_pp_feature_mask(struct smu_context *smu,
 				uint64_t new_mask)
 {
 	int ret = 0;
-	uint32_t feature_mask[2] = { 0 };
+	uint64_t feature_mask;
 	uint64_t feature_2_enabled = 0;
 	uint64_t feature_2_disabled = 0;
-	uint64_t feature_enables = 0;
 
 	ret = smu_cmn_get_enabled_mask(smu,
-				       feature_mask,
-				       2);
+				       &feature_mask);
 	if (ret)
 		return ret;
 
-	feature_enables = ((uint64_t)feature_mask[1] << 32 |
-			   (uint64_t)feature_mask[0]);
-
-	feature_2_enabled  = ~feature_enables & new_mask;
-	feature_2_disabled = feature_enables & ~new_mask;
+	feature_2_enabled  = ~feature_mask & new_mask;
+	feature_2_disabled = feature_mask & ~new_mask;
 
 	if (feature_2_enabled) {
 		ret = smu_cmn_feature_update_enable_state(smu,
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h +1 -2
index 19919182260a..98190ed5360f 100644
@@ -55,8 +55,7 @@ bool smu_cmn_clk_dpm_is_enabled(struct smu_context *smu,
 				enum smu_clk_type clk_type);
 
 int smu_cmn_get_enabled_mask(struct smu_context *smu,
-			     uint32_t *feature_mask,
-			     uint32_t num);
+			     uint64_t *feature_mask);
 
 uint64_t smu_cmn_get_indep_throttler_status(
 					const unsigned long dep_status,
drivers/gpu/drm/amd/pm/swsmu/smu_internal.h +1 -1
index 59f9cfff3d61..2f9aff89f667 100644
@@ -55,7 +55,7 @@
 #define smu_send_smc_msg(smu, msg, read_arg)				smu_ppt_funcs(send_smc_msg, 0, smu, msg, read_arg)
 #define smu_init_display_count(smu, count)				smu_ppt_funcs(init_display_count, 0, smu, count)
 #define smu_feature_set_allowed_mask(smu)				smu_ppt_funcs(set_allowed_mask, 0, smu)
-#define smu_feature_get_enabled_mask(smu, mask, num)			smu_ppt_funcs(get_enabled_mask, 0, smu, mask, num)
+#define smu_feature_get_enabled_mask(smu, mask)				smu_ppt_funcs(get_enabled_mask, 0, smu, mask)
 #define smu_feature_is_enabled(smu, mask)				smu_ppt_funcs(feature_is_enabled, 0, smu, mask)
 #define smu_disable_all_features_with_exception(smu, no_hw_disablement, mask)		smu_ppt_funcs(disable_all_features_with_exception, 0, smu, no_hw_disablement, mask)
 #define smu_is_dpm_running(smu)						smu_ppt_funcs(is_dpm_running, 0 , smu)
Signature · 1 line
2.29.0
author
#10 lore raw

PATCH 5/7 drm/amd/pm: drop the cache for enabled ppfeatures

In reply to Evan Quan

The following scenarios make the driver cache for enabled ppfeatures outdated and invalid:
- Other tools interact with PMFW to change the enabled ppfeatures.
- PMFW may enable/disable some features behind driver's back. E.g. for sienna_cichild, on gfxoff entering, PMFW will disable gfx related DPM features. All those are performed without driver's notice.
Also considering driver does not actually interact with PMFW such frequently, the benefit brought by such cache is very limited.

Change-Id I20ed58ab216e930c7a5d223be1eb99146889f2b3
---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     |  1 -
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  1 -
 .../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c    | 23 +---------
 .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  | 16 +------
 .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c    | 23 +---------
 .../drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c  | 16 +------
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c        | 46 +++++--------------
 7 files changed, 17 insertions(+), 109 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -1
index 5aff66103da2..aceb6e56bc6a 100644
@@ -949,7 +949,6 @@ static int smu_sw_init(void *handle)
 
 	smu->pool_size = adev->pm.smu_prv_buffer_size;
 	smu->smu_feature.feature_num = SMU_FEATURE_MAX;
-	bitmap_zero(smu->smu_feature.enabled, SMU_FEATURE_MAX);
 	bitmap_zero(smu->smu_feature.allowed, SMU_FEATURE_MAX);
 
 	mutex_init(&smu->message_lock);
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -1
index 46496bed5f61..4ba579cdd203 100644
@@ -389,7 +389,6 @@ struct smu_feature
 {
 	uint32_t feature_num;
 	DECLARE_BITMAP(allowed, SMU_FEATURE_MAX);
-	DECLARE_BITMAP(enabled, SMU_FEATURE_MAX);
 };
 
 struct smu_clocks {
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +2 -21
index b30885f4ca8e..1c76ee25c30b 100644
@@ -798,27 +798,8 @@ int smu_v11_0_set_allowed_mask(struct smu_context *smu)
 int smu_v11_0_system_features_control(struct smu_context *smu,
 					     bool en)
 {
-	struct smu_feature *feature = &smu->smu_feature;
-	uint64_t feature_mask;
-	int ret = 0;
-
-	ret = smu_cmn_send_smc_msg(smu, (en ? SMU_MSG_EnableAllSmuFeatures :
-				     SMU_MSG_DisableAllSmuFeatures), NULL);
-	if (ret)
-		return ret;
-
-	bitmap_zero(feature->enabled, feature->feature_num);
-
-	if (en) {
-		ret = smu_cmn_get_enabled_mask(smu, &feature_mask);
-		if (ret)
-			return ret;
-
-		bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
-			    feature->feature_num);
-	}
-
-	return ret;
+	return smu_cmn_send_smc_msg(smu, (en ? SMU_MSG_EnableAllSmuFeatures :
+					  SMU_MSG_DisableAllSmuFeatures), NULL);
 }
 
 int smu_v11_0_notify_display_change(struct smu_context *smu)
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +1 -15
index 478151e72889..96a5b31f708d 100644
@@ -1947,27 +1947,13 @@ static int vangogh_get_dpm_clock_table(struct smu_context *smu, struct dpm_clock
 static int vangogh_system_features_control(struct smu_context *smu, bool en)
 {
 	struct amdgpu_device *adev = smu->adev;
-	struct smu_feature *feature = &smu->smu_feature;
-	uint64_t feature_mask;
 	int ret = 0;
 
 	if (adev->pm.fw_version >= 0x43f1700 && !en)
 		ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_RlcPowerNotify,
 						      RLC_STATUS_OFF, NULL);
 
-	bitmap_zero(feature->enabled, feature->feature_num);
-
-	if (!en)
-		return ret;
-
-	ret = smu_cmn_get_enabled_mask(smu, &feature_mask);
-	if (ret)
-		return ret;
-
-	bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
-		    feature->feature_num);
-
-	return 0;
+	return ret;
 }
 
 static int vangogh_post_smu_init(struct smu_context *smu)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +2 -21
index c1caf61c2bbc..dda3f6d685d1 100644
@@ -764,27 +764,8 @@ int smu_v13_0_gfx_off_control(struct smu_context *smu, bool enable)
 int smu_v13_0_system_features_control(struct smu_context *smu,
 				      bool en)
 {
-	struct smu_feature *feature = &smu->smu_feature;
-	uint64_t feature_mask;
-	int ret = 0;
-
-	ret = smu_cmn_send_smc_msg(smu, (en ? SMU_MSG_EnableAllSmuFeatures :
-					 SMU_MSG_DisableAllSmuFeatures), NULL);
-	if (ret)
-		return ret;
-
-	bitmap_zero(feature->enabled, feature->feature_num);
-
-	if (en) {
-		ret = smu_cmn_get_enabled_mask(smu, &feature_mask);
-		if (ret)
-			return ret;
-
-		bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
-			    feature->feature_num);
-	}
-
-	return ret;
+	return smu_cmn_send_smc_msg(smu, (en ? SMU_MSG_EnableAllSmuFeatures :
+					  SMU_MSG_DisableAllSmuFeatures), NULL);
 }
 
 int smu_v13_0_notify_display_change(struct smu_context *smu)
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +1 -15
index d89e8a03651b..e90387a84cbb 100644
@@ -195,27 +195,13 @@ static int yellow_carp_fini_smc_tables(struct smu_context *smu)
 
 static int yellow_carp_system_features_control(struct smu_context *smu, bool en)
 {
-	struct smu_feature *feature = &smu->smu_feature;
 	struct amdgpu_device *adev = smu->adev;
-	uint64_t feature_mask;
 	int ret = 0;
 
 	if (!en && !adev->in_s0ix)
 		ret = smu_cmn_send_smc_msg(smu, SMU_MSG_PrepareMp1ForUnload, NULL);
 
-	bitmap_zero(feature->enabled, feature->feature_num);
-
-	if (!en)
-		return ret;
-
-	ret = smu_cmn_get_enabled_mask(smu, &feature_mask);
-	if (ret)
-		return ret;
-
-	bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
-		    feature->feature_num);
-
-	return 0;
+	return ret;
 }
 
 static int yellow_carp_dpm_set_vcn_enable(struct smu_context *smu, bool enable)
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +11 -35

117 lines not on this page · raw message

Signature · 1 line
2.29.0
author
#11 lore raw

PATCH 6/7 drm/amd/pm: avoid consecutive retrieving for enabled ppfeatures

In reply to Evan Quan

As the enabled ppfeatures are just retrieved ahead. We can use that directly instead of retrieving again and again.

Change-Id I08827437fcbbc52084418c8ca6a90cfa503306a9
---
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +9 -1
index 905d6ddd7479..e54c59f3e8c2 100644
@@ -661,6 +661,7 @@ size_t smu_cmn_get_pp_feature_mask(struct smu_context *smu,
 	int8_t sort_feature[SMU_FEATURE_COUNT];
 	size_t size = 0;
 	int ret = 0, i;
+	int feature_id;
 
 	ret = smu_cmn_get_enabled_mask(smu,
 				       &feature_mask);
@@ -689,11 +690,18 @@ size_t smu_cmn_get_pp_feature_mask(struct smu_context *smu,
 		if (sort_feature[i] < 0)
 			continue;
 
+		/* convert to asic spcific feature ID */
+		feature_id = smu_cmn_to_asic_specific_index(smu,
+							    CMN2ASIC_MAPPING_FEATURE,
+							    sort_feature[i]);
+		if (feature_id < 0)
+			continue;
+
 		size += sysfs_emit_at(buf, size, "%02d. %-20s (%2d) : %s\n",
 				count++,
 				smu_get_feature_name(smu, sort_feature[i]),
 				i,
-				!!smu_cmn_feature_is_enabled(smu, sort_feature[i]) ?
+				!!test_bit(feature_id, (unsigned long *)&feature_mask) ?
 				"enabled" : "disabled");
 	}
 
Signature · 1 line
2.29.0
author
#12 lore raw

PATCH 7/7 drm/amd/pm: revise the implementation of smu_cmn_disable_all_features_with_exception

In reply to Evan Quan

As there is no internal cache for enabled ppfeatures now. Thus the 2nd parameter will be not needed any more.

Change-Id I0c1811f216c55d6ddfabdc9e099dc214c21bdf2e
---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     | 9 ++-------
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h | 1 -
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c        | 7 -------
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h        | 1 -
 drivers/gpu/drm/amd/pm/swsmu/smu_internal.h   | 2 +-
 5 files changed, 3 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -7
index aceb6e56bc6a..62c757c79f25 100644
@@ -1348,9 +1348,7 @@ static int smu_disable_dpms(struct smu_context *smu)
 		case IP_VERSION(11, 5, 0):
 		case IP_VERSION(11, 0, 12):
 		case IP_VERSION(11, 0, 13):
-			return smu_disable_all_features_with_exception(smu,
-								       true,
-								       SMU_FEATURE_COUNT);
+			return 0;
 		default:
 			break;
 		}
@@ -1366,9 +1364,7 @@ static int smu_disable_dpms(struct smu_context *smu)
 		case IP_VERSION(11, 0, 0):
 		case IP_VERSION(11, 0, 5):
 		case IP_VERSION(11, 0, 9):
-			return smu_disable_all_features_with_exception(smu,
-								       true,
-								       SMU_FEATURE_BACO_BIT);
+			return 0;
 		default:
 			break;
 		}
@@ -1380,7 +1376,6 @@ static int smu_disable_dpms(struct smu_context *smu)
 	 */
 	if (use_baco && smu_feature_is_enabled(smu, SMU_FEATURE_BACO_BIT)) {
 		ret = smu_disable_all_features_with_exception(smu,
-							      false,
 							      SMU_FEATURE_BACO_BIT);
 		if (ret)
 			dev_err(adev->dev, "Failed to disable smu features except BACO.\n");
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -1
index 4ba579cdd203..76849c0d8df6 100644
@@ -989,7 +989,6 @@ struct pptable_funcs {
 	 *                                       exception to those in &mask.
 	 */
 	int (*disable_all_features_with_exception)(struct smu_context *smu,
-						   bool no_hw_disablement,
 						   enum smu_feature_mask mask);
 
 	/**
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0 -7
index e54c59f3e8c2..90fd722cbaef 100644
@@ -748,9 +748,6 @@ int smu_cmn_set_pp_feature_mask(struct smu_context *smu,
  *                                               @mask
  *
  * @smu:               smu_context pointer
- * @no_hw_disablement: whether real dpm disablement should be performed
- *                     true: update the cache(about dpm enablement state) only
- *                     false: real dpm disablement plus cache update
  * @mask:              the dpm feature which should not be disabled
  *                     SMU_FEATURE_COUNT: no exception, all dpm features
  *                     to disable
@@ -759,7 +756,6 @@ int smu_cmn_set_pp_feature_mask(struct smu_context *smu,
  * 0 on success or a negative error code on failure.
  */
 int smu_cmn_disable_all_features_with_exception(struct smu_context *smu,
-						bool no_hw_disablement,
 						enum smu_feature_mask mask)
 {
 	uint64_t features_to_disable = U64_MAX;
@@ -775,9 +771,6 @@ int smu_cmn_disable_all_features_with_exception(struct smu_context *smu,
 		features_to_disable &= ~(1ULL << skipped_feature_id);
 	}
 
-	if (no_hw_disablement)
-		return 0;
-
 	return smu_cmn_feature_update_enable_state(smu,
 						   features_to_disable,
 						   0);
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h +0 -1
index 98190ed5360f..c1423784ab96 100644
@@ -76,7 +76,6 @@ int smu_cmn_set_pp_feature_mask(struct smu_context *smu,
 				uint64_t new_mask);
 
 int smu_cmn_disable_all_features_with_exception(struct smu_context *smu,
-						bool no_hw_disablement,
 						enum smu_feature_mask mask);
 
 int smu_cmn_get_smc_version(struct smu_context *smu,
drivers/gpu/drm/amd/pm/swsmu/smu_internal.h +1 -1
index 2f9aff89f667..be473478b45a 100644
@@ -57,7 +57,7 @@
 #define smu_feature_set_allowed_mask(smu)				smu_ppt_funcs(set_allowed_mask, 0, smu)
 #define smu_feature_get_enabled_mask(smu, mask)				smu_ppt_funcs(get_enabled_mask, 0, smu, mask)
 #define smu_feature_is_enabled(smu, mask)				smu_ppt_funcs(feature_is_enabled, 0, smu, mask)
-#define smu_disable_all_features_with_exception(smu, no_hw_disablement, mask)		smu_ppt_funcs(disable_all_features_with_exception, 0, smu, no_hw_disablement, mask)
+#define smu_disable_all_features_with_exception(smu, mask)		smu_ppt_funcs(disable_all_features_with_exception, 0, smu, mask)
 #define smu_is_dpm_running(smu)						smu_ppt_funcs(is_dpm_running, 0 , smu)
 #define smu_notify_display_change(smu)					smu_ppt_funcs(notify_display_change, 0, smu)
 #define smu_populate_umd_state_clk(smu)					smu_ppt_funcs(populate_umd_state_clk, 0, smu)
Signature · 1 line
2.29.0