AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Huang Rui <ray.huang-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Likun Gao <Likun.Gao-5C7GfCeVMHo@public.gmane.org>,
	Kevin Wang <Kevin1.Wang-5C7GfCeVMHo@public.gmane.org>,
	Chengming Gui <Jack.Gui-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 106/138] drm/amd/powerplay: add function to set default overdrive settings
Date: Fri, 25 Jan 2019 18:25:13 +0800	[thread overview]
Message-ID: <1548411945-12396-107-git-send-email-ray.huang@amd.com> (raw)
In-Reply-To: <1548411945-12396-1-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org>

From: Likun Gao <Likun.Gao@amd.com>

Add function of vega20_set_default_od8_setttings for vega20 with smu11
arch to setup default overdrive value.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c     |  14 ++
 drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h |   8 +
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c      |  84 ++++------
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c     | 203 +++++++++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/vega20_ppt.h     |  51 +++++++
 5 files changed, 309 insertions(+), 51 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 3cc26ad..f4b6ae2 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -526,6 +526,10 @@ static int smu_smc_table_hw_init(struct smu_context *smu)
 	if (ret)
 		return ret;
 
+	ret = smu_set_od8_default_settings(smu);
+	if (ret)
+		return ret;
+
 	ret = smu_populate_umd_state_clk(smu);
 	if (ret)
 		return ret;
@@ -697,6 +701,16 @@ static int smu_hw_fini(void *handle)
 		table_context->od_settings_min = NULL;
 	}
 
+	if (table_context->overdrive_table) {
+		kfree(table_context->overdrive_table);
+		table_context->overdrive_table = NULL;
+	}
+
+	if (table_context->od8_settings) {
+		kfree(table_context->od8_settings);
+		table_context->od8_settings = NULL;
+	}
+
 	ret = smu_fini_fb_allocations(smu);
 	if (ret)
 		return ret;
diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
index 2723955..ef8e301 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
@@ -196,6 +196,8 @@ struct smu_table_context
 	uint8_t				*od_feature_capabilities;
 	uint32_t			*od_settings_max;
 	uint32_t			*od_settings_min;
+	void				*overdrive_table;
+	void				*od8_settings;
 };
 
 struct smu_dpm_context {
@@ -258,6 +260,7 @@ struct pptable_funcs {
 	int (*populate_umd_state_clk)(struct smu_context *smu);
 	int (*print_clk_levels)(struct smu_context *smu, enum pp_clock_type type, char *buf);
 	int (*force_clk_levels)(struct smu_context *smu, enum pp_clock_type type, uint32_t mask);
+	int (*set_default_od8_settings)(struct smu_context *smu);
 	int (*get_clock_by_type_with_latency)(struct smu_context *smu,
 					      enum amd_pp_clock_type type,
 					      struct
@@ -331,6 +334,7 @@ struct smu_funcs
 	int (*notify_smu_enable_pwe)(struct smu_context *smu);
 	int (*set_watermarks_for_clock_ranges)(struct smu_context *smu,
 					       struct dm_pp_wm_sets_with_clock_ranges_soc15 *clock_ranges);
+	int (*set_od8_default_settings)(struct smu_context *smu);
 };
 
 #define smu_init_microcode(smu) \
@@ -377,6 +381,8 @@ struct smu_funcs
 	((smu)->funcs->system_features_control ? (smu)->funcs->system_features_control((smu), (en)) : 0)
 #define smu_init_max_sustainable_clocks(smu) \
 	((smu)->funcs->init_max_sustainable_clocks ? (smu)->funcs->init_max_sustainable_clocks((smu)) : 0)
+#define smu_set_od8_default_settings(smu) \
+	((smu)->funcs->set_od8_default_settings ? (smu)->funcs->set_od8_default_settings((smu)) : 0)
 #define smu_send_smc_msg(smu, msg) \
 	((smu)->funcs->send_smc_msg? (smu)->funcs->send_smc_msg((smu), (msg)) : 0)
 #define smu_send_smc_msg_with_param(smu, msg, param) \
@@ -407,6 +413,8 @@ struct smu_funcs
 	((smu)->ppt_funcs->set_default_dpm_table ? (smu)->ppt_funcs->set_default_dpm_table((smu)) : 0)
 #define smu_populate_umd_state_clk(smu) \
 	((smu)->ppt_funcs->populate_umd_state_clk ? (smu)->ppt_funcs->populate_umd_state_clk((smu)) : 0)
+#define smu_set_default_od8_settings(smu) \
+	((smu)->ppt_funcs->set_default_od8_settings ? (smu)->ppt_funcs->set_default_od8_settings((smu)) : 0)
 #define smu_get_power_limit(smu) \
 	((smu)->funcs->get_power_limit? (smu)->funcs->get_power_limit((smu)) : 0)
 #define smu_get_current_clk_freq(smu, clk_id, value) \
diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
index f5e18a2..3c4c327e 100644
--- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
@@ -542,61 +542,12 @@ static int smu_v11_0_populate_smc_pptable(struct smu_context *smu)
 	return ret;
 }
 
-static int smu_v11_0_copy_table_to_smc(struct smu_context *smu,
-				       uint32_t table_id)
-{
-	struct smu_table_context *table_context = &smu->smu_table;
-	struct smu_table *driver_pptable = &smu->smu_table.tables[table_id];
-	int ret = 0;
-
-	if (table_id >= TABLE_COUNT) {
-		pr_err("Invalid SMU Table ID for smu11!");
-		return -EINVAL;
-	}
-
-	if (!driver_pptable->cpu_addr) {
-		pr_err("Invalid virtual address for smu11!");
-		return -EINVAL;
-	}
-	if (!driver_pptable->mc_address) {
-		pr_err("Invalid MC address for smu11!");
-		return -EINVAL;
-	}
-	if (!driver_pptable->size) {
-		pr_err("Invalid SMU Table size for smu11!");
-		return -EINVAL;
-	}
-
-	memcpy(driver_pptable->cpu_addr, table_context->driver_pptable,
-	       driver_pptable->size);
-
-	ret = smu_send_smc_msg_with_param(smu, SMU_MSG_SetDriverDramAddrHigh,
-			upper_32_bits(driver_pptable->mc_address));
-	if (ret) {
-		pr_err("[CopyTableToSMC] Attempt to Set Dram Addr High Failed!");
-		return ret;
-	}
-	ret = smu_send_smc_msg_with_param(smu, SMU_MSG_SetDriverDramAddrLow,
-			lower_32_bits(driver_pptable->mc_address));
-	if (ret) {
-		pr_err("[CopyTableToSMC] Attempt to Set Dram Addr Low Failed!");
-		return ret;
-	}
-	ret = smu_send_smc_msg_with_param(smu, SMU_MSG_TransferTableDram2Smu,
-					  table_id);
-	if (ret) {
-		pr_err("[CopyTableToSMC] Attempt to Transfer Table To SMU Failed!");
-		return ret;
-	}
-
-	return 0;
-}
-
 static int smu_v11_0_write_pptable(struct smu_context *smu)
 {
+	struct smu_table_context *table_context = &smu->smu_table;
 	int ret = 0;
 
-	ret = smu_v11_0_copy_table_to_smc(smu, TABLE_PPTABLE);
+	ret = smu_update_table(smu, TABLE_PPTABLE, table_context->driver_pptable, true);
 
 	return ret;
 }
@@ -1245,6 +1196,36 @@ smu_v11_0_set_watermarks_for_clock_ranges(struct smu_context *smu, struct
 	return ret;
 }
 
+static int smu_v11_0_set_od8_default_settings(struct smu_context *smu)
+{
+	struct smu_table_context *table_context = &smu->smu_table;
+	int ret;
+
+	if (table_context->overdrive_table)
+		 return -EINVAL;
+
+	table_context->overdrive_table = kzalloc(sizeof(OverDriveTable_t), GFP_KERNEL);
+
+	if (!table_context->overdrive_table)
+		return -ENOMEM;
+
+	ret = smu_update_table(smu, TABLE_OVERDRIVE, table_context->overdrive_table, false);
+	if (ret) {
+		pr_err("Failed to export over drive table!\n");
+		return ret;
+	}
+
+	smu_set_default_od8_settings(smu);
+
+	ret = smu_update_table(smu, TABLE_OVERDRIVE, table_context->overdrive_table, true);
+	if (ret) {
+		pr_err("Failed to import over drive table!\n");
+		return ret;
+	}
+
+	return 0;
+}
+
 static const struct smu_funcs smu_v11_0_funcs = {
 	.init_microcode = smu_v11_0_init_microcode,
 	.load_microcode = smu_v11_0_load_microcode,
@@ -1281,6 +1262,7 @@ static const struct smu_funcs smu_v11_0_funcs = {
 	.set_deep_sleep_dcefclk = smu_v11_0_set_deep_sleep_dcefclk,
 	.display_clock_voltage_request = smu_v11_0_display_clock_voltage_request,
 	.set_watermarks_for_clock_ranges = smu_v11_0_set_watermarks_for_clock_ranges,
+	.set_od8_default_settings = smu_v11_0_set_od8_default_settings,
 };
 
 void smu_v11_0_set_smu_funcs(struct smu_context *smu)
diff --git a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
index df34953..c398899 100644
--- a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
@@ -904,6 +904,208 @@ static int vega20_get_clock_by_type_with_latency(struct smu_context *smu,
 	return ret;
 }
 
+static int vega20_overdrive_get_gfx_clk_base_voltage(struct smu_context *smu,
+						     uint32_t *voltage,
+						     uint32_t freq)
+{
+	int ret;
+
+	ret = smu_send_smc_msg_with_param(smu,
+			SMU_MSG_GetAVFSVoltageByDpm,
+			((AVFS_CURVE << 24) | (OD8_HOTCURVE_TEMPERATURE << 16) | freq));
+	if (ret) {
+		pr_err("[GetBaseVoltage] failed to get GFXCLK AVFS voltage from SMU!");
+		return ret;
+	}
+
+	smu_read_smc_arg(smu, voltage);
+	*voltage = *voltage / VOLTAGE_SCALE;
+
+	return 0;
+}
+
+static int vega20_set_default_od8_setttings(struct smu_context *smu)
+{
+	struct smu_table_context *table_context = &smu->smu_table;
+	OverDriveTable_t *od_table = (OverDriveTable_t *)(table_context->overdrive_table);
+	struct vega20_od8_settings *od8_settings = NULL;
+	PPTable_t *smc_pptable = table_context->driver_pptable;
+	int i, ret;
+
+	if (table_context->od8_settings)
+		return -EINVAL;
+
+	table_context->od8_settings = kzalloc(sizeof(struct vega20_od8_settings), GFP_KERNEL);
+
+	if (!table_context->od8_settings)
+		return -ENOMEM;
+
+	memset(table_context->od8_settings, 0, sizeof(struct vega20_od8_settings));
+	od8_settings = (struct vega20_od8_settings *)table_context->od8_settings;
+
+	if (smu_feature_is_enabled(smu, FEATURE_DPM_SOCCLK_BIT)) {
+		if (table_context->od_feature_capabilities[ATOM_VEGA20_ODFEATURE_GFXCLK_LIMITS] &&
+		    table_context->od_settings_max[OD8_SETTING_GFXCLK_FMAX] > 0 &&
+		    table_context->od_settings_min[OD8_SETTING_GFXCLK_FMIN] > 0 &&
+		    (table_context->od_settings_max[OD8_SETTING_GFXCLK_FMAX] >=
+		     table_context->od_settings_min[OD8_SETTING_GFXCLK_FMIN])) {
+			od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_FMIN].feature_id =
+				OD8_GFXCLK_LIMITS;
+			od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_FMAX].feature_id =
+				OD8_GFXCLK_LIMITS;
+			od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_FMIN].default_value =
+				od_table->GfxclkFmin;
+			od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_FMAX].default_value =
+				od_table->GfxclkFmax;
+		}
+
+		if (table_context->od_feature_capabilities[ATOM_VEGA20_ODFEATURE_GFXCLK_CURVE] &&
+		    (table_context->od_settings_min[OD8_SETTING_GFXCLK_VOLTAGE1] >=
+		     smc_pptable->MinVoltageGfx / VOLTAGE_SCALE) &&
+		    (table_context->od_settings_max[OD8_SETTING_GFXCLK_VOLTAGE3] <=
+		     smc_pptable->MaxVoltageGfx / VOLTAGE_SCALE) &&
+		    (table_context->od_settings_min[OD8_SETTING_GFXCLK_VOLTAGE1] <=
+		     table_context->od_settings_max[OD8_SETTING_GFXCLK_VOLTAGE3])) {
+			od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_FREQ1].feature_id =
+				OD8_GFXCLK_CURVE;
+			od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_VOLTAGE1].feature_id =
+				OD8_GFXCLK_CURVE;
+			od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_FREQ2].feature_id =
+				OD8_GFXCLK_CURVE;
+			od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_VOLTAGE2].feature_id =
+				OD8_GFXCLK_CURVE;
+			od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_FREQ3].feature_id =
+				OD8_GFXCLK_CURVE;
+			od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_VOLTAGE3].feature_id =
+				OD8_GFXCLK_CURVE;
+
+			od_table->GfxclkFreq1 = od_table->GfxclkFmin;
+			od_table->GfxclkFreq2 = (od_table->GfxclkFmin + od_table->GfxclkFmax) / 2;
+			od_table->GfxclkFreq3 = od_table->GfxclkFmax;
+			od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_FREQ1].default_value =
+				od_table->GfxclkFreq1;
+			od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_FREQ2].default_value =
+				od_table->GfxclkFreq2;
+			od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_FREQ3].default_value =
+				od_table->GfxclkFreq3;
+
+			ret = vega20_overdrive_get_gfx_clk_base_voltage(smu,
+				&od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_VOLTAGE1].default_value,
+				od_table->GfxclkFreq1);
+			if (ret)
+				od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_VOLTAGE1].default_value = 0;
+			od_table->GfxclkVolt1 =
+				od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_VOLTAGE1].default_value
+				* VOLTAGE_SCALE;
+			ret = vega20_overdrive_get_gfx_clk_base_voltage(smu,
+				&od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_VOLTAGE2].default_value,
+				od_table->GfxclkFreq2);
+			if (ret)
+				od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_VOLTAGE2].default_value = 0;
+			od_table->GfxclkVolt2 =
+				od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_VOLTAGE2].default_value
+				* VOLTAGE_SCALE;
+			ret = vega20_overdrive_get_gfx_clk_base_voltage(smu,
+				&od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_VOLTAGE3].default_value,
+				od_table->GfxclkFreq3);
+			if (ret)
+				od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_VOLTAGE3].default_value = 0;
+			od_table->GfxclkVolt3 =
+				od8_settings->od8_settings_array[OD8_SETTING_GFXCLK_VOLTAGE3].default_value
+				* VOLTAGE_SCALE;
+		}
+	}
+
+	if (smu_feature_is_enabled(smu, FEATURE_DPM_UCLK_BIT)) {
+		if (table_context->od_feature_capabilities[ATOM_VEGA20_ODFEATURE_UCLK_MAX] &&
+		    table_context->od_settings_min[OD8_SETTING_UCLK_FMAX] > 0 &&
+		    table_context->od_settings_max[OD8_SETTING_UCLK_FMAX] > 0 &&
+		    (table_context->od_settings_max[OD8_SETTING_UCLK_FMAX] >=
+		     table_context->od_settings_min[OD8_SETTING_UCLK_FMAX])) {
+			od8_settings->od8_settings_array[OD8_SETTING_UCLK_FMAX].feature_id =
+				OD8_UCLK_MAX;
+			od8_settings->od8_settings_array[OD8_SETTING_UCLK_FMAX].default_value =
+				od_table->UclkFmax;
+		}
+	}
+
+	if (table_context->od_feature_capabilities[ATOM_VEGA20_ODFEATURE_POWER_LIMIT] &&
+	    table_context->od_settings_min[OD8_SETTING_POWER_PERCENTAGE] > 0 &&
+	    table_context->od_settings_min[OD8_SETTING_POWER_PERCENTAGE] <= 100 &&
+	    table_context->od_settings_max[OD8_SETTING_POWER_PERCENTAGE] > 0 &&
+	    table_context->od_settings_max[OD8_SETTING_POWER_PERCENTAGE] <= 100) {
+		od8_settings->od8_settings_array[OD8_SETTING_POWER_PERCENTAGE].feature_id =
+			OD8_POWER_LIMIT;
+		od8_settings->od8_settings_array[OD8_SETTING_POWER_PERCENTAGE].default_value =
+			od_table->OverDrivePct;
+	}
+
+	if (smu_feature_is_enabled(smu, FEATURE_FAN_CONTROL_BIT)) {
+		if (table_context->od_feature_capabilities[ATOM_VEGA20_ODFEATURE_FAN_ACOUSTIC_LIMIT] &&
+		    table_context->od_settings_min[OD8_SETTING_FAN_ACOUSTIC_LIMIT] > 0 &&
+		    table_context->od_settings_max[OD8_SETTING_FAN_ACOUSTIC_LIMIT] > 0 &&
+		    (table_context->od_settings_max[OD8_SETTING_FAN_ACOUSTIC_LIMIT] >=
+		     table_context->od_settings_min[OD8_SETTING_FAN_ACOUSTIC_LIMIT])) {
+			od8_settings->od8_settings_array[OD8_SETTING_FAN_ACOUSTIC_LIMIT].feature_id =
+				OD8_ACOUSTIC_LIMIT_SCLK;
+			od8_settings->od8_settings_array[OD8_SETTING_FAN_ACOUSTIC_LIMIT].default_value =
+				od_table->FanMaximumRpm;
+		}
+
+		if (table_context->od_feature_capabilities[ATOM_VEGA20_ODFEATURE_FAN_SPEED_MIN] &&
+		    table_context->od_settings_min[OD8_SETTING_FAN_MIN_SPEED] > 0 &&
+		    table_context->od_settings_max[OD8_SETTING_FAN_MIN_SPEED] > 0 &&
+		    (table_context->od_settings_max[OD8_SETTING_FAN_MIN_SPEED] >=
+		     table_context->od_settings_min[OD8_SETTING_FAN_MIN_SPEED])) {
+			od8_settings->od8_settings_array[OD8_SETTING_FAN_MIN_SPEED].feature_id =
+				OD8_FAN_SPEED_MIN;
+			od8_settings->od8_settings_array[OD8_SETTING_FAN_MIN_SPEED].default_value =
+				od_table->FanMinimumPwm * smc_pptable->FanMaximumRpm / 100;
+		}
+	}
+
+	if (smu_feature_is_enabled(smu, FEATURE_THERMAL_BIT)) {
+		if (table_context->od_feature_capabilities[ATOM_VEGA20_ODFEATURE_TEMPERATURE_FAN] &&
+		    table_context->od_settings_min[OD8_SETTING_FAN_TARGET_TEMP] > 0 &&
+		    table_context->od_settings_max[OD8_SETTING_FAN_TARGET_TEMP] > 0 &&
+		    (table_context->od_settings_max[OD8_SETTING_FAN_TARGET_TEMP] >=
+		     table_context->od_settings_min[OD8_SETTING_FAN_TARGET_TEMP])) {
+			od8_settings->od8_settings_array[OD8_SETTING_FAN_TARGET_TEMP].feature_id =
+				OD8_TEMPERATURE_FAN;
+			od8_settings->od8_settings_array[OD8_SETTING_FAN_TARGET_TEMP].default_value =
+				od_table->FanTargetTemperature;
+		}
+
+		if (table_context->od_feature_capabilities[ATOM_VEGA20_ODFEATURE_TEMPERATURE_SYSTEM] &&
+		    table_context->od_settings_min[OD8_SETTING_OPERATING_TEMP_MAX] > 0 &&
+		    table_context->od_settings_max[OD8_SETTING_OPERATING_TEMP_MAX] > 0 &&
+		    (table_context->od_settings_max[OD8_SETTING_OPERATING_TEMP_MAX] >=
+		     table_context->od_settings_min[OD8_SETTING_OPERATING_TEMP_MAX])) {
+			od8_settings->od8_settings_array[OD8_SETTING_OPERATING_TEMP_MAX].feature_id =
+				OD8_TEMPERATURE_SYSTEM;
+			od8_settings->od8_settings_array[OD8_SETTING_OPERATING_TEMP_MAX].default_value =
+				od_table->MaxOpTemp;
+		}
+	}
+
+	for (i = 0; i < OD8_SETTING_COUNT; i++) {
+		if (od8_settings->od8_settings_array[i].feature_id) {
+			od8_settings->od8_settings_array[i].min_value =
+				table_context->od_settings_min[i];
+			od8_settings->od8_settings_array[i].max_value =
+				table_context->od_settings_max[i];
+			od8_settings->od8_settings_array[i].current_value =
+				od8_settings->od8_settings_array[i].default_value;
+		} else {
+			od8_settings->od8_settings_array[i].min_value = 0;
+			od8_settings->od8_settings_array[i].max_value = 0;
+			od8_settings->od8_settings_array[i].current_value = 0;
+		}
+	}
+
+	return 0;
+}
+
 static const struct pptable_funcs vega20_ppt_funcs = {
 	.alloc_dpm_context = vega20_allocate_dpm_context,
 	.store_powerplay_table = vega20_store_powerplay_table,
@@ -917,6 +1119,7 @@ static const struct pptable_funcs vega20_ppt_funcs = {
 	.print_clk_levels = vega20_print_clk_levels,
 	.force_clk_levels = vega20_force_clk_levels,
 	.get_clock_by_type_with_latency = vega20_get_clock_by_type_with_latency,
+	.set_default_od8_settings = vega20_set_default_od8_setttings,
 };
 
 void vega20_set_ppt_funcs(struct smu_context *smu)
diff --git a/drivers/gpu/drm/amd/powerplay/vega20_ppt.h b/drivers/gpu/drm/amd/powerplay/vega20_ppt.h
index ceba4f7..9b229b2 100644
--- a/drivers/gpu/drm/amd/powerplay/vega20_ppt.h
+++ b/drivers/gpu/drm/amd/powerplay/vega20_ppt.h
@@ -29,6 +29,10 @@
 #define MAX_REGULAR_DPM_NUMBER 16
 #define MAX_PCIE_CONF 2
 
+#define VOLTAGE_SCALE 4
+#define AVFS_CURVE 0
+#define OD8_HOTCURVE_TEMPERATURE 85
+
 struct vega20_dpm_level {
         bool            enabled;
         uint32_t        value;
@@ -70,6 +74,53 @@ struct vega20_dpm_table {
         struct vega20_pcie_table        pcie_table;
 };
 
+enum OD8_FEATURE_ID
+{
+	OD8_GFXCLK_LIMITS               = 1 << 0,
+	OD8_GFXCLK_CURVE                = 1 << 1,
+	OD8_UCLK_MAX                    = 1 << 2,
+	OD8_POWER_LIMIT                 = 1 << 3,
+	OD8_ACOUSTIC_LIMIT_SCLK         = 1 << 4,   //FanMaximumRpm
+	OD8_FAN_SPEED_MIN               = 1 << 5,   //FanMinimumPwm
+	OD8_TEMPERATURE_FAN             = 1 << 6,   //FanTargetTemperature
+	OD8_TEMPERATURE_SYSTEM          = 1 << 7,   //MaxOpTemp
+	OD8_MEMORY_TIMING_TUNE          = 1 << 8,
+	OD8_FAN_ZERO_RPM_CONTROL        = 1 << 9
+};
+
+enum OD8_SETTING_ID
+{
+	OD8_SETTING_GFXCLK_FMIN = 0,
+	OD8_SETTING_GFXCLK_FMAX,
+	OD8_SETTING_GFXCLK_FREQ1,
+	OD8_SETTING_GFXCLK_VOLTAGE1,
+	OD8_SETTING_GFXCLK_FREQ2,
+	OD8_SETTING_GFXCLK_VOLTAGE2,
+	OD8_SETTING_GFXCLK_FREQ3,
+	OD8_SETTING_GFXCLK_VOLTAGE3,
+	OD8_SETTING_UCLK_FMAX,
+	OD8_SETTING_POWER_PERCENTAGE,
+	OD8_SETTING_FAN_ACOUSTIC_LIMIT,
+	OD8_SETTING_FAN_MIN_SPEED,
+	OD8_SETTING_FAN_TARGET_TEMP,
+	OD8_SETTING_OPERATING_TEMP_MAX,
+	OD8_SETTING_AC_TIMING,
+	OD8_SETTING_FAN_ZERO_RPM_CONTROL,
+	OD8_SETTING_COUNT
+};
+
+struct vega20_od8_single_setting {
+	uint32_t	feature_id;
+	int32_t		min_value;
+	int32_t		max_value;
+	int32_t		current_value;
+	int32_t		default_value;
+};
+
+struct vega20_od8_settings {
+	struct vega20_od8_single_setting	od8_settings_array[OD8_SETTING_COUNT];
+};
+
 extern void vega20_set_ppt_funcs(struct smu_context *smu);
 
 #endif
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2019-01-25 10:25 UTC|newest]

Thread overview: 141+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-25 10:23 [PATCH 000/138] The new SW SMU driver of amdgpu Huang Rui
     [not found] ` <1548411945-12396-1-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org>
2019-01-25 10:23   ` [PATCH 001/138] drm/amd/powerplay: add new smu ip block Huang Rui
2019-01-25 10:23   ` [PATCH 002/138] drm/amd/powerplay: add smu11 sub block for SMU IP Huang Rui
2019-01-25 10:23   ` [PATCH 003/138] drm/amd/powerplay: add firmware loading interface Huang Rui
2019-01-25 10:23   ` [PATCH 004/138] drm/amd/powerplay: add fw load checking interface Huang Rui
2019-01-25 10:23   ` [PATCH 005/138] drm/amd/powerplay: add interface to read pptable from vbios Huang Rui
2019-01-25 10:23   ` [PATCH 006/138] drm/amd/powerplay: add placeholder of smu_initialize_pptable Huang Rui
2019-01-25 10:23   ` [PATCH 007/138] drm/amd/powerplay: add interface to init smc tables (v2) Huang Rui
2019-01-25 10:23   ` [PATCH 008/138] drm/amd/powerplay: add interface to init power (v2) Huang Rui
2019-01-25 10:23   ` [PATCH 009/138] drm/amd/powerplay: add interface to get vbios bootup values (v2) Huang Rui
2019-01-25 10:23   ` [PATCH 010/138] drm/amd/powerplay: add interface to check pptable (v2) Huang Rui
2019-01-25 10:23   ` [PATCH 011/138] drm/amd/powerplay: add interface to init fb allocations (v2) Huang Rui
2019-01-25 10:23   ` [PATCH 012/138] drm/amd/powerplay: add interface to parse pptable (v2) Huang Rui
2019-01-25 10:23   ` [PATCH 013/138] drm/amd/powerplay: add interface to populate smc " Huang Rui
2019-01-25 10:23   ` [PATCH 014/138] drm/amd/powerplay: add interface to check fw version (v2) Huang Rui
2019-01-25 10:23   ` [PATCH 015/138] drm/amd/powerplay: add interface to write pptable (v2) Huang Rui
2019-01-25 10:23   ` [PATCH 016/138] drm/amd/powerplay: add interface to set min dcef deep sleep (v2) Huang Rui
2019-01-25 10:23   ` [PATCH 017/138] drm/amd/powerplay: add interface to set tool table location (v2) Huang Rui
2019-01-25 10:23   ` [PATCH 018/138] drm/amd/powerplay: add interface to allocate memory pool (v2) Huang Rui
2019-01-25 10:23   ` [PATCH 019/138] drm/amd/powerplay: add interface to notify memory pool location (v2) Huang Rui
2019-01-25 10:23   ` [PATCH 020/138] drm/amd/powerplay: add interfaces for smu resume Huang Rui
2019-01-25 10:23   ` [PATCH 021/138] drm/amd/powerplay: add resume sequence placeholder for smu ip block Huang Rui
2019-01-25 10:23   ` [PATCH 022/138] drm/amdgpu: enable new smu ip block for vega20 Huang Rui
2019-01-25 10:23   ` [PATCH 023/138] drm/amd/powerplay: init microcode for smu11 Huang Rui
2019-01-25 10:23   ` [PATCH 024/138] drm/amd/powerplay: add new ppsmc header for smu11 (v2) Huang Rui
2019-01-25 10:23   ` [PATCH 025/138] drm/amd/powerplay: implement smu send message functions for smu11 (v3) Huang Rui
2019-01-25 10:23   ` [PATCH 026/138] drm/amd/powerplay: implement check_fw_status function for smu11 Huang Rui
2019-01-25 10:23   ` [PATCH 027/138] drm/amd/powerplay: implement check_fw_version " Huang Rui
2019-01-25 10:23   ` [PATCH 028/138] drm/amd/powerplay: add pptable header " Huang Rui
2019-01-25 10:23   ` [PATCH 029/138] drm/amdgpu: update atomfirmware " Huang Rui
2019-01-25 10:23   ` [PATCH 030/138] drm/amdgpu: update new members in atomfirmware Huang Rui
2019-01-25 10:23   ` [PATCH 031/138] drm/amd/powerplay: add smu table context structure Huang Rui
2019-01-25 10:23   ` [PATCH 032/138] drm/amd/powerplay: add get atom data table helper Huang Rui
2019-01-25 10:24   ` [PATCH 033/138] drm/amdgpu: move get_index_into_master_table macro into atomfirmware header Huang Rui
2019-01-25 10:24   ` [PATCH 034/138] drm/amd/powerplay: implement read_pptable_from_vbios function for smu11 Huang Rui
2019-01-25 10:24   ` [PATCH 035/138] drm/amd/powerplay: implement smu_init[fini]_smc_tables " Huang Rui
2019-01-25 10:24   ` [PATCH 036/138] drm/amd/powerplay: implement smu dpm context functions " Huang Rui
2019-01-25 10:24   ` [PATCH 037/138] drm/amd/powerplay: implement smu_init[fini]_power function " Huang Rui
2019-01-25 10:24   ` [PATCH 038/138] drm/amd/powerplay: implement smu_init(fini)_fb_allocations function Huang Rui
2019-01-25 10:24   ` [PATCH 039/138] drm/amd/powerplay: remove header of smu_v11_0_pptable Huang Rui
2019-01-25 10:24   ` [PATCH 040/138] drm/amd/powerplay: update pptable header for smu11 Huang Rui
2019-01-25 10:24   ` [PATCH 041/138] drm/amd/powerplay: add data structure of bootup values Huang Rui
2019-01-25 10:24   ` [PATCH 042/138] drm/amd/powerplay: implement get_vbios_bootup_values function for smu11 (v2) Huang Rui
2019-01-25 10:24   ` [PATCH 043/138] drm/amd/powerplay: implement get_clk_info_from_vbios " Huang Rui
2019-01-25 10:24   ` [PATCH 044/138] drm/amd/powerplay: implement smu_alloc[free]_memory pool function Huang Rui
2019-01-25 10:24   ` [PATCH 045/138] drm/amd/powerplay: implement notify_memory_pool_location function for smu11 Huang Rui
2019-01-25 10:24   ` [PATCH 046/138] drm/amd/powerplay: add vega20 pptable function file Huang Rui
2019-01-25 10:24   ` [PATCH 047/138] drm/amd/powerplay: add function to parse pptable for smu11 Huang Rui
2019-01-25 10:24   ` [PATCH 048/138] drm/amd/powerplay: add function to check " Huang Rui
2019-01-25 10:24   ` [PATCH 049/138] drm/amd/powerplay: update hw fini function to relase some memory Huang Rui
2019-01-25 10:24   ` [PATCH 050/138] drm/amd/powerplay: add function to populate smc pptable for smu11 Huang Rui
2019-01-25 10:24   ` [PATCH 051/138] drm/amd/powerplay: add function to write pptable for smu11 (v2) Huang Rui
2019-01-25 10:24   ` [PATCH 052/138] drm/amd/powerplay: add function to set min dcef deep sleep " Huang Rui
2019-01-25 10:24   ` [PATCH 053/138] drm/amd/powerplay: add function to set tool table location " Huang Rui
2019-01-25 10:24   ` [PATCH 054/138] drm/amd/powerplay: add enum smu_msg_type to header Huang Rui
2019-01-25 10:24   ` [PATCH 055/138] drm/amd/powerplay: implement smu vega20_message_map for vega20 Huang Rui
2019-01-25 10:24   ` [PATCH 056/138] drm/amd/powerplay: use virtual msg index to replace asic-related msg index Huang Rui
2019-01-25 10:24   ` [PATCH 057/138] drm/amd/powerplay: replace SMU_MSG_XXX with PPSMC_MSG_XXX message index for smu11 (v2) Huang Rui
2019-01-25 10:24   ` [PATCH 058/138] drm/amd/powerplay: add append_powerplay_table function Huang Rui
2019-01-25 10:24   ` [PATCH 059/138] drm/amd/powerplay: expose the function of smu read argument Huang Rui
2019-01-25 10:24   ` [PATCH 060/138] drm/amd/powerplay: Change the allocate method of dpm context for smu11 Huang Rui
2019-01-25 10:24   ` [PATCH 061/138] drm/amd/powerplay: implement smu_init_display " Huang Rui
2019-01-25 10:24   ` [PATCH 062/138] drm/amd/powerplay: implement smu_run_afll_btc function Huang Rui
2019-01-25 10:24   ` [PATCH 063/138] drm/amd/powerplay: implement smu feature functions Huang Rui
2019-01-25 10:24   ` [PATCH 064/138] drm/amd/powerplay: implement feature get&set functions Huang Rui
2019-01-25 10:24   ` [PATCH 065/138] drm/amd/powerplay: implement smu_notify_display_change function for smu11 Huang Rui
2019-01-25 10:24   ` [PATCH 066/138] drm/amd/powerplay: set defalut dpm table for smu Huang Rui
2019-01-25 10:24   ` [PATCH 067/138] drm/amd/powerplay: add function to populate umd state clk Huang Rui
2019-01-25 10:24   ` [PATCH 068/138] drm/amd/powerplay: add function to get power limit for smu11 (v2) Huang Rui
2019-01-25 10:24   ` [PATCH 069/138] drm/amd/powerplay: implement get_current_clk_freq for smu11 Huang Rui
2019-01-25 10:24   ` [PATCH 070/138] drm/amd/powerplay: print clock levels for smu11 (v2) Huang Rui
2019-01-25 10:24   ` [PATCH 071/138] drm/amd/powerplay: add get_max_sustainable_clock function Huang Rui
2019-01-25 10:24   ` [PATCH 072/138] drm/amd/powerplay: add function to get thermal range Huang Rui
2019-01-25 10:24   ` [PATCH 073/138] drm/amd/powerplay: add function to set " Huang Rui
2019-01-25 10:24   ` [PATCH 074/138] drm/amd/powerplay: add function to enable thermal alert Huang Rui
2019-01-25 10:24   ` [PATCH 075/138] drm/amd/powerplay: add function to set fan table to control thermal Huang Rui
2019-01-25 10:24   ` [PATCH 076/138] drm/amd/powerplay: add function to start thermal control Huang Rui
2019-01-25 10:24   ` [PATCH 077/138] drm/amd/powerplay: implement smu update table function Huang Rui
2019-01-25 10:24   ` [PATCH 078/138] drm/amd/powerplay: implement is_support_sw_smu function for new smu Huang Rui
2019-01-25 10:24   ` [PATCH 079/138] drm/amd/powerplay: implement sysfs of amdgpu_get_busy_percent for smu11 Huang Rui
2019-01-25 10:24   ` [PATCH 080/138] drm/amd/powerplay: implement sysfs of pp_table " Huang Rui
2019-01-25 10:24   ` [PATCH 081/138] drm/amd/powerplay: upload dpm level " Huang Rui
2019-01-25 10:24   ` [PATCH 082/138] drm/amd/powerplay: force clock levels " Huang Rui
2019-01-25 10:24   ` [PATCH 083/138] drm/amd/powerplay: implement sensor of SCLK and MCLK " Huang Rui
2019-01-25 10:24   ` [PATCH 084/138] drm/amd/powerplay: implement sensor of thermal_get_temperature " Huang Rui
2019-01-25 10:24   ` [PATCH 085/138] drm/amd/powerplay: implement sensor of get_gpu_power " Huang Rui
2019-01-25 10:24   ` [PATCH 086/138] drm/amd/powerplay: implement sensor of get_gfx_vdd " Huang Rui
2019-01-25 10:24   ` [PATCH 087/138] drm/amd/powerplay: implement sensor of get feature mask Huang Rui
2019-01-25 10:24   ` [PATCH 088/138] drm/amd/powerplay: implement sysfs of get num states function Huang Rui
2019-01-25 10:24   ` [PATCH 089/138] drm/amd/powerplay: implement sysfs of pp_cur_state function Huang Rui
2019-01-25 10:24   ` [PATCH 090/138] drm/amd/powerplay: implement sysfs of pp_force_state for sw-smu Huang Rui
2019-01-25 10:24   ` [PATCH 091/138] drm/amd/powerplay: add the function to set deep sleep dcefclk Huang Rui
2019-01-25 10:24   ` [PATCH 092/138] drm/amd/powerplay: add two interfaces to set_active_display_count and store_cc6_data Huang Rui
2019-01-25 10:25   ` [PATCH 093/138] drm/amd/powerplay: add smu display configuration change function Huang Rui
2019-01-25 10:25   ` [PATCH 094/138] drm/amd/powerplay: add get_clock_by_type interface for display Huang Rui
2019-01-25 10:25   ` [PATCH 095/138] drm/amd/powerplay: add interface to get max high clocks " Huang Rui
2019-01-25 10:25   ` [PATCH 096/138] drm/amd/powerplay: add interface to get clock by type with latency for display (v2) Huang Rui
2019-01-25 10:25   ` [PATCH 097/138] drm/amd/powerplay: add interface to get clock by type with voltage for display Huang Rui
2019-01-25 10:25   ` [PATCH 098/138] drm/amd/powerplay: add interface to request display clock voltage Huang Rui
2019-01-25 10:25   ` [PATCH 099/138] drm/amd/powerplay: add interface to get dal power level Huang Rui
2019-01-25 10:25   ` [PATCH 100/138] drm/amd/powerplay: add interface to get performance level Huang Rui
2019-01-25 10:25   ` [PATCH 101/138] drm/amd/powerplay: add interface to get current shallow sleep clocks Huang Rui
2019-01-25 10:25   ` [PATCH 102/138] drm/amd/powerplay: add interface to get current clocks for display Huang Rui
2019-01-25 10:25   ` [PATCH 103/138] drm/amd/powerplay: add interface to notify smu enable pme restore register Huang Rui
2019-01-25 10:25   ` [PATCH 104/138] drm/amd/powerplay: implement interface to set watermarks for clock ranges Huang Rui
2019-01-25 10:25   ` [PATCH 105/138] drm/amd/powerplay: add function to store overdrive information for smu11 Huang Rui
2019-01-25 10:25   ` Huang Rui [this message]
2019-01-25 10:25   ` [PATCH 107/138] drm/amd/powerplay: add golden dpm table to backup default DPM table Huang Rui
2019-01-25 10:25   ` [PATCH 108/138] drm/amd/powerplay: print overdrive percentage information for smu11 Huang Rui
2019-01-25 10:25   ` [PATCH 109/138] drm/amd/powerplay: get overdrive clock and voltage information Huang Rui
2019-01-25 10:25   ` [PATCH 110/138] drm/amd/powerplay: remove unnecessary checking in smu_hw_fini Huang Rui
2019-01-25 10:25   ` [PATCH 111/138] drm/amd/powerplay: don't check hwmgr while using the sw smu Huang Rui
2019-01-25 10:25   ` [PATCH 112/138] drm/amd/powerplay: implement power_dpm_state sys interface for SMU11 Huang Rui
2019-01-25 10:25   ` [PATCH 113/138] drm/amd/powerplay: add watermarks related data structs and function " Huang Rui
2019-01-25 10:25   ` [PATCH 114/138] drm/amd/powerplay: implement pp_power_profile_mode sys inerface " Huang Rui
2019-01-25 10:25   ` [PATCH 115/138] drm/amd/powerplay: add display_config to handle display config " Huang Rui
2019-01-25 10:25   ` [PATCH 116/138] drm/amd/powerplay: add mclk_latency_table struct and smu_clocks struct " Huang Rui
2019-01-25 10:25   ` [PATCH 117/138] drm/amd/powerplay: add enable_umd_pstate functions " Huang Rui
2019-01-25 10:25   ` [PATCH 118/138] drm/amd/powerplay: add get_profiling_clk_mask " Huang Rui
2019-01-25 10:25   ` [PATCH 119/138] drm/amd/powerplay: add set_uclk_to_highest_level " Huang Rui
2019-01-25 10:25   ` [PATCH 120/138] drm/amd/powerplay: add display_config_changed " Huang Rui
2019-01-25 10:25   ` [PATCH 121/138] drm/amd/powerplay: add apply_clock_adjust_rules " Huang Rui
2019-01-25 10:25   ` [PATCH 122/138] drm/amd/powerplay: add vega20_notify_smc_display_config functions " Huang Rui
2019-01-25 10:25   ` [PATCH 123/138] drm/amd/powerplay: add vega20_find/force_higest/lowest_dpm " Huang Rui
2019-01-25 10:25   ` [PATCH 124/138] drm/amd/powerplay: add vega20_unforce_dpm_levels " Huang Rui
2019-01-25 10:25   ` [PATCH 125/138] drm/amd/powerplay: implement power_dpm_force_performance_level " Huang Rui
2019-01-25 10:25   ` [PATCH 126/138] drm/amd/powerplay: add sys interface for pcie for smu Huang Rui
2019-01-25 10:25   ` [PATCH 127/138] drm/amd/powerplay: add function to update overdrive settings Huang Rui
2019-01-25 10:25   ` [PATCH 128/138] drm/amd/powerplay: add sys interface for set sclk_od/mclk_od for smu Huang Rui
2019-01-25 10:25   ` [PATCH 129/138] drm/amd/powerplay: add sys interface to set pp_od_clk_voltage " Huang Rui
2019-01-25 10:25   ` [PATCH 130/138] drm/amd/powerplay: adjust power state when set od_clk Huang Rui
2019-01-25 10:25   ` [PATCH 131/138] drm/amd/powerplay: dpm clk can be set only when performance level is manual Huang Rui
2019-01-25 10:25   ` [PATCH 132/138] drm/amd/powerplay: implement update enabled feature state to smc for smu11 Huang Rui
2019-01-25 10:25   ` [PATCH 133/138] drm/amd/powerplay: hwmon don't check powerplay when sw smu is enabled Huang Rui
2019-01-25 10:25   ` [PATCH 134/138] drm/amd/powerplay: implement uvd & vce dpm enable functions Huang Rui
2019-01-25 10:25   ` [PATCH 135/138] drm/amd/powerplay: implement sensor of uvd & vce power state for smu11 Huang Rui
2019-01-25 10:25   ` [PATCH 136/138] drm/amd/powerplay: implement dpm enable functions of uvd & vce for smu Huang Rui
2019-01-25 10:25   ` [PATCH 137/138] drm/amd/powerplay: Unify smu handle task function Huang Rui
2019-01-25 10:25   ` [PATCH 138/138] drm/amd/powerplay: enable amdgpu dpm for smu Huang Rui
2019-02-20 12:51   ` [PATCH 000/138] The new SW SMU driver of amdgpu Huang, Ray
     [not found]     ` <MN2PR12MB330957C48B4613D0D35B1AE4EC7D0-rweVpJHSKTpWdvXm18W95QdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2019-02-20 14:30       ` Deucher, Alexander

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1548411945-12396-107-git-send-email-ray.huang@amd.com \
    --to=ray.huang-5c7gfcevmho@public.gmane.org \
    --cc=Jack.Gui-5C7GfCeVMHo@public.gmane.org \
    --cc=Kevin1.Wang-5C7GfCeVMHo@public.gmane.org \
    --cc=Likun.Gao-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox